[home]
Linux on a Fujitsu P2120A


Author: Peter Selinger
Date: October 28, 2003

For other reports of Linux on Fujitsu and other laptops, see:

Background

I bought a Fujitsu P2120 lifebook because it is so small and light, has a very high screen resolution, it has a rubber point mouse (I belong to the shrinking group of people who can't stand touchpads) and there are several web pages of people who said they have successfully installed Linux on it. Originally I wanted the B model (40GB harddrive and wireless networking), but by the time I had made up my mind, this model was no longer available in Canada (Fujitsu is apparently discontinuing the P2000 series), so I settled for the A model (30 GB harddrive and no wireless networking).

Shrinking the Windows XP partition

I used PartitionMagic to shrink the Windows XP partition to 8GB. (There was a second Windows FAT32 partition near the end of the harddrive, which I left untouched). PartitionMagic is commercial software, but it did a very good and easy-to-do job; as far as I know, free tools such as "fips" and "parted" are still unable to deal with the NTFS filesystem used by Windows XP.

Installing Debian (unsuccessful)

I have been a RedHat user for a long time, but there are some things I don't like about the RedHat distribution, so I decided to give Debian a try. I downloaded the ISO (CD-rom) image the latest "stable" release from the Debian webpage, which was "debian-30r1-i386-binary-1_NONUS.iso". There was no problem booting from this CD-Rom and at first the installation went fine; I created some partitions, answered lots of questions (Lots! Many more than RedHat, and most of them were about packages I didn't care about). For example, I must have chosen my "prefered language" at least five or six times (the answer, as you may imagine, was always the same).

When it came time to configure the X Windows System, I had to select a driver. Since the P2120 has an ATI Radeon Mobility M6 video card, I selected ATI, but this was a mistake. When I rebooted the computer, the X Server could not start up, and the X configuration tool which was automatically started exited immediately without doing anything, in particular, without letting me configure anything.

I then tried editing /etc/X11/XF86Config-4 manually, which did not help. I did not find any information on Debian's website on how to install the correct driver. Most of the P2120 web pages were by RedHat users, and one site which had installed Debian said merely, and somewhat unhelpfully, that they got it to work "after a little tweaking".

I gave up and decided to install RedHat 9 instead.

The only thing which I did get to work was the DSL connection. Here's what I had to put in /etc/ppp/pap-secrets:

"USERNAME"      *       "PASSWORD"
And here's what I had to type to start the connection:
pppd pty 'pppoe' user USERNAME noauth
(replace USERNAME and PASSWORD by your actual username and password from your DSL provider. In my case, Sympatico is the provider, and the username is 8 letters starting with "b1"). /sbin/ifconfig and /sbin/route helped me determine when I actually had a connection.

Update (October 29, 2003): I just saw the following hint on http://www.greenfly.org/fujitsu/. It looks like it might have solved my problem, but I overlooked it last night, and now it is too late for me to try it again.

"I received a tip from Aaron Enright, a P2120 user, on getting a working version of X for the P2120 with Debian Woody "the Debian way." Simply add
deb http://people.debian.org/~blade/woody/i386/ ./
to your sources.list and run apt-get update && apt-get upgrade to get a version of X that works on woody, without having to resort to installing the X binaries from their site."

Installing RedHat 9 (successful)

I burned 3 CD-Roms from the images that were called shrike-i386-disc1.iso, shrike-i386-disc2.iso, shrike-i386-disc3.iso (downloaded from one of the RedHat mirrors, see http://www.redhat.com/download/mirror.html)

I booted from the first CD-Rom. I selected "Manual" instead of "Workstation" or "Server" installation (I like to select which packages I install, even though I end up installing almost all of them anyway). I was suspicious of RedHat's automatic partitioning tool, so I selected manual partitioning using Disk Druid.

I found Disk Druid to be an entirely useless program - it would not allow me to take space from a logical partition and add it to a primary partition - even if enough space was available and there were no partitions that would have had to be moved as a result of the change. Since I already had created several partitions during my unsuccessful debian installation, and since I wanted to change the size of these partitions (erasing their previous contents), I was not very happy with Disk Druid. I rebooted from a rescue disk and used "cfdisk" to create precisely the partitions that I wanted. Here is what I created:

Partition   Size (ca.)  Mountpoint   Type
/dev/hda1   8000MB      none         07 (NTFS)
/dev/hda3   75MB        /boot	     83 (Linux)
/dev/hda4   400MB	none         a0 (hibernation)
/dev/hda5   700MB	none	     82 (Linux swap)
/dev/hda6   8000MB	/	     83 (Linux)
/dev/hda7   10.6MB      /home        83 (Linux)
/dev/hda8   1.5MB       /win_d       0b (Win95 FAT32)
The NTFS and Win95 partitions were preexisting. I created the /dev/hda4 (hibernation) partition because of something I read on http://www.greenfly.org/fujitsu/ (see Power Management, search for suspend-to-disk).

I then rebooted from the RedHat CD-Rom, and this time I just used DiskDruid to define the mountpoints and to format the Linux partitions.

The graphics card was automatically (and correctly) detected. The monitor was not detected, but I selected Generic 1024x768 LCD Display (1280x768 was not among the choices offered).

Auto-detection of the soundcard failed.

Everything else worked without any surprises. Problems:

To do:

Update: Setting up the Ethernet and DSL connections

October 29, 2003: Setting up the ethernet was easy and worked as expected. The ethernet is already set up by default (using DHCP), and it can be brought up as usual just by typing "ifup eth0". If you need to hardwire some specific IP address, use "netconfig" the first time, then edit /etc/sysconfig/network-scripts/ifcfg-eth0 manually to set ONBOOT=no. It might also be worth editing /etc/resolv.conf if you have more than one nameserver (DNS server), as netconfig only allows you to put one.

November 5, 2003: To get DSL to work, I ran adsl-setup. To start the connection, first shut down eth0: /sbin/ifdown eth0 (otherwise routing might get messed up). Then do /sbin/ifup ppp0. If this does not work, check in /var/log/messages for errors.

There's one problem remaining: my DSL connection times out after approximately 30 seconds of inactivity. This is very annoying if one is logged into another machine via ssh. I don't yet know how to fix this. It does not happen with my other laptop (and the same DSL connection).

Update (March 16, 2004): The DSL timeout problem is due to a bug in Redhat's adaption of the adsl-setup utility. The problem is that adsl-setup ignores the user's answer to the question "Do you want the link to come up on demand", and always sets a timeout of 20 seconds. This means that your link will time out after 20 seconds of inactivity. To fix it, change the value of PPPOE_TIMEOUT in the file /etc/sysconfig/network-scripts/ifcfg-ppp0 to 0:

PPPOE_TIMEOUT=0

Update: How to change the keyboard layout

November 5, 2003: I discovered a better way to change the keyboard layout on the Lifebook. See here for my old method of doing it. The new method has the advantage that it can be done on a per-user basis, does not require root privileges, and does not involve messing around with X configuration files.

As you can see in the picture, the original location of the right shift key is to the right of the "up" key. The shift key should actually be approximately where the "/" and "up" keys are. I solved this problem by exchanging the "shift" and "/" keys (as marked in blue in the picture). It is much easier for me to get used to the "/" key being in a non-standard location than the "shift" key. (Oh, and by the way: I did not write on my keyboard. I applied a layer of Scotch tape, wrote on that, and then I topped it off with a second layer of Scotch tape to keep the ink from smearing).

A user can simply re-program the keyboard (in X) by running the command

xmodmap keymapfile
where keymapfile is a file (you could give it any name you want, typically .xmodmaprc in the user's home directory) which contains the following:
keycode  61 = Shift_R question
keycode  62 = slash question
clear shift
add shift = Shift_L Shift_R
Voila, this does the trick. If you want to restore the default configuration, just run xmodmap on the following file:
keycode  61 = slash question
keycode  62 = Shift_R
clear shift
add shift = Shift_L Shift_R
To see your current keyboard layout, do
xmodmap -pke

The "A" and "B" buttons

The "mail" button
Note: the xev program can be used to figure out the correct keycodes for any key on the keyboard. 61 is the keycode for the physical "/" key, 62 is the keycode for the physical right shift key. Interestingly, the "A" and "B" user application buttons and the "mail" button located around the LCS panel do not seem to have keycodes, and neither does the "Fn" key. Thus, it does not seem that these keys can be assigned a function.

Update (January 21, 2004): Greenfly pointed out to me that his web page contains a description of how to get the "A", "B", and "mail" buttons to work.

Effects of the keyboard change

The most noticeable, and desirable, effect is that the shift and "/" keys have been exchanged. But there are a couple of other interesting effects: Note: with the new method, I have not been able to reprogram the "Up" key so that shift-up does nothing. It is possible to add the following to the keymapfile:
keycode  98 = Up Shift_R
However, this has the undesirable side-effect of preventing the up-key from auto-repeating.

How to change the keyboard on the console

The Linux consoles (Ctrl-Alt-F1 through Ctrl-Alt-F6) are not under the control of the X Window system, and thus the above method of changing the keyboard layout does not affect the console. It is, however, easy to change the keyboard layout on the console: simply run the program
loadkeys file
where file contains the following:
keycode  53 = Shift           
keycode  54 = slash            question        
        control keycode  54 = Delete          
        shift   control keycode  54 = Delete          
        alt     keycode  54 = Meta_slash      
To reset the default, do
loadkeys -d
To see your current keyboard layout in full detail, do
dumpkeys

What about the annoying "Fn" key?

The "Fn" key is where the "Ctrl" key should be. Obviously, I would like to change this too, but unfortunately, this cannot be done. The "Fn" key is controlled by the BIOS, not by the operating system. It is hard wired to perform certain functions, such as controlling the speaker volume (via F8 and F9), the screen brightness, and so forth. The operating system does not even know that this key exists.

I thought about making the Caps Lock key into an additional Ctrl key, but I decided to first wait if I wouldn't get used to the Ctrl key as it is.

Update: Setting the screen resolution

November 5, 2003: Setting the screen resolution was as easy as replacing
                Modes    "1024x768" "800x600" "640x480"
by
                Modes    "1280x768"  "1024x768" "800x600" "640x480"
in /etc/X11/XF86Config, and restarting the X Server.

Update: Setting up sound

November 6, 2003: I managed to get the sound to work, following the instructions on http://www.greenfly.org/fujitsu/. Here is what I did: First, I downloaded the following files from http://www.alsa-project.org/: I stored these files in /usr/local/src. Then I followed these steps:
cd /usr/local/src
# compile and install core sound drivers
tar jxf alsa-driver-0.9.8.tar.bz2
cd alsa-driver-0.9.8/
./configure
make
make install
modprobe snd-ali5451
# (/var/log/messages: kernel: PCI: Found IRQ 9 for device 00:04.0)
cd ..

# compile and install sound libraries, needed to compile alsa-aware programs
tar jxf alsa-lib-0.9.8.tar.bz2
cd alsa-lib-0.9.8/
./configure
make
make install
cd ..

# compile and install OSS compatibility stuff - many programs need this
tar jxf alsa-oss-0.9.8.tar.bz2
cd alsa-oss-0.9.8/
./configure
make
make install
modprobe snd-pcm-oss
modprobe snd-mixer-oss
modprobe snd-seq-oss
At this point, all the correct modules are installed and running, but you will not hear anything, because the speaker volume is initially set to 0! To set the volume, use aumix:
aumix -v 100 -w 100
At this point, your sound should be working. However, you still need to edit /etc/modules.conf to make the settings permanent. Here are the relevant lines in my /etc/modules.conf:
alias sound-slot-0 snd-ali5451
post-install sound-slot-0 /bin/aumix-minimal -f /etc/.aumixrc -L >/dev/null 2>&1 || :
pre-remove sound-slot-0 /bin/aumix-minimal -f /etc/.aumixrc -S >/dev/null 2>&1 || :
above snd-ali5451 snd-mixer-oss snd-pcm-oss snd-seq-oss
Note that there was an old "alias sound-slot-0 trident" line, which I deleted.

Update: "Checking new hardware"

November 8, 2003: RedHat Linux has a "Checking new hardware" feature which tries to detect new hardware during the boot process. Unfortunately, on the Lifebook, the ethernet card is configured in such a way that it is invisible if no actual network connection is present. Thus, each time I wanted to boot, but was not on the network, Kudzu (RedHat's hardware manager) asked me if I wanted to uninstall the ethernet driver. This was annoying, so I turned this feature off by renaming /etc/rc5.d/S05kudzu as /etc/rc5.d/K95kudzu.

Update (August 18, 2004): Regarding the "disappearing" ethernet device: there is a BIOS setting which allows the ethernet device to be always up, even when booting while on battery. This is very handy, because the default behavior is annoying. In the Setup Menu, under Advanced -> Internal Device Configurations -> LAN Controller, choose "Enabled".

Update: Enabling ACPI support (fixes the fan problem)

November 9, 2003: ACPI is the "Advanced Configuration and Power Interface", which replaces the older APM. It is an interface between the operating system and the BIOS, and it allows the operating system to control such features as the fan and the batteries, as well as (in principle, although not yet supported under Linux) to put the laptop to sleep.

The P2120 does not support APM, so the user has no choice but to install ACPI support. Otherwise, the fan behaves very badly (it goes on all the time), and when the laptop runs out of batteries, it just shuts off without warning.

Here's what I did to install it. First, I upgraded the kernel to version 2.4.22 (latest stable version) with ACPI support. To do so, I downloaded the following files from ftp://ftp.kernel.org/pub/linux/kernel/v2.4:

linux-2.4.22.tar.bz2
linux-2.4.22.tar.bz2.sign
and the following from http://acpi.sourceforge.net/download.html:
acpi-20031002-2.4.22.diff.bz2
acpi-20031002-2.4.22.diff.bz2.sign
I checked their signatures with the following sequence of commands:
gpg --keyserver wwwkeys.pgp.net --recv-keys 0x517D0F0E
gpg --verify linux-2.4.22.tar.bz2.sign linux-2.4.22.tar.bz2
gpg --verify acpi-20031002-2.4.22.diff.bz2.sign acpi-20031002-2.4.22.diff.bz2
(The primary key fingerprint was: C75D C40A 11D7 AF88 9981 ED5B C86B A06A 517D 0F0E). Then I unpacked the kernel:
cd /usr/src
tar jxf /usr/local/src/linux-2.4.22.tar.bz2
rm linux-2.4
ln -s linux-2.4.22 linux-2.4
Patched the kernel:
cd /usr/src/linux-2.4.22
bzcat /usr/local/src/acpi-20031002-2.4.22.diff.bz2 | patch -p1
Then I configured the kernel. In order not to have to configure it from scratch, I copied RedHat's configuration from the old 2.4.20-8 kernel:
cp ../linux-2.4.20-8/configs/kernel-2.4.20-i686.config .config
make menuconfig
Now we are in a menu to configure what is going to go into this kernel. Most of the stuff is enabled by default. I enabled all the ACPI stuff: under "General setup ... ACPI Support" I enabled everything (as modules where possible):
                 [*] ACPI Support (NEW)
                    AC Adapter (NEW)
                    Battery (NEW)
                    Fan (NEW)
                    Processor (NEW)
                    Thermal Zone
                    ASUS Laptop Extras (NEW)
                    Toshiba Laptop Extras (NEW)
                 [*]   Debug Statements (NEW)
                 [*]   Relaxed AML Checking (NEW)
Also, under "Processor type and features", I set the Processor family to "Crusoe", and I enabled "Local APIC support on uniprocessors" and "IO-APIC support on uniprocessors", since the help message said this could not hurt (I have no idea what this does). Then I exited the menuconfig program (and saved a copy of .config just in case).

Now I built the kernel:

make dep
make bzImage
I did not make a boot floppy, since I didn't have my floppy drive handy, and in any case, I was going to keep the old kernel in addition to the new one, so booting should be no problem. However, a boot floppy can be made at this point by doing this:
dd bs=8192 if=arch/i386/boot/bzImage of=/dev/fd0
One can even transfer the file arch/i386/boot/bzImage to another machine, and make the boot floppy later in case it is needed.

Now make and install the modules.

make modules
make modules_install
There were some errors from depmod about unresolved symbols:
depmod: *** Unresolved symbols in /lib/modules/2.4.22/kernel/crypto/autoload.o
depmod:         crypto_alg_lookup
depmod: *** Unresolved symbols in /lib/modules/2.4.22/kernel/crypto/proc.o
depmod:         crypto_alg_sem
depmod:         crypto_alg_list
I ignored these at first, but later removed the offending modules (which I didn't need anyway), by moving them out of the way; this prevents depmod from printing warnings during booting.
mv /lib/modules/2.4.22/kernel/crypto/proc.o /root
mv /lib/modules/2.4.22/kernel/crypto/autoload.o /root
mv /lib/modules/2.4.22/kernel/crypto/api.o /root
Now I put the new kernel into place, alongside the old kernel, which I kept:
cp arch/i386/boot/bzImage /boot/vmlinuz-2.4.22
cp System.map /boot/System.map-2.4.22
mkinitrd /boot/initrd-2.4.22.img  2.4.22
The last of these commands generates an "initial RAM disk", which the kernel needs, because otherwise it doesn't understand the ext3 file system during boot. Now I configured GRUB by adding (NOT replacing) the following section in /etc/grub.conf:
title Red Hat Linux (2.4.22)
        root (hd0,2)
        kernel /vmlinuz-2.4.22 ro root=LABEL=/ hdc=ide-scsi
        initrd /initrd-2.4.22.img
It is not necessary to do anything for the changes to take effect. By keeping the entry for the old kernel in /etc/grub.conf, we ensure that we can boot from that kernel, as well as the new one.

OK, the new kernel is in place, I rebooted, selected the new kernel from the boot menu, and voila, it worked.

Next, a few things needed to be done. First, the sound support needed to be recompiled and reinstalled for the new kernel, following the steps outlined in Setting up sound above.

We also need to try to get ACPI to do something useful. I am now following instructions from the website http://www.tldp.org/HOWTO/ACPI-HOWTO/loadmodules.html. To enable ACPI the first time, we need to load the respective modules:

modprobe ac
modprobe asus_acpi
modprobe battery
modprobe button
modprobe fan
modprobe processor
modprobe thermal
You can now do "lsmod" to verify that these modules have indeed been loaded; further, you can look at the files in /proc/acpi to verify that something is indeed there. By the way, don't execute this command: "echo 5 > /proc/acpi/sleep", because it will immediately and uncleanly turn off the laptop. I did this by mistake.

Also, I turned off the energy star features, whatever they are:

xset q
xset -dpms
and commented out the following line from /etc/X11/XF86Config:
Option      "dpms"

The kernel now understands ACPI, and the fan now behaves more normally than before. However, to be more useful, one should install acpid and acpi: I did this by installing the RPMs acpid-1.0.2-1.i386.rpm and acpi-0.0.6-1.i386.rpm, which were available from http://sourceforge.net/projects/acpid and http://grahame.angrygoats.net/acpi.shtml, respectively. Then I started the acpid daemon for the first time by hand (next time it is started automatically during system boot):

acpid
To get information about the battery status:
acpi -V
Finally, we need to make sure that the ACPI kernel modules are inserted automatically when the system boots. To this end, I inserted the following commands in the file /etc/rc.d/init.d/acpid:
# load acpi modules
echo -n "Inserting ACPI modules"
modprobe ac
modprobe asus_acpi
modprobe battery
modprobe button
modprobe fan
modprobe processor > /dev/null
modprobe thermal
success "Inserting ACPI modules"
echo
I inserted these lines in the section "start", just before acpid is called.

Note: When the battery runs out, the laptop still shuts off without warning. We need to put something into /etc/acpi/events/* to do something meaningful when the battery is low. See How to configure acpid to give battery warnings.

Note: I also had to reinstall PCMCIA (i.e., PC-card) support, because it had somehow gotten lost in the new kernel.

Update: How to configure acpid to give battery warnings

January 24, 2004: One problem with acpid was that, unlike apm, it does not have any useful default behavior to deal with critical situations, such as when a battery is about to run out. Even with acpi installed and working, the battery would typically just run out without any warning of any sort, and without a clean shutdown.

In order to react to such events, one must explicitly configure acpid to do so. I assume that acpi and acpid are already installed as described in Enabling ACPI support. Then here is what I did to configure acpid: I created the following three files:

After installing these files in the above places, the last two of them have to be made executable:
  chmod u+x /etc/acpi/actions/handler.sh /etc/acpi/actions/beeper.sh
and we need to send a SIGHUP signal to acpid for the changes to take effect:
  killall -HUP acpid
In detail: The file acpid.conf sets up a rule which tells acpid to call the script handler.sh every time an acpi event occurs (such as a change in battery level, or a change in AC adapter status). The shell script handler.sh takes care of everything needed to handle the event: it checks the event type, and if it's a battery or AC power event, it checks for a critical condition (AC power offline and battery level low). If the battery level is 5% or lower, we send a warning to all users, and let the computer start beeping. If the battery level is 2% or lower, we initiate a system shutdown. The script beeper.sh is used to turn a permanent beeper on or off.

See the manpage of acpid(8) for a description of the format of the acpid.conf file. See /var/log/acpid for any output from the event handling scripts, and also for some sample events.

Update: How to turn off sub-pixel rendering


Sub-pixel rendering
March 16, 2004: When installing RedHat 9 on my Lifebook, I noticed that there were strange color effects in anti-aliased fonts in Mozilla and other places (see the illustration to the right). This turns out to be a "feature" of the X Window system called "sub-pixel rendering". Apparently this makes fonts look better on some displays. Not on any of my displays, though, and certainly not on the Lifebook. I finally found out how to turn this off (thanks to Frank Pieczynski for pointing me in the right direction). In RedHat 9, check that the file /etc/fonts/font.conf exists, and create a file in the same directory named local.conf with the following content:

<!-- Turn off sub-pixel rendering -->
<match target="font">
    <edit name="rgba" mode="assign"><const>unknown</const></edit>
</match>

Normal anti-aliasing
Then restart the application in question (it is not necessary to restart the X Server). On some older systems, there is no file /etc/fonts/font.conf; such systems will have /etc/X11/XftConfig instead. If this is the case, you should be able to achieve the same effect by putting the following into the /etc/X11/XftConfig file:
# Turn off sub-pixel rendering
match edit rgba=unknown;


Back to Peter Selinger's Homepage: [home]
Peter Selinger / Department of Mathematics and Statistics / Dalhousie University
selinger@mathstat.dal.ca / PGP key