Sunday 26 August 2012

Setting Up Linux Mint on Fujitsu LH772

Recently, I bought a new notebook from Fujitsu, the LH772. Before the purchase, I tested that Ubuntu 12.04 supports the computer's function keys (mostly brightness and volume control), sound card and speakers. I decided to install Linux on it. There are a few problems, mostly regarding display card and wireless network, but I somehow am convinced that I can fix them or, at the least, work around them. This is the result of my research and journey.

The on-board hard disk drive is preloaded with an OEM Windows 7 installer. I don't want the Windows 7, mess up the boot loader or get caught installing a non-verified OS and void the warranty. So, I remove the drive and bought an SSD. The drive cover is secured by only two screws, the drive itself another two. Changing drive is very easy on the LH772.

I heard you will install Windows on first boot. I won't let you.
SSD speed test
555 MiB/s, about 10 times of what ordinary hard disk drives can achieve. I am impressed. SSDs' performance varies greatly among different data and usage conditions. Reviews and benchmarks has shown that SP900's read performance is between... 50MiB/s to 530 MiB/s, depending on data type and reading pattern.

Wireless network card does not work out of the box. If that is your only way to the internet, feel free to jump to the section about wireless network.

Display Card (NVIDIA GT640M LE)

The notebook features an NVIDIA GT640M LE display card, which "supports" Optimus Technology[Wikipedia], a hybrid display and power-saving solution developed by NVIDIA. Essentially, Optimus turns off the discrete display card when you don't need the processing power. Key benefits of using Optimus, according to NVIDIA, is:

  • completely automatic allowing you to experience longer battery life and amazing visuals without having to manually change settings;
  • behind the scenes and with no interference to what you're doing, Optimus seamlessly figures out how to best optimize your notebook computing experience.
The caveat is, the "automatic" and "no interference" part comes only if you are using Windows 7. If you look at the Wikipedia article, you will notice there is no Optimus support under Linux. That is, your discrete NVIDIA display card will run at full speed, draining battery life and overheating your computer. Ironically, at this stage, you cannot use the discrete card, even if you have driver installed.

NVIDIA. Damn. You.

So, if even official driver cannot help you, who can? The legendary Linux community. Introduce the Bumblebee Project, "a project aiming to support NVIDIA Optimus technology under Linux," as stated by the website.

Ubuntu has a ppa for Bumblebee. This simplifies installation a lot. However, I don't like the Unity interface and where Ubuntu is going; that's why I turn to Linux Mint, "Ubuntu done right" deemed by many. I was a Linux Mint Debian Edition (LMDE) user, but I failed to install Bumblebee on an older computer. I might try that again later.

To get Bumblebee work on Linux Mint 13 Maya, we need to add the ppa into repository. Open a terminal and type
sudo add-apt-repository ppa:bumblebee/stable
GT640M LT works only on the official driver version 304 (some say 302) or above, which is not provided by the default repositories, so we need to add another ppa
sudo add-apt-repository ppa:ubuntu-x-swat/x-updates
If you did not add the x-swat ppa and got the wrong driver, just first uninstall everything about NVIDIA or Bumblebee: i.e. nvidia-settings, nvidia, nvidia-current, bumblebee and bumblebee-nvidia. bbswitch-dkms can stay as it doesn't depend on driver.

Then, install the package bumblebee. apt-get will get all the dependencies for you.

If the NVIDIA driver changes your X server settings and mess up your resolution, just delete /etc/X11/xorg.conf (or, to be save, just rename it). Modern display drivers and X server don't need the file.

Now if you try to turn on the discrete card by, like,
optirun glxspheres
you might get an error message like this:
[ 34.776889] [ERROR]Cannot access secondary GPU - error: Could not load GPU driver
[ 34.776919] [ERROR]Aborting because fallback start is disabled.

That's because a setting in bumblebee is wrong. Edit /etc/bumblebee/bumblebee.conf
sudo nano /etc/bumblebee/bumblebee.conf
Change the line
Driver=
to
Driver=nvidia
and in the section [driver-nvidia] change the line
KernelDriver=nvidia-current
to
KernelDriver=nvidia
After a reboot, optiun should work.

Wireless LAN Card (Ralink RT3290 PCIe)

Compared to display card, getting Wifi to work is much simpler. No, it's not.

Linux does not come with a driver for this wireless LAN card before version 3.9, so we have to *gasp* build it from source.

First, download the driver from Ralink MediaTek. If you don't want to tell them your e-mail address, just type a@a.a like I did.

Decompress the archive file to, say, ~/wireless_driver
tar -xf //2012_0508_RT3290_Linux_STA_v2.6.0.0.bz2 ~/wireless_driver
Before we can build the driver, we have to make a few changes to the source files.

Open ~/wireless_driver/os/linux/config.mk
Change line 27 from
HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=n
to
HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y
Some say this will not change the compilation, but I did not test what will happen if it is leaved untouched as n.

In the same file, delete or comment out -DDBG on line 206. This will turn off debug mode. If debug mode is on, the driver will constantly display garbage message on dmesg, hiding real important information and messages. I have no idea why anyone will ship a driver with debug mode on as default.

Apparently, the developers have not tested how normal users use a driver. With -DDBG flag removed, the source will not compile. What we need to do is open ~/wireless_driver/sta/sta_cfg.c and delete line 4674
#endif /* DBG */
and line 4080
#ifdef DBG
to get the function definitions out of the ifdef block.

Now the source is ready. Change to the directory of the source in case you are not in it already:
cd ~/wireless_driver
If you have install this driver previously, clean the compiled and installed files before re-installation:
sudo make uninstall
sudo make clean

Compile and install:
sudo make
sudo make install

The driver should start automatically when the computer restarts.

IBus

As a daily Chinese user, I need a Chinese input method. I have been using IBus since Ubuntu introduce it at version... (I have to check it) 9.10. IBus works flawlessly once installed, except for Skype. The reason is that Skype uses QT4 library, but a normal installation of IBus on Mint doesn't include bindings (package ibus-qt4) for it. Start ibus (with its XIM server) by
ibus-daemon -x
Everything should work. If not, change the line
XIM=
to
XIM=ibus
in the file /etc/X11/xinit/xinput/default
Someone said that other files and options need to be set, but this is the one that did the magic for me.

Unresolved Problems

My Logitech M570 wireless trackball uses Logitech's Unifying receiver. If the computer boots with the receiver plugged in, the mouse will not work. Re-plugging sometimes help, removing then re-adding the hid_logitech_dj module using modprobe sometimes help. Nothing is clear to me now.

Function keys stop working after suspend. But if you have an SSD like I do, rebooting the computer takes only half a minute. So luckily it's not that big an issue.

Bluetooth is nowhere to be found except in lshw and lspci.

Sound level / mute setting and brightness setting usually won't survive a reboot.

The slowest mouse speed is still too fast for my 3500 dpi Razer DeathAdder.

Cinnamon is unstable with Hot corner enabled, particularly when scrolling fast in Firefox.

Update (29-8-2012)

I'm glad I have written this article. My SSD died just one day after I set everything up.

Update (20-7-2013)

Linux kernel 3.9 has out-of-the-box support for Ralink 3290.

Ralink has merged with MediaTek, and does not keep the old site accessible any more. Updated link accordingly.

4 comments:

  1. Just wondering, how do you know what Ralink model have you got in your laptop?

    Very well done for creating this post

    ReplyDelete
    Replies
    1. I got the model by using lspci. These are the relevant lines:
      04:00.0 Network controller: Ralink corp. Device 3290
      04:00.1 Bluetooth: Ralink corp. Device 3298

      Delete
  2. Hi,
    any chance you still have the wireless driver stored locally?
    Ralink has changed their website, and the version they kept online seems to be corrupted.

    Many thanks

    ReplyDelete
    Replies
    1. Yes, I still have it.

      I downloaded the driver from mediatek.com, and run MD5 on that file and the file I originally downloaded from relinktech.com. They returned the same checksum. So I don't think the new one is corrupted (or changed in any way).

      What is the problem that you are running into?

      If you can upgrade the kernel, you might want to try version 3.9 or later. Ralink 3290 works out-of-the-box (though still no Bluetooth).

      Delete