Wednesday, 24 June 2009

MSI X320 installation (revisited)

(this post has been updated on Sept. 3rd, 2009)

Installing Ubuntu from scratch (unless you want to live with Windows Vista Home Edition) on a MSI X320 is non trivial at best. The notebook comes without any CD-ROM but boots from an external USB CD- or DVD drive.

Installation goes straight forward, the system comes up nicely.

Things to keep in mind

Graphics resolution is 1024x768. The display can run at 1366x768. Here is what you have to do to get it:

Setting the right screen resolution

In Synaptic Package Manager under Settings/Repositories/Third-Party Software add:
deb http://ppa.launchpad.net/ubuntu-mobile/ppa/ubuntu jaunty main
copy the following text to a text file:
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: SKS 1.0.10

mI0ESXQtMgEEAMtSSxV/TSMW1mEnFVc7DJ/g/7UOq+TnlSs68uVbhUoh0BRuVScOb81dsyTg
IB3WQzbvE2r0ELa+L/hYGsRH9XOq5u+qVtBJmDtUWjT0okVlBBIpyWkM61sWCQYkbs4UcF9a
U+zfy4W1rIY81etivlqWQ79XmZ5iUHHMvGzvbZONABEBAAG0JExhdW5jaHBhZCBQUEEgZm9y
IFVidW50dSBNb2JpbGUgVGVhbYi2BBMBAgAgBQJJdC0yAhsDBgsJCAcDAgQVAggDBBYCAwEC
HgECF4AACgkQmdayHMZZijA7ZAP8DBWyjyo8O8hNbpvN/T7kEB4HxcNd6R6HaGQen3jSBrxe
vviVA1h2Md81C6gnvr/XT/kUYLyEK1oIY+jw8nHl7Z6Vf8kDfDACiN4KJXQY8wMOotQhHCZd
UM93u4yTZy+hWHcHU0/7a5EOU2bT7x3CztYJN7PURR89Sto3aXy3aW0=
=0g8f
-----END PGP PUBLIC KEY BLOCK-----
Save it under the name "msi.key" and import in the tab Authentication/Import Key File... (alternatively you can download the key from here).

Reload the repository. You should now find a package:
poulsbo-driver-2d and
poulsbo-driver-3d as well as
psb-kernel-source (will be needed by the wireless network driver as well).
Install it and its depending packages. Further install
compiz-settings-manager
awn-manager
and all depending packages if you want to mimic Apple.

Now edit the file /usr/bin/compiz. Its a wrapper script to launch compiz. Find the line that starts with:
WHITELIST="..."
Add a space and "psb" at the end so that screen composition works with the Poulsbo chipset.

I also installed AUT2 (the Austrian Ubuntu Theme) which has resembles a silvery blueish style. For that, copy AUT2 into /usr/share/themes and UE-icon-set-light into /usr/share/icons.

After rebooting the machine, you will be greeted with an optimized resolution of 1366x768. Choose the AUT2 theme from the Preferences/Appearance control panel.

Wireless LAN

You might find your machine not offering bluetooth and WLAN. Bluetooth can be turned on with the Fn-F9 key combination. WLAN ist toggled with the Fn-F8 key (not very intuitive icon).

Ubuntu does not provide a wireless driver for the RaLink RT3090 pci card built into the MSI X320. In order to get wireless working you need to download the source file. Either go to RaLink directly:
http://www.ralinktech.com/ralink/Home/Support/Linux.html
and download the file "2009_0612_RT3090_Linux_STA_V2.1.0.0_DPO.tar.gz" or download sources for SuSE 11 (which have some handy patches enclosed):
http://download.opensuse.org/repositories/home:/Akoellh/openSUSE_11.0_Update/src/rt3090sta-2.1.0.0-1.2.src.rpm
The driver derives from the RT2860. If you want to adjust the interface name to wlan-x and the driver name to rt3090sta, you need to patch some source files. SuSE delivers 5 patches, 4 of them apply, on is for 64bit versions only (which do not make sense and I could not get the driver to work with this patch).

Install the patch utility and optionally the rpm utility:
sudo apt-get install patch rpm
Sleves up

Extract the sources. If you extract from the RPM you have to extract the tar.gz contained in the directory within rt3090sta-2.1.0.0-1.2.src as well (I renamed the directory to RT3090 for convenience).

In the RPM sources you find 5 patch files, some decriptive text and the original source directory (is the same as the one from RaLink).

Source code preparation

You can either apply the patches or apply changes manually. To apply patches cd into the directory containing the Makefile (2009_0612_RT3090_Linux_STA_V2.1.0.0_DPO). All patches create a backup of the files patched (they have an extension .orig).
patch -b -p0 ---input=../rt3090sta-2.1.0.0-config.patch
This patches the Makefile and the os/linux/config.mk file. In my case I had to revert the changes in the Makefile (I simply copied the Makefile.orig over the Makefile).

You can apply these changes manually by editing ./os/linux/config.mk. Set:
HAS_WPA_SUPPLICANT=y
...
HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y
This allows the driver to be controlled from the Network Manager applet.

Next apply the WPA-mixed patch. This changes the encryption cypher to TKIP-AES.
patch -b -p0 ---input=../rt3090sta-2.1.0.0-WPA-mixed.patch
You can change the line in ./common/cmm_wpa.c from MIX_CYPHER_NOTUSE to:
WPA_MIX_PAIR_CYPHER FlexibleCipher = WPA_TKIPAES_WPA2_TKIPAES
manually.

If you use the patch utility, you can change the driver name to rt3090. This is cosmetic:
patch -b -p0 ---input=../rt3090sta-2.1.0.0-remove-potential-conflicts-with-rt2860sta.patch
This replaces all appearances of "rt2860" to "rt3090" in the file ./os/linux/pci_main_dev.c and can be done manually using gedit or vi.

We are nearly there. Another cosmetic change is applied by:
patch -b -p0 ---input=../rt3090sta-2.1.0.0-convert-devicename-to-wlanX.patch
This changes the default ra device to wlan device. You can manually replace the "ra" with "wlan" in the define statements of the file ./include/rtmp_def.h.

If you are not there, go back to the directory containing the first Makefile.

Compile

Simply call
make
This will start the compile process. Don't worry about the error messages. I tried to fix them but the results were no better.

After a while the make process will terminate with an error message (it cannot copy files to the /tftpboot directory). Don't worry, we don't need it.

Install

You can call
make install
or manually copy the driver and bind it to the OS:
cp ./os/linux/rt3090sta.ko /lib/modules/`uname -r`/kernel/drivers/net/wireless/.
depmod -a
There is also an install utility that you can use for this purpose.

Configure

You have to copy the file RT2860STA.dat to /etc/Wireless/RT2860STA. Create the directory Wireless and RT2860STA if it does not exist (if you used make install, this is done for you).

If the file is not found there, the wlan interface will not get registered and you will find an error entry in /var/log/syslog:
... RtmpOSFileOpen(): Error 2 opening /etc/Wireless/RT2860STA/RT2860STA.dat
(I found some posts on the internet that suggested fixing paramters in some configuration files. I think the euphoric success messages are due to frustration and not due to solution. Only having a system readable version of the file in the right place makes the driver work).

Edit the file /etc/Wireless/RT2860STA/RT2860STA.dat. Change the settings for:
CountryRegion
CountryRegionABand
CountryCode
WirelessMode
AuthMode=WPA2PSK
EncryptType
WPAPSK
or Keysettings. You can find the correct parameters to use in the template file README_STA_pci. Ignore advice of the rest of the file, it does not work in Ubuntu.

Start the driver

Before you continue, check the Network Manager applet. It should not offer you any wireless networks nor should you be able to Enable wireless either.
sudo modprobe rt3090sta
should work flawlessly. After a while you should be able to connect to the wireless network. Enter the connection information in Network Manager. If you choose auto connect and connection available to all users, connections will be set up automatically.

Reboot the machine. The driver should get loaded automatically after reboot.

Caveats

Some things to keep in mind:
  • The driver is copied into a directory tree of the kernel libs that gets replaced as soon as the kernel gets updated. You have to copy the kernel driver anew to the correct library path. I presume this is an accepable tradeoff until drivers get shipped with the standard image
  • The driver does not connect to SSIDs that are hidden (as was the case with my WLAN). I had to set the router to show my SSID in order to get a connection. This was the reason it took me that long to figure out how to install.
  • The warning messages that you saw during make do mean something. The source leaves some variables uninitialized. This generally is not a sign of good quality code. However, the driver works sufficiently. I hope RaLink people will deal with the warnings.
  • The driver does not correctly deregister for sleep mode.
Disable non-functional SD card driver

The SD card driver does not work on the MSI X320 (as of September 2009). The sdhci kernel mode drivers are notorious for making the machine unresponsive. The device does not release locking bits thus causing permanent timeouts, slowing the machine considerably. To disable kernel mode drivers in Ubuntu
  • goto /etc/modprobe.d/
  • create a file somenameorother.conf (I called it blacklist_sdhci.conf)
  • edit it to:
    blacklist sdhci
    blacklist sdhci_pci
  • restart the machine
You can edit existing blacklists but they might get overwritten in case of OS upgrades.

Other caveats
Neither suspend to RAM nor hibernating works.

I tried Karmic Koala (9.10) but neither the Poulsbo drivers, the SD card nor power savings were fixed.

Conclustion
If you can live with rebooting the machine, the MSI X320 is a slim, leightweight notebook. Here is a screenshot of how my machine looks now:

22 comments:

Zohan said...

Hi, have you now a WLAN Driver for the MSI X320 ???

Wolf Rogner said...

No, the driver can be compiled, loaded into kernel but the interface does not start.

Have you any ideas?

Zohan said...

Hi, in the moment no!
Came you from Germany?
I would like to buy in next days the x320. I love to run ubuntu at this machine no vista.
But the Problem is the f*ck wlan.
Wich Ubuntu Version do you use?

Wolf Rogner said...

Zohan,

I do not come from Germany.

Although I spent some time in Ireland, I would like to ask you to mind your language. I think the F-word is pretty inappropriate.

I use Ubuntu 9.04.

I tried several source versions (one from OpenSuse, the original) and followed some step-by-step proceedings but to no avail.

I tried to extract the install files from windows to use with Ndiswrapper. Did not work either.

I keep you posted

Zohan said...

Hi Wolf,

is the quality of the MSI X320 good? I mean the Display, weight, keyboard.
Is Windows XP a rocket on this machine or a cheap ???

Hmm....i need the wlan modus under ubuntu i have only wlan in mouse. i hate the LAN Cable :-)

Wolf Rogner said...

The quality of the machine is excellent. I would like to compare the physical hardware to Apple Macbooks (even though there will be uproar from the Apple community).

It is well equipped (has everything built in) and a reasonably price tag.

However, its the quality of Ubuntu drivers that lag behind. Drivers are poorly written (I went through some source code and nearly dropped dead).

On the other hand I do not have the time to clean up everything (I'd be writting parts of the os anew).

Network works fine using cable and a USB UMTS modem. Thats sufficient for now but not at all satisfactory.

I keep trying and posting.

Wolf Rogner said...

Zohan,

I got the wireless driver working. I will post a new blog entry tonight, stay tuned.

Zohan said...

YEAH!!!!
Cool please post here the Link for the WLAN Driver Info.

Many many thx to you.
Have you Skype?

Anonymous said...

I bought the x320 which is an awesome little machine... the only problem is that I haven't used windows for years and it runs better than linux on this... :S

After googling around for getting the idea on when the intel gma 500 driver will be supported it looks pretty grim.

even after getting it working with the correct res, it's very laggy...

Apparently the netbook remix will work, i'm going to test a whole lot of options tonight - such as Karmic (Desktop and UNR) and try a myriad of other things to see if I can get it working without the lagginess.

Does anyone have any update on how to actually get a full running Ubuntu on the msi x320 with the graphics working as well as on the (horrible) Vista that it came with?

Anonymous said...

So, I tried NBR, Karmic and the Poulsbo Drivers aren't any better, still can't get the wireless working....

RaLink have updated their site and have released a later version of the wireless driver..

http://www.ralinktech.com/support.php?s=2

which makes this post out of date for any new people that are trying to get ubuntu working on their MSI x320 (including me)

I have the latest version of Karmic running on the MSI now, just trying to get wireless before I go and look into the graphics, In Jaunty and Karmic after compiling this new driver version from RaLink I can see the wireless hotspots, authenticate but it just disconnects.

I found that the latest Kernel for ubuntu v2.6.32-rc1 has built in support for this card.

So I am going to compile this and test it, then look into the graphics (whether it be poulsbo or some hack to get it working)

Isn't there anyone else having these issues?? maybe this isn't a popular laptop or something to be running Ubuntu on as this is the only Blog that offers any chance of help :)

Daniel said...

Hi

This might just be because I'm a newbie, but I've got an x320 and just installed Ubuntu 9.10 and tried your guide for installing the display driver, but it keeps on telling me the packages have unresolved dependencies, I tried installing trough the terminal too, but without luck, is this because of the system being 9.10?

Wolf Rogner said...

Daniel,

the problems you experience have nothing to do with you being a newcomer.

Drivers are pretty bad and require tweaking.

There are new drivers on the website that I have not tested yet. Neither did I do tests with 9.10.

I plan to try Ubuntu Netbook Remix on the X320 in a few weeks (pretty busy these days) and will post information about how I went on.

If you need to use the machine, be patient and use 9.04 and the hints here.

Mongster said...

Hi Wolf, I have follow the first part of instruction to make the x320 graphic look correct. However, for the life of me, I cannot turn on the AWM like yours. I try to start the AWM and get message that my x320 screen is not composited. I try to turn on the visual effect to normal, and x320 says that I cannot activate the visual effect. What did I do wrong here? (I am a newbie to Linux... can you help me?)

Wolf Rogner said...

Mongster,

read again. You did not add your graphics card to compiz.

If it does not work, bring back the computer to your reseller.

Mongster said...

Hi Wolf, you are right. I place the graphic card compiz in the wrong place. Under the whitelist, psb must be placed within the entire ". . ." That is what is wrong with my compiz issue. Again, thank you Wolf!!!

Alfredo said...

Is there a way to install wireless without a ethernet connection.. I have only wireless @ home..

Alfredo said...

Do i need a wired connection to make wireless work? I only have wireless @ home

Carlos said...

Just wondering, do you know any distro that works out of the box? well at least with wireless working.. thx

Wolf Rogner said...

Carlos,

I understand that Linux is a generic OS. Distributions are just a flavour (or compilation of modules). So, the problem with Intels support is pertinent to all distributions.

SuSEs drivers were the source for my adjustments. They were the source for the modifications that are available at launchpad as well.

So: No, I tried Fedora 11/12, SuSE and Ubuntu. None provides support out of the box yet.

SpareTimeGizmos said...

Wolf -

Thanks for going to the trouble of documenting all this. I just got an X320 and got Ubuntu running on it thanks to your directions!

Graham said...

sorry if this is mostly irrelevent but it's hard to find info for this.

Hello. I have installed Jolicloud onto my x320, due to the fact that it appears to be the only os that integrates the gma500 driver with limited overhead. it works great, except WiFi does not work (maybe sleep and hibernation too - haven't checked yet), and for a netbook, especially a netbook running a hybrid webos, wifi is important. i've tried installing the driver from Ralink because it looks to be less complicated (link is bad btw, had to search), but when i run ./configure it says file not found and make fails (actually had to use apt-get to install make :/ ).
is there supposed to be a configue feature, or is that just because i used the gui (tar freezes).
Thanks

Ignacio Martinez said...

I have a MSI 320 running ubuntu 10.04
Look at these 2 posts

Video:
http://code.google.com/p/gma500/wiki/PPARepository

wifi:
http://ubuntuforums.org/showthread.php?t=1314747

SD card reader... no clue