Saturday, May 26, 2007

Installing Ubuntu on a Fujitsu Lifebook A3120

As I mentioned in last week's post, I purchased a new Fujitsu Lifebook A3120. I've been busy lately, and consequently did not get any time to do any online research, something I did when I purchased my last laptop. I happened to be at Fry's Electronics, something which is quite rare for me lately, and I happened to be in the market for a new laptop, and the machine looked really nice, and I remembered reading somewhere that Fujitsu machines have a good reputation among the Linux community as being fairly easy to convert. And Linux installations have been getting slicker with more and more devices being supported. So it was something of an impulse buy, with a giant leap of faith in Fujitsu and recent Linux distributions. Kind of dumb, now that I think about it, but it mostly worked out OK, at least so far, so I guess alls well that ends well.

As it turns out, the machine got rave reviews for its looks, but not so much for its performance. One thing that disappointed me was its poor battery capacity, about 1.5 hours. Thats what my Toshiba gave me after about 2 years of use, when new the battery life was close to 3 hours. Its not a catastrophe, since I use the batteries during my commute to and from work, which is 50 minutes long. I just have to remember to charge the machine at home and at work. I was hoping they would sell a longer lasting battery, so I could just upgrade at some point, but according to their website, thats the only model they sell. Not sure what the guys at Fujitsu were thinking, but this can't be good for their image. For my part, I feel disappointed and cheated, since I had just assumed that modern laptops are built to provide at least 3 hours of battery life, and upto 6 if you shell out the big bucks. I guess thats the price you pay for not researching before buying.

The Lifebook is a AMD Turion 64 bit dual core machine. It came pre-installed with 32-bit Vista. I have been using Fedora for quite some time now, but a few colleagues suggested using Ubuntu, which is based off the Debian Linux distribution. I have been thinking of switching over to Debian for a while, but my last attempt to switch to Debian was a disaster, so I switched back to Fedora at that time. However, Ubuntu comes packaged as a Live CD, which allows you to run it off the CD, to see if all your devices are recognized, whether X comes up correctly, etc. So I decided to make the switch to Ubuntu.

To ease the transition, I bought and read Marcel Gagne's Moving to Ubuntu Linux, which was very helpful. It also came with a 32-bit Live CD, which worked fine. I tried downloading the 64-bit Ubuntu 6.06 (Dapper Drake), which promised long term support and roasting it with xcdroast on my Fedora box, but after toasting (pun intended) two CD-R's, a colleague burnt me the 64-bit Live CD using Nero.

I installed the 64-bit Dapper Drake Ubuntu from the Live CD, which was surprisingly painless. X worked right out of the box, and everything looked good. I even loved the human theme, with its swirling brown wallpaper, something I am told causes a lot of people extreme revulsion. The one thing that was almost completely unusable was the touchpad. It seemed to be way too sensitive, and would recognize a single tap as a double tap sometimes. At other times, I would have to double-click where I would normally expect to single click. A bit of searching on the Ubuntu forums led me to a variety of suggestions, from installing QSynaptics and configuring the touchpad through it, to replacing the InputDevice section for the touchpad with a custom one.

Turns out I had the Alps Glidepoint, which works with the Synaptics driver, but requires different configuration because the hardware is slower than the Synaptics hardware.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
sujit@sirocco:~$ cat /proc/bus/input/devices 
...
I: Bus=0011 Vendor=0002 Product=0008 Version=7321
N: Name="AlpsPS/2 ALPS GlidePoint"
P: Phys=isa0060/serio2/input0
S: Sysfs=/class/input/input3
H: Handlers=mouse2 ts2 event3 
B: EV=f
B: KEY=420 70000 0 0 0 0
B: REL=3
B: ABS=1000003
...

I installed qsynaptics as the threads asked, but tweaking the parameters did not help much. I then copied the new configuration verbatim from this Ubuntu Forum thread, which actually solved the problem. The following section replaces the section that was called "Synaptics Touchpad" in the default /etc/X11/xorg.conf file. I did notice that the touchpad would go revert back to the old behavior each time I switched from using AC to battery, but I am not noticing it anymore with the distribution upgrade to Feisty Fawn (more on that later).

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Section "InputDevice"
  Identifier  "Synaptics Touchpad"
  Driver    "synaptics"
  Option    "AlwaysCore"
  Option    "SendCoreEvents"  "true"
  Option    "Device"  "/dev/input/event2"
  Option    "Protocol"  "event"
  Option    "LeftEdge"  "130"
  Option    "RightEdge"  "840"
  Option    "TopEdge"  "130"
  Option    "BottomEdge"  "640"
  Option    "FingerLow"  "7"
  Option    "FingerHigh"  "8"
  Option    "MaxTapTime"  "180"
  Option    "MaxTapMove"  "110"
  Option    "ClickTime"  "0"
  Option    "EmulateMidButtonTime"  "75"
  Option    "VertScrollDelta"  "20"
  Option    "HorizScrollDelta"  "20"
  Option    "MinSpeed"  "0.60"
  Option    "MaxSpeed"  "1.10"
  Option    "AccelFactor"  "0.030"
  Option    "EdgeMotionMinSpeed"  "200"
  Option    "EdgeMotionMaxSpeed"  "200"
  Option    "UpDownScrolling"  "1"
  Option    "CircularScrolling"  "1"
  Option    "CircScrollDelta"  "0.1"
  Option    "CircScrollTrigger"  "2"
  Option    "SHMConfig"  "on"
  Option    "Emulate3Buttons"  "on"
EndSection

I then proceeded to install pwsafe, which is a simple command line password manager which I already used. The pwsafe code is available as source, and surprisingly, the C compiler did not come standard with Ubuntu desktop. Not that surprising though, if one thinks about it, since it is built for home users. To build pwsafe, you need to do the configure, make, make install sequence. Configure flagged down the missing components, and I used apt-get install to install them. Once done, I just dropped in the .pwsafe.dat file from my old 32-bit machine and it just worked.

Next I installed Java 6 (from Sun's website). Most modern Linux distributions include Java 1.4 which you can turn off by setting the JAVA_HOME variable to the current one in your .bash_profile.

I then installed the latest versions of Maven (my favorite Java build tool), and Ant (the build tool in use at work), and Eclipse 3.2.2, my favorite IDE. This time, I opted to put all the optional software under /opt, to avoid confusion and keep things clean. These need extra environment variables, which I also set in my .bash_profile.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Java settings
export JAVA_HOME=/opt/jdk1.6.0_01
export PATH=$JAVA_HOME/bin:$PATH
# Ant settings
export ANT_HOME=/opt/apache-ant-1.7.0
export PATH=$ANT_HOME/bin:$PATH
# Maven settings
export MAVEN_HOME=/opt/maven-2.0.6
export PATH=$MAVEN_HOME/bin:$PATH
# CVS Access (Work, sourceforge)
export CVS_RSH=ssh
#export CVSROOT=...
export CVSROOT=...

I also had to add this line to the end of /etc/profile for my .bash_profile to be actually called each time I logged on.

1
. $HOME/.bash_profile

The next step was to figure out how to connect to my employer's VPN. For my old Fedora laptop, I used PPTP Client for my current and previous employer. This time around, I was unable to install the PPTPConfig component, a GUI setup tool, since some of the libraries that PPTPConfig depends on are not available in the debian repositories as 64-bit packages. I saw some threads where they suggest either installing the 32-bit packages and the associated 32-bit library packages, or compiling from source, but I was not familiar enough with Debian/Ubuntu to do this. There were also a few threads that suggested using the Network Manager applet that was available in Feisty Fawn (Ubuntu 7.04) in place of the PPTPConfig program.

So I had two options. Either upgrade to 7.04 to get the Network Manager, or figure out how to do the configuration manually. I was actually able to connect to the VPN with the manual configuration, but none of the machines in the network behind the VPN were visible. This meant that I had to change my route to make these machines visible, but I know almost nothing about routes. I did notice that Dapper Drake seemed quite old (I got Apache 1.3 from the Drake repository for example, whereas I have been using Apache 2 for at least a year now on my old Fedora laptop), and since one of the main reasons I chose Debian/Ubuntu was because of its ease of upgrades, I decided to go with upgrading to Feisty Fawn.

Doing a distribution upgrade is actually quite easy. All you do is invoke the update manager, and a GUI will tell you if a new distribution is available, and lead you through the steps. Unfortunately, it will let you upgrade one release at a time. It took me about 4 hours to upgrade from Dapper (6.06) to Edgy (6.10), and another 3 hours to upgrade from Edgy (6.10) to Feisty (7.04).

Distribution upgrades using the update manager (apt dist-upgrade) are also apparently fraught with danger, based on the comments on the forums, and most people prefer doing a full install. I found out why, since X started crapping out with strange "command not found" errors when I upgraded to Edgy. The problem was that bash just got stricter, and the fix was to change the /bin/sh at the top of /etc/gdm/Xsession to /bin/bash. I found this quite easily from the forums however. There were no issues with upgrading from Edgy to Feisty.

With Feisty, there is a GUI which allows you to configure your VPNs, see available wireless hotspots, and restart your wired connection. Its pretty neat and very convenient, but sadly, I was not able to connect to my employer's VPN using it. This was the error message I saw in /var/log/messages when I tried to connect. If anyone knows why, or if there is a fix or workaround, please let me know. I have also posted a question in the forums, may post it as a bug if its not already there.

1
2
May 26 14:41:00 localhost kernel: [ 1659.772358] nm-ppp-auth-dia[10538]: segfault at 
0000000000000088 rip 00002abc6a6d221b rsp 00007fff45f70720 error 4

So I had to revert back to the manual method. Luckily, this time (after half a day's search), I found the magic route commands that will allow me to see and ssh to the machines behind the VPN in this thread.

I ended up with a solution that was quite a hack. I mean, pppd is so nicely structured to call the scripts /etc/ppp/ip-up, which will call /etc/ppp/ip-up.local and/or scripts in the /etc/ppp/ip-up.d/ directory when the VPN link is being established, and the corresponding scripts /etc/ppp/ip-down when being torn down. I could not make any of these work. Ultimately, as described in the thread, it just turned out to be a shell script that calls pon and poff and adds the route commands at the end of pon. However, whats important is that it works, and I can wait for the real fix to NetworkManager when it becomes available. Here is what my script looks like:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#!/bin/bash
case $1 in
  'on')
    echo "Starting VPN tunnel to company..."
    sudo pon vpn_company
    sleep 10
    sudo route add -net 10.1.128.0 netmask 255.255.255.0 dev ppp0
    sudo route add -net 10.1.1.0 netmask 255.255.255.0 dev ppp0
  'off')
    echo "Stopping VPN tunnel to company..."
    sudo poff vpn_company
    ;;
esac

And my manually configured tunnel file (/etc/ppp/peers/vpn_company) looks like this. It is mostly copied from the file generated by PPTPConfig on my Fedora laptop. The other files required for the configuration are listed in the "Configuring a tunnel by hand" section in the PPTPClient documentation.

1
2
3
4
5
6
7
8
pty "pptp vpn.mycompany.com --nolaunchpppd "
name MYCOMPANY\\sujit
remotename PPTP
require-mppe
file /etc/ppp/options.pptp
ipparam vpn_mycompany
usepeerdns
noauth

There are still a few other things I want to have working. I do have a wireless access point at home, but I have to get my wife off her PC to be able to configure it, and its set up to do MAC address authentication at the moment, so I was not able to test the wireless. However, the laptop is able to see the access point, so I think wireless should already work. This was quite refreshing compared to Fedora 2, where I had to compile the madwifi drivers for the integrated Atheros wireless card into the kernel. I never got around to doing this after upgrading to Fedora 3, as a result of which I haven't used wireless for quite a long while.

Thankfully, the laptop is at a point where its usable. It has all the software I need, the touchpad works, and I can connect through the VPN. Major thanks are due to the good folks who actually post to the Ubuntu Forums, one of the most comprehensive and active forums I have seen lately. There will definitely be more things I find and want as I explore Ubuntu and new softwares that are available here, and if I have issues with installing or using them, I may write about it here in the future.

2 comments (moderated to prevent spam):

urbanryoga said...

do you still have this laptop? I was wondering if you experience problems with the headphones after installing ubuntu. The headphone detection doesn't seem to work so it outputs to headphone and speakers.

Sujit Pal said...

Yes, I still have the laptop, but now I have Fedora 9 running on it. I switched back to Fedora after a dist-upgrade of Ubuntu 8.x fried my synaptics package, and I didn't know enough to work around this and get me a new one. To answer your question, though, I have never had the problem you describe with either OS, headphones are detected correctly for me.