Installing Kubuntu8.04 KDE 4.1 remix on a ThinkPad X60s

From ThinkWiki
Revision as of 01:24, 20 August 2008 by Linuxrulez (Talk | contribs) (Hibernate and Suspend)
Jump to: navigation, search

Installation of Kubuntu 8.04 KDE 4.1 remix on a ThinkPad X60s

Summary

What works out of the box

  • Graphics card incl 3D acceleration
  • Wifi (incl with KNetworkManager)
  • Suspend to RAM
  • CPU scaling
  • Sound
  • Volume and mute keys (but no visual feedback)
  • Thinklight keyboard illumination key (Fn+PgUp)
  • VGA out to external monitor (plug in, restart X, use KRandRTray to control the two displays)
  • SDHC card reader
  • USB
  • Ethernet

What needs to be fixed

  • Hibernate / Suspend to DISK
  • Fn keys (e.g. brightness controls) generate ACPI events, but acpi_fakekey is broken

What has not yet been tested

  • Infrared
  • Modem
  • TPM
  • PCMCIA
  • Integrated fingerprint reader (sudo apt-get install thinkfinger-tools)

Installation

Back up everything you don't want to lose.

Update the BIOS if you're comfortable with doing that. In BIOS turn on virtualisation options VT and VT-d (full virtualisation using the kernel-based virtual machine kvm -- confirmed working!)

Installation was done from a USB CD/DVD drive from the Kubuntu 8.04 Live CD (KDE 4 remix) from kubuntu.org. You can do the partitioning using the live CD (there is an auto or manual partitioning tool in the installer, but you could also use fdisk or QTparted also). In particular take care if you want to keep the preinstalled Windows XP and Windows recovery partitions (or blow them away if you don't -- feels good doesn't it?). In any case you need to reduce the size of the Windows XP partition (perhaps to zero) to free some space, and create new partitions for Kubuntu and a swap partition (at least as large as the installed RAM so that suspend to disk can work). Previously the laptop had been booted into Windows so the FAT32 partition would get converted into NTFS.

Fixes after installation

KDE 4.1 repository

The KDE 4 remix cd gives you KDE 4.0, but KDE 4.1 is considerably better, so change this right away:

Add "deb http://ppa.launchpad.net/kubuntu-members-kde4/ubuntu hardy main" to the file /etc/apt/sources.list. Then type

sudo apt-get update && sudo apt-get dist-upgrade

and answer the questions in which you are prompted. If you do not have kubuntu-kde4-desktop installed, simply type

sudo apt-get update && sudo apt-get install kubuntu-kde4-desktop

and answer the questions. Both of these options are to be typed at the command prompt.

Install kdeplasma-addons

sudo apt-get install kdeplasma-addons

Restart KDE for the improved KDE 4.1 desktop.

Upgrades and Backports

Enable the backports repository by uncommenting this line in /etc/apt/sources.list:

deb http://gb.archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse

(or selecting "Unsupported Updates" in adept-manager).

Upgrade all software to the latest version with apt-get or adept-manager.

Wifi LED

The Wifi LED did not illuminate until I did the following:

sudo apt-get install linux-backports-modules-hardy

See https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.22/+bug/176090

Change the KDE menu back to classic mode

Make your life easier -- right click on the KDE menu icon and click "Switch to Classic Menu Style". You might need to unlock the widgets on the panel first.

Turn on desktop effects

The X60s is capable of running the beautiful Kwin compositing effects, so in System Settings click Desktop then Desktop Effects / General tab click "Enable Desktop Effects".

Fonts

By default the fonts look good, but it's worth learning how to make them absolutely perfect. It's not hard. The X60s is capable of displaying pin-sharp fonts, so don't accept any fuzzy antialiasing.

In System Settings/Font Installer you may want to install the true-type fonts from your Windows partition in the Fonts directory (do it system wide with the Administrator mode).

Then in System Settings/Appearance/Fonts, set all fonts to Tahoma 8 point (except fixed font = Courier New 8 point) and set "Use-antialiasing"=disabled, "Force Fonts DPI"=96 DPI (the LCD is actually 106x105 DPI, but at small sizes the number of pixels available for each character has a significant effect on the rendering -- Tahoma 8 looks good at 96 DPI).

In Konqueror choose the best TT fonts in Settings/Configure Konqueror, and set minimum font size=7, medium font size=8.

Now restart KDE to see the difference.

See also Optimal Use of Fonts on Linux and this font discussion.

Fonts for KDE3 apps

KDE3 apps (for example KNetworkManager) may still not have the correct fonts in KDE4. Try adding the following to ~/.kde/share/config/kdeglobals:

[General]
fixed=Courier New,8,-1,5,50,0,0,0,0,0
font=Tahoma,8,-1,5,50,0,0,0,0,0
menuFont=Tahoma,8,-1,5,50,0,0,0,0,0
taskbarFont=Tahoma,8,-1,5,50,0,0,0,0,0
toolBarFont=Tahoma,8,-1,5,50,0,0,0,0,0

and create ~/.kde/share/config/kcmfonts

[General]
dontChangeAASettings=false
forceFontDPI=96

Fonts for apps which run with root permissions

For example adept-manager (which is also a KDE3 app). First set the fonts with

kdesudo /usr/lib/kde4/bin//systemsettings

and for KDE3 apps also set up /root/.kde/share/config/kdeglobals and /root/.kde/share/config/kcmfonts as above.

Terminal Settings

In ~/.bashrc, uncommment the following line for a colour prompt:

force_color_prompt=yes

Get the version of vim with colour syntax highlighting:

sudo apt-get install vim

and in /etc/vim/vimrc uncomment the line

syntax on

Grub boot screen

When you are happy with the way GRUB boots (and your usual OS is first in the list) then shorten the timeout in /boot/grub/menu.lst so that it boots up faster:

timeout      2

Uncomment the following line for a colour boot screen:

color cyan/blue white/blue

If you prefer to see boot messages rather than a splash screen when the computer starts up, then change "splash" to "nosplash" in /boot/grub/menu.lst in the boot parameters.

Sound

In System Settings / Sound move the AD198x Digital #1 output up to the top preference for the sound outputs if necessary.

Hotkey problem

ACPI events from the Fn keys are seen properly in /var/log/acpid and feed through into the files in /etc/acpi which generate acpi_fakekey calls, which are then lost. See this launchpad page. It's best to use the default ubuntu kernels (i.e. NOT MarcoBazzani's patched kernel binaries!) unless you are compiling your own stock kernels anyway. Fix it another way, for example like this for Fn+F4 suspend and Fn+F12 hibernate -- hooking up directly to the sleep and hibernate scripts.

cd /etc/acpi
sudo mv sleepbtn.sh{,.orig}
sudo mv hibernatebtn.sh{,.orig}
sudo ln -s sleep{,btn}.sh
sudo ln -s hibernate{,btn}.sh

The brightness keys can be fixed in a similar way with a couple of scripts which change the LCD brightness instead of calling acpi_fakekey:

sudo mv video_brightnessup.sh{,.orig}
sudo mv video_brightnessdown.sh{,.orig}

and edit video_brightnessup.sh like this:

#!/bin/bash
BRIGHTNESS_OUTPUT="/proc/acpi/video/VID/LCD0/brightness"
BEEP_OUTPUT="/proc/acpi/ibm/beep"
CURRENT=$(grep "current:" $BRIGHTNESS_OUTPUT |awk '{print $2}')
case "$CURRENT" in
100)
echo -n 6 > $BEEP_OUTPUT
echo -n 100 > $BRIGHTNESS_OUTPUT;
;;
90)
echo -n 6 > $BEEP_OUTPUT
echo -n 100 > $BRIGHTNESS_OUTPUT;
;;
80)
echo -n 5 > $BEEP_OUTPUT
echo -n 90 > $BRIGHTNESS_OUTPUT;
;;
70)
echo -n 5 > $BEEP_OUTPUT
echo -n 80 > $BRIGHTNESS_OUTPUT;
;;
60)
echo -n 5 > $BEEP_OUTPUT
echo -n 70 > $BRIGHTNESS_OUTPUT;
;;
50)
echo -n 5 > $BEEP_OUTPUT
echo -n 60 > $BRIGHTNESS_OUTPUT;
;;
40)
echo -n 5 > $BEEP_OUTPUT
echo -n 50 > $BRIGHTNESS_OUTPUT;
;;
30)
echo -n 5 > $BEEP_OUTPUT
echo -n 40 > $BRIGHTNESS_OUTPUT;
;;
*) #default case
echo -n 6 > $BEEP_OUTPUT
echo -n 100 > $BRIGHTNESS_OUTPUT;
;;
esac

and video_brightnessdown.sh like this

#!/bin/bash
BRIGHTNESS_OUTPUT="/proc/acpi/video/VID/LCD0/brightness"
BEEP_OUTPUT="/proc/acpi/ibm/beep"
CURRENT=$(grep "current:" $BRIGHTNESS_OUTPUT |awk '{print $2}')
case "$CURRENT" in
100)
echo -n 12 > $BEEP_OUTPUT
echo -n 90 > $BRIGHTNESS_OUTPUT;
;;
90)
echo -n 12 > $BEEP_OUTPUT
echo -n 80 > $BRIGHTNESS_OUTPUT;
;;
80)
echo -n 12 > $BEEP_OUTPUT
echo -n 70 > $BRIGHTNESS_OUTPUT;
;;
70)
echo -n 12 > $BEEP_OUTPUT
echo -n 60 > $BRIGHTNESS_OUTPUT;
;;
60)
echo -n 12 > $BEEP_OUTPUT
echo -n 50 > $BRIGHTNESS_OUTPUT;
;;
50)
echo -n 12 > $BEEP_OUTPUT
echo -n 40 > $BRIGHTNESS_OUTPUT;
;;
40)
echo -n 6 > $BEEP_OUTPUT
echo -n 30 > $BRIGHTNESS_OUTPUT;
;;
30)
echo -n 6 > $BEEP_OUTPUT
echo -n 30 > $BRIGHTNESS_OUTPUT;
;;
*) #default case
echo -n 6 > $BEEP_OUTPUT
echo -n 100 > $BRIGHTNESS_OUTPUT;
;;
esac

And immediately you will find that Fn+Home and Fn+End move the brightness up and down correctly, with some audio feedback.

If the problem with acpi_fakekey is ever fixed, just restore the original files.

By the way if you ever want to use laptop mode for this, note that the value of $BRIGHTNESS_OUTPUT in that file should be "/proc/acpi/video/VID/LCD0/brightness" not "/proc/acpi/video/VID/LCD/brightness".

Other Fn keys for which scripts could be written:

Fn+F2: lock screen --> could set this to do the KDE screen lock
Fn+F3: show a battery display (cat /proc/acpi/battery/BAT0/info)
Fn+F5: working I think, cycling Wifi and Bluetooth on/off. Feedback? BT LED lights.
Fn+F7: should switch which screens are on VGA->LCD+VGA->LCD (use /proc/acpi/ibm/video ?)
Fn+F8: ? mouse utility, ?switch between the rubber mouse and touchpad (non-existent on X60s)
Fn+F9: ? start utility
Fn+spacebar: screen zoom

Hibernate and Suspend

Hibernate should work out of the box, although fiddling with your swap partition can break it.

Bear in mind that

  • 1) the swap partition must be large enough - at least the size of your RAM
  • 2) the UUID of the hibernate partition is set in /etc/initramfs-tools/conf.d/resume

and should be the same as the swap partition set in /etc/fstab.

  • 3) if you change the swap partition or reformat it you need to change the UUID in both

the above files and run

sudo update-initramfs -c -k 2.6.24-19-generic  [or whatever kernel number is shown by uname -a]

Other tools

free (shows swap mem)
sudo vol_id /dev/sdaN  (where N=1,2,3,4... shows the UUID of a partition)
swapon -s (display swap usage summary by device)

Suspend to RAM works out of the box.

Bluetooth

Fn+F5 cycles Bluetooth and Wifi on/off. There's a new version in development for KDE4, but the KDE3 kdebluetooth seems to work for OBEX file transfer.

sudo apt-get install kdebluetooth

HDAPS

Hard disk active protection system -- see HDAPS -- acclerometers which can be used for hard disk shock protection, or as a joystick for some games.

To enable the accelerometers load the relevant modules (see Tp_smapi):

sudo modprobe tp_smapi
sudo modprobe hdaps_ec

Add tp_smapi and hdaps_ec to /etc/modules to do this automatically at boot time.

Then to see a display of your laptop position:

sudo apt-get install hdaps-utils
hdaps-gl

Hard disk protection: a userspace demon hdapsd is in the Hardy repository but does not work without a kernel patch. Ideally for fast reaction speed the protection would be implemented entirely in kernel space. Hopefully this will arrive in the kernel soon thanks to hard work by Elias Oltmanns and others http://lkml.org/lkml/2008/7/26/17.

External Sources