Vagaries on the Linux Side

Installing Gentoo (2005.0) on an Acer 5021NWLCi

by François Wautier

This is a work in progress. Last updated July 10th 2006

Wireless News

As of kernel 2.6.16-r12 wireless is working again.

Problem emerging OpenSSH

Recently, when trying to emerge OpenSSH (4.2_p1-r1), it would fail complaining about not finding libpam. To solve the problem follow the method explainedin this thread. In short, what you have to do is

revdep-rebuild --soname liblber.so.2 
revdep-rebuild --soname libldap.so.2 
revdep-rebuild --soname libldap_r.so.2 

After that, you should be able to emerge OpenSSH.

Introduction

I just bought a new toy. The little beast is an Acer 5021NWLCi. As you can see by following the previous link, the beast is quite attractive and priced quite aggressively. For those interrested, I got mine for 44,400 Baht (just under USD 1100 in June 2005) with the memory upgraded to 1G. ( Send me an email if you want to know where I got that price.)

Here is what decided me to buy the thing:

Buying Woe

One of the thing that attracted me in that laptop was the fact that it came with Linux pre-installed. I had no intention of keeping Limpus Linux on it, but I hoped it would give me some hints as to how I needed to configured the kernel and X. Apparently, no one likes Linux® in Bangkok and so in every shops they are installing a virus from Redmond on it. As is typical in Thai tradition, they duly pay the required licensing fee... yeah right! In order for me to get a laptop that hadn't been tampered with, I had to wait for someone to bring it over from Acer Thailand.

Since I could not wait to play with my new toy, I quickly checked that everything was apparently working, paid and left for home.

First Contact

I thought Linux was pre-installed on that thing. I had booted it at the shop, but hadn't looked around... All I could get was a shell. Not even networking was working. Apparently, Acer believes that no one will use it with Linux, but that everyone will install bootlegs copies of another OS. Shame on you Acer! That machine deserves better.

Since there was nothing of interrest on that setup, I quickly set out to install Gentoo Linux (amd64) on it.

Is it working?

As this is a work in progress, not everything works..yet. So here is what I have so far:

Console Login OK
Framebuffer Login OK, but not with KDE
X Windows OK - Without drm drivers in the kernel
Wired Networking OK
Wireless Networking OK
USB OK
PCcard Some cards work. Needs boot parametre
Clock OK. Needs boot parametre
Synaptic Mouse-pad OK
ACPI Battery and temperatures can be monitored. Have not yet tried other stuffs.
Sound OK. You need headphones!
Modem Reported to work. See here. Thanks to Benjamin Larsson for the info. I did not test it.
Firewire Don't know. It looks like it is recognised by the kernel
Card Reader Don't know.
Various Buttons OK.

What I installed

I essentially followed the Gentoo installation manual. You can find my current kernel config here (2.6.12-gentoo-r4). Copy it to /usr/src/linux/.config if you want to compile the same kernel.

I have now switched to dbus, hal and pmount to handle removable media. It is easy to use and very well integrated with KDE. Just do

emerge dbus hal pmount

Don't forget to make your users member of the plugdev group.

In the past, I used submount to manage removable media. Here is how I was doing it. I added

=sys-fs/submount-0.9-r2 ~amd64
>=sys-libs/cracklib-2.8.3 ~amd64

to /etc/portage/package.keywords and I emerge'd submount. It is a great system to manage removable media. Add:

/dev/cdroms/cdrom0      /mnt/cdrom      subfs fs=cdfss,ro       0 0
/dev/sda1               /mnt/thumb      subfs fs=floppyfss,rw,umask=002 0 0

To /etc/fstab and do a

echo subfs >>/etc/modules.autoload.d/kernel-2.6

and you are in business. Do not emerge/use eject. you don't need it!

I also emerged the following packages:

They pulled in quite a few other packages. I also installed KDE 3.5. You can find my package.keywords file here.

General Impression

It's fast! 64 bits rules.

The hardware

Here is what lspci reveals:

-[00]-+-00.0  ATI Technologies Inc: Unknown device 5950
      +-02.0-[01]----00.0  ATI Technologies Inc M24 1P [Radeon Mobility X600]
      +-06.0-[09]--
      +-07.0-[04-05]--
      +-13.0  ATI Technologies Inc: Unknown device 4374
      +-13.1  ATI Technologies Inc: Unknown device 4375
      +-13.2  ATI Technologies Inc: Unknown device 4373
      +-14.0  ATI Technologies Inc ATI SMBus
      +-14.1  ATI Technologies Inc Standard Dual Channel PCI IDE Controller ATI
      +-14.3  ATI Technologies Inc: Unknown device 4377
      +-14.4-[06]--+-05.0  Broadcom Corporation: Unknown device 4318
      |            +-06.0  Texas Instruments Texas Instruments PCIxx21/x515 Cardbus Controller
      |            +-06.2  Texas Instruments Texas Instruments OHCI Compliant IEEE 1394 Host Controller
      |            +-06.3  Texas Instruments Texas Instruments PCIxx21 Integrated FlashMedia Controller
      |            +-06.4  Texas Instruments Texas Instruments PCI6411, PCI6421, PCI6611, PCI6621, PCI7411, PCI7421, PCI7611, PCI7621 Secure Digital (SD) Controller
      |            \-07.0  Realtek Semiconductor Co., Ltd. RTL-8169 Gigabit Ethernet
      +-14.5  ATI Technologies Inc: Unknown device 4370
      +-14.6  ATI Technologies Inc: Unknown device 4378
      +-18.0  Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration
      +-18.1  Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map
      +-18.2  Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller
      \-18.3  Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control

Kernel

I switched to 2.6.14-gentoo-r5. No problem as far as I can tell if you have the right kernel switches (see below)

More things working

Synaptics Mousepad

I can't figure out why it wasn't working before... Probably some stupid mistake I made. Yet.... I did see the mouse disappear under me whilst using a USB mouse. I also felt the response from the mousepad was... sluggish, for lack of a better word. I'll keep using a USB mouse, the pad may be a nice thing, but you need to get use to it.

Xorg

I had gotten the Xorg server and xdm to work with the drm in, but once I tried using kdm/KDE, the excrement hit the ventilator. I did not try to use some older window manager, but I think you should stay away from DRM for the time being. I also tried to get the ATI modules, but they would not compile. I did not try Gnome.. but my guess is that you would have similar problems.

Here is my initial config if you need it. You must emerge synaptics for it to work.

Xorg and ATI drivers

I decided I could live with a tainted kernel and installed the ATI proprietary drivers. It is quite simple.

emerge ati-drivers
echo fglrx >> /etc/modules.autoload.d/kernel-2.6

You then need to configure X. You can usefglrxconfig, the tool provided by ATI. Alternatively you can use my config file.. I created it by runningfglrxconfig and lifting the card definition out of the file it created. I merged that card definition into my original config file. Conor Svensson did it the other way around, after running fglrxconfig he edited the keyboard (uk) and mouse section of the file. He was kind enough to send me his config file, you can get it here.

Have a look at the fireglcontrolpanel utility that is bundled with the ATI drivers. I have not tried it yet, but it looks like a neat little thing.

KDE

I've installed KDE 3.5. KDE is working fine. KDE 3.5 is still masked in portage look at my package.keyword file.

Keyboard

Three keys seems to be handled entirely by the hardware. They work out of the box and their codes are not passed to any application nor do they generate any event. The keys are accessed with theFn key pressed. They are:

I could configure the keyboard to pass all the other keys. That includes the Euro and Dollar keys at the bottom right of the keyboard, the extra buttons at the top (The e and the P buttons. Themail and internet buttons work without added config) and the wireless and bluetooth button on the front of the laptop. The special function keys also work, that includes all the audio functions.

Note That you must setup the key codes exactly like me for this setup to work. You'll have to adapt things if you decide to use different keycodes

Many of the buttons can be detected using /dev/input/event0.

This solution could be used for any distribution, but here is the Gentoo specific setup

Since there is no provision in the keymap subsystem to add your own keycodes, I decided to add the instructions to /etc/conf.d/local.start. Just add the following lines at the end of the file:

 if [ -x /usr/bin/setkeycodes ]; then
        # Euro key
   /usr/bin/setkeycodes e033 132 1>&2
        # Xtra $ key
   /usr/bin/setkeycodes e034 133 1>&2
        # P button
   /usr/bin/setkeycodes e073 134 1>&2
        # e button
   /usr/bin/setkeycodes e074 135 1>&2
        # Wireless button on the front (active)
   /usr/bin/setkeycodes e055 145 1>&2
        # Wireless button on the front (not active)
   /usr/bin/setkeycodes e056 136 1>&2
        # Bluetooth button on the front (active) (not tested)
   /usr/bin/setkeycodes e057 146 1>&2
        # Bluetooth button on the front (not active)
   /usr/bin/setkeycodes e058 137 1>&2
        # Fn + ?
   /usr/bin/setkeycodes e025 138 1>&2
        # Fn + "pie" ( Acer eSetting )
   /usr/bin/setkeycodes e026 139 1>&2
        # Fn + "Circled V mark" (Acer Power Management)
   /usr/bin/setkeycodes e027 140 1>&2
        # Fn + Display switch
   /usr/bin/setkeycodes e029 141 1>&2
        # Fn + Z is 142 and handled out of the box
        # Fn + Touchpad Switch
   /usr/bin/setkeycodes e071 143 1>&2
        # Fn + Touchpad Switch.. Yes it is toggled
   /usr/bin/setkeycodes e072 144 1>&2
fi

The keys are now recognised, but they won't output characters yet.

I tried to use a mapping that would not conflict with other keyboard mappings (azerty,...). Let me know if you have a problem.

Here is where I think you can put the above code on other distribution. I have not tested it personally, proceed with caution.

Mandriva/Mandrake
Put the code at the end of /etc/rc.local
RedHat/Fedora
Put the code at the end of /etc/rc.local
SuSE
Change /usr/bin/setkeycodes to /bin/setkeycodes and place it /etc/init.d/boot.local (Have a rescue disk ready)

The console

At the console, you may want to use the Euro and Dollar keys. The easiest way would be for you to grab my keymap file and copy it to /usr/share/keymaps/i386/qwerty. You then need to edit /etc/conf.d/keymap and set

KEYMAP="acer5021"

If you do not have a querty keyboard, or want to create your own keymap file, just add

keycode 132 = euro
keycode 133 = dollar

to your own file.

The last thing you need is a font that will actually display the Euro sign. Edit /etc/conf.c/consolefont and set, for example

CONSOLEFONT="lat9w-16"

You can now reboot and use the keys. By using the key between right-alt and right ctrl or the windows key, you can now compose characters like ç on the console

X Windows

All the keys generate X-events, but you need to maps those to symbols. There are 2 ways to do that.

Quick and Dirty
Grab my .Xmodmap, copy it to .Xmodmap in your home directory and do a
xmodmap ~/.Xmodmap

In some cases, simply having the file .Xmodmap in your home directory will be enough. In others, you will need to put the above command in .xsession or .xinitrc. Thomas Deutch suggested creating a Shortcut to program in ~/.kde/Autostart to run the command eachtime KDE is started.

If you have more than one user on your laptop, each user must set this up.

The hard, but correct, way

First you must modify 4 files to register the new mappings. This is for the new modular X setup. The files are (click on the name to get my copy of the file):

The inet file contains the key mapping. The various mappings are sorted alphanumerically. At the time of this writting, July 2005, it should be placed in second position, after the airkey entry and before the azona one. The mapping is:

//
// keycode mapping for Aspire 5021 laptop
// by François Wautier < linux at fwconsult dot com >
partial alphanumeric_keys
xkb_symbols "aspire5020" {
    name[Group1]= "Acer Aspire 5020 Series Laptop";

    // Audio buttons
    key <I10>	{	[ XF86AudioPrev		]	};
    key <I22>	{	[ XF86AudioPlay, XF86AudioPause ] };
    key <I24>	{	[ XF86AudioStop, XF86Eject ]	};
    key <I19>	{	[ XF86AudioNext		]	};
    key <I30>	{	[ XF86AudioRaiseVolume	]	};
    key <I2E>	{	[ XF86AudioLowerVolume	]	};
    key <I20>	{	[ XF86AudioMute		]	};
    // Internet Buttons
    key <I32>	{	[ XF86WWW		]	};
    key <I6C>	{	[ XF86Mail		]	};
    key <K64>	{	[ XF86Launch0		]	};  // P button
    key <K65>	{	[ XF86Launch1		]	};  // e Button
    key <FK17>	{	[ XF86Launch2		]	};  // WLAN button (Not active)
    key <K68>	{	[ XF86Launch7		]	};  // WLAN button (active)
    // Probably needs Not Active Bluetooth key.
    key <I3C>	{	[ XF86Launch3		]	};  // bluetooth button
    //Function Buttons
    key <I75>	{	[ XF86Launch4		]	};  // Fn + ? (F1)
    key <I1E>	{	[ XF86Launch5		]	};  // Fn + pie (F2)
    key <I21>	{	[ XF86Launch6		]	};  // Fn + V mark (F3)
    key <I5F>	{	[ XF86Sleep		]	};  // Fn + z (F4)
    key <K66>	{	[ XF86Xfer		]	};  // Fn + Displaya(F5)
    key <K67>	{	[ XF86RockerDown	]	};  // Fn + Touchpad switch (F7)
    key <I63>	{	[ XF86RockerUp		]	};  // Fn + Touchpad switch (F7)
    // Some extra chars keys
    key <I0C>	{	[ EuroSign		]	};
    key <I78>	{	[ dollar		]	};
    key <LWIN>	{	[ Super_L		]	};
    key <MENU>	{	[ XF86MenuKB		]	};
};

As you can see above, I gave the keyboard the name aspire5020. That name must be added to xorg and xorg.list. The modifications are trivial, just look for the string airkey

The modification to xorg.xml is no less trivial. I suggest you add this:

<model>
  <configItem>
    <name>aspire5020</name>
    <description>Acer Aspire 5020 Series Laptop</description>
    <description xml:lang="fr">Portable Acer Aspire Série 5020</description>
  </configItem>
</model>

Now that the mapping is defined, you need to use it. For that you need to edit /etc/X11/xorg.conf (mine is here) and change the keyboard entry so that it looks like this:

Section "InputDevice"
        Identifier  "Keyboard0"
        Driver          "keyboard"
        Option          "XkbRules"      "xorg"
        Option          "XkbModel"      "aspire5020"
        Option          "XkbLayout"     "us"
        #Option         "XkbVariant"    "nodeadkeys"
EndSection

Restart X and you should be all set.

If you are using keyboard layout in KDE, just go to Regional & Accessibility - Keyboard layout in the Control Centre and select the Acer Aspire 5020 Series Laptop keyboard.

Under KDE, the sound key do the right things as it is. You can use KHotKeys to handle the various buttons.

Notes on my choice of mapping

I could not find any document spelling out the semantics of the various symbols defined in X. I tried to figure out as good a mapping as I could. For the sound/music keys it was somewhat simple. The mail and Internet buttons were similarly clear. For the switch display button (Fn + F5) I used XF86Xfer, I saw it as a display transfer. Fn + F7 is a bit strange, it seems to be toggled by the hardware. That is why there are 2 symbols associated with it. The XF86Rocker symbols with their Up and Down seemed the most appropriate.

Sound

The loudspeakers in this laptop are probably the worst thing there is about this computer. I don't know exactly what is coming out of those, but I am pretty sure that cannot be called sound. If you plan to use that laptop to play music, DVD or simply VoIP, you must buy a decent pair of headphones. Only then will you get acceptable sound.

The sound system on the Acer Aspire 5020 is very much like one of the last joke in Woody Allen's Annie Hall: Two old ladies are talking about airline food. One says to the other:This airline food is really terrible!. Yes!, replies the other. and portions are so small. It is the same thing with the sound on this laptop: It is terrible, and you can only use one sound application at a time.

Unless you configure it correctly that is.

To get sound, you must emerge the usual suspects with:

 emerge alsa-lib alsa-utils

After that I looked around the Internet and found some tips at the Phaeronix website. I modified it a bit and got the sound working OK with multiple applications running concurrently. Here is my config, just copy it to /etc and restart the sound system (reboot). With this config, I was able to use amarok (xine engine), the KDE sound system (alsa output) and Xine playing a CD simultaneously.

Gstreamer seems a bit more quirky.

ACPI

Thanks to Guido who tried this patch against kernel 2.6.12-gentoo-r6. The battery can now be monitored.

From 2.6.13 on, you can get it to work by adding ec_bust=1 to the kernel parameters, in /boot/grub/grub.conf or /etc/lilo.conf. Thank you to Mike Burgener for the info. He wrote me he found it here.

Wireless LAN

As can be seen above, the laptop uses the latest Broadcom AirForce One G54 chipset, the BCM4318. I found a XP-64 bit driver in a website from Acer. It seems the Acer site now requires login. You can grab my copy here.

Thanks to Mark Smith and his driver one can use the wireless adaptor on the 5020 Series. It is as simple as

  1. Downloading the acer_acpi driver
  2. Installing it. (make && make install)
  3. Create a file /etc/init.d/net.wlan0 (cp /etc/init.d/net.eth0 /etc/init.d/net.wlan0)
  4. Load the module (modprobe acer_acpi).
  5. Enabling the radio (echo "enabled : 1">/proc/acpi/acer/wireless)
  6. Loading the driver (modprobe ndiswrapper)

Now, like me, you probably want to be able to turn on/off the wireless function using the wireless button. Here is how I did it.

First make sure that the loading of the acer_acpi module occurs at boot time. To that effect do

echo acer_acpi >> /etc/modules.autoload.d/kernel-2.6

At this time, the acer_acpi driver does not generate any acpi event for the keys. That is too bad, for using acpid would have been my method of choice to toggle the wireless function. Instead, I wrote this little script. What this script does is simply loading the ndiswrapper driver when it is not loaded, or unload it when it is. Have a look, it is pretty straightforward. If you want all users to be able to run that script, you need to install sudo (emerge app-admin/sudo) and run visudo to change the setup. Add the line

%users	ALL=(ALL)	NOPASSWD: /usr/bin/acerwl

This should allow all your users to run that script with

sudo /usr/bin/acerwl

Make sure no one can write the script, else they could add their own commands. You need to adapt the setup above to wherever you copied the script. (I did copy it to /usr/bin)

You can now create a shortcut using, for example, KHotKey.

Note: If you want to use the Wireless button as your shortcut, you must create 2 shortcuts. That is because the scancode changes when the wireless adaptor is active. The keyboard description above as been adapted (Sept 5th 2005) to reflect the new scan code. I use the bluetooth button and it works fine.

Quirky things... but working

Clock

I tried using Xine to look at a DVD. It was weird, the pitch was right but it was going at twice the speed it should have gone. After investigating things, I found out that the clock was going at twice the speed. After a little googling I found out it is not an unknown phenomenon. After some test, I settled on adding noapictimer to the kernel parameters. My grub.conf looks like this:

# Which listing to boot as default. 0 is the first, 1 the second etc.
default 0
# How many seconds to wait before the default listing is booted.
timeout 30
# Nice, fat splash-image to spice things up :)
# Comment out if you don't have a graphics card installed
splashimage=(hd0,0)/grub/ESA_Mars.xpm.gz

title=Linux
root (hd0,0)
kernel /kernel-2.6.14-gentoo-r5 root=/dev/hda3 noapictimer pci=assign-busses ec_burst=1

title=Linux No Network
root (hd0,0)
kernel /kernel-2.6.14-gentoo-r5 root=/dev/hda3 noapictimer softlevel=nonetwork pci=assign-busses ec_burst=1

title=Linux Test
root (hd0,0)
kernel /kernel-2.6.13-gentoo-r5 root=/dev/hda3 noapictimer pci=assign-busses

title=Safe
root (hd0,0)
kernel /kernel-2.6.14-gentoo-r2 root=/dev/hda3 noapictimer pci=assign-busses

Note that the splash image is not standard, but available here.

Xine works fine now.

Benjamin Larsson made me aware of an alternate boot parameter to solve this problem:

	disable_timer_pin_1

This is for kernel 2.6.14 and newer. He found the information here.

PCMCIA

Thanks to the advice of Dominik Brodowski (mister PCMCIA himself) I got my SMC2835 wireless card working. When it is all said and done, it is actually very simple you must pass

pci=assign-busses

to your kernel. Simple.. I told you. Look above for my current grub config.

I did notice that another PCCard I have is still not working..

Things Not Working

None that I know of at this time



Linux On Laptops
TuxMobil - Linux on Laptops, Notebooks, PDAs and Mobile Phones