How to install Ubuntu_on_IBM_T23
Introduction
I recently installed Debian on an IBM (Lenovo) Thinkpad T23. This is not exactly spectacular, but I ran into some small problems, which I want to write down as a reference for others.
My problems were:
getting dri to work
- using suspend to RAM (standby)
turning on hibernate with suspend2
- using the internal modem
You will find (my) solutions for these problems below.
Inhaltsverzeichnis
DRI
The installation of Debian (sid - April 02006) worked smoothly - the graphic card (savage) was detected and everything seemed to be fine.
Only the output of glxinfo was strange, as it reported direct rendering: No. But the xorg log file reported a successful activation of dri.
Then I tried the following:
export MESA_DEBUG=verbose export LIBGL_DEBUG=verbose glxinfo
It reported a missing savage_dri.so file. So I installed libgl1-mesa-dri (apt-get install libgl1-mesa-dri), which contains /usr/lib/dri/savage_dri.so. Then it worked (as far as glxinfo tells you).
suspend to RAM (standby)
First you need to add acpi_sleep=s3_bios to your kernel boot options (preferably add it to the defoptions line in your /boot/grub/menu.lst and run update-grub afterwards).
Now you have to configure the acpi daemon to handle (e.g.) the closing of the lid. Put the following event handler into /etc/acpi/events/lid:
event=button[ /]lid action=/etc/acpi/lid.sh
/etc/acpi/lid.sh could contain the following:
# /etc/acpi/lid.sh # beware: you need the ibm_acpi module to use the volume-related lines below VOL_FILE=/proc/acpi/ibm/volume BEEP_FILE=/proc/acpi/ibm/beep # save state of system clock to hardware clock /sbin/hwclock --systohc # emit a low beep if [ -e "$BEEP_FILE" ] then echo 12 >"$BEEP_FILE" # wait for the beep before turning off the volume sleep 1 fi # saving the current volume level and mute the sound output # muting is nice to hide the strange suspend-sound if [ -e "$VOL_FILE" ] then # save the current volume level VOL=$(grep "^level:" "$VOL_FILE" | sed 's/[^0-9]//g') # mute the soundcard echo mute >"$VOL_FILE" fi # activate suspend to ram echo "mem" > /sys/power/state # set system clock from hardware clock /sbin/hwclock --hctosys if [ -e "$VOL_FILE" ] then # first: unmute again echo down >"$VOL_FILE" # restore the previous volume echo "level $VOL" >"$VOL_FILE" fi # IMPORTANT: enable the sound card again (otherwise it is silent after sleep/hibernate) amixer set Master mute >/dev/null 2>&1 amixer set PCM mute >/dev/null 2>&1 amixer set Master unmute >/dev/null 2>&1 amixer set PCM unmute >/dev/null 2>&1
Of course, the script has to be executable: chmod +x /etc/acpi/lid.sh.
You have to reboot to let the kernel boot option take effect.
hibernate with suspend2
recommended alternative
NOTE: meanwhile uswsusp became the most convenient approach for suspend. Just run aptitude install uswsusp and you are done. In this case you may ignore the following part.
if you really want suspend2 ...
suspend2 is not yet part of the main kernel tree, so you will have to compile your own kernel. This is fairly easy with debian.
The following steps are required to use suspend to disk:
turn on wake-up in your initrd
patch the kernel with suspend2
- install a helper script to suspend your machine
- connect a thinkpad button with the suspend script
prepare initrd
You usually need to build an initrd-image, as the default debian kernel depends on a lot of modules - and you will surely need some of them to boot your system.
To detect a wake-up boot, you need to put the line echo >/proc/suspend2/do_resume into the linuxrc file of your initrd.
Of course, you could do this manually, but automation makes more fun (and is easier):
apt-get install mkinitrd-tools
get the initrd script from http://wiki.suspend2.net/DistroAndHardwareSetup/DebianInitrd
save it as /etc/mkinitrd/scripts/swsusp (BEWARE: no special characters (like a dot) are allowed for the filename!)
make it executable: chmod +x /etc/mkinitrd/scripts/swsusp
This script will get used automatically during the kernel package building (see below).
If you compile the compression algorithm for suspend2 as a module (and not statically), then you should add it to the initrd module list:
echo "lzf" >>/etc/mkinitrd/modules
patch your kernel
Get the sources and install some helpful packages:
apt-get install linux-source-2.6.15 kernel-package fakeroot cd /usr/src tar xjf linux-source-2.6.15
Get the suspend2-patch and apply it:
wget http://suspend2.net/downloads/all/suspend2-2.2-rc16-for-2.6.15.1.tar.bz2 tar xjf suspend2-2.2-rc16-for-2.6.15.1.tar.bz2 cd linux-source-2.6.15 /usr/src/suspend2-2.2-rc16-for-2.6.15.1/apply
Reuse your current kernel configuration:
zcat /proc/config.gz >.config
Now you can build a debian package for your kernel (as normal user):
make-kpkg --initrd --rootcmd fakeroot kernel_image
You will get asked some questions regarding suspend2 - usually you should select Yes or at least Module.
When the package building is finished, you should install your shiny new kernel:
dpkg -i /usr/src/linux-image-2.6.15_2.6.15-10.00.Custom_i386.deb
Now it is the right time to reboot your box to test the new kernel.
suspending your machine
The hibernate package makes it quite easy to suspend your computer:
apt-get install hibernate
Maybe all users should be allowed to suspend the computer? Change the following line according to your needs and add it to /etc/sudoers (obviously you need sudo for this):
ALL ALL=(ALL)NOPASSWD: /usr/bin/hibernate
Now everyone may run sudo /usr/bin/hibernate to suspend the machine.
using thinkpad-buttons for suspend
I know, it is a quite clumsy way (acpi events should be more appropriate), but I only did it with tpb:
apt-get install tpb
You need to change two lines in your /etc/tpbrc:
NVRAM /dev/.static/dev/nvram THINKPAD /usr/bin/sudo /usr/sbin/hibernate
(I know - the static nvram device setting is just a quick and dirty workaround for not having configured it via udev ...)
The soundcard will not immediately work after resuming. This can be easily solved by adding the following lines to your /etc/hibernate/common.conf:
OnResume 20 amixer set Master mute >/dev/null 2>&1 \ amixer set PCM mute >/dev/null 2>&1 \ amixer set Master unmute >/dev/null 2>&1 \ amixer set PCM unmute >/dev/null 2>&1
Now add tpb to the system boot, by storing the following script as /etc/init.d/tpb:
case "$1" in start) tpb -d ;; stop) killall tpb ;; restart) "$0" stop "$0" start ;; esac
Now add it to your runlevel directories by issuing the following command:
update-rc.d tpb defaults
After your next reboot (or after typing /etc/init.d/tpb start now) you can use the button labeled ThinkPad to suspend your machine.
I know - this way was not very convenient. If you care - just improve this howto by clicking on edit
automatic hibernate when battery runs low
The goals are:
- give a non-annoying warning when the battery reaches a non-critical level
- hibernate if the remaining battery capacity reaches a critical level
- give a clearly visible warning before hibernate to allow the user to plug in power again
Put the following script into your /etc/acpi/ directory (e.g. as low_power.sh): low_power.sh
Now you have to register this event by saving the following lines as /etc/acpi/events/lowpower:
event=battery action=/etc/acpi/low_power.sh
The script uses the ibm_acpi module to emit a sound and to make the leds of your ThinkPad blink in case of emergency
internal modem
The output of lspci -v is (on my machine) the following:
0000:02:02.0 Communication controller: Agere Systems WinModem 56k (rev 01) Subsystem: AMBIT Microsystem Corp. IBM ThinkPad T23 (2647-4MG) Flags: bus master, medium devsel, latency 0, IRQ 11 Memory at c0201000 (32-bit, non-prefetchable) [size=256] I/O ports at 6440 [size=8] I/O ports at 6000 [size=256] Capabilities: [f8] Power Management version 2
Download the appropriate driver from http://www.heby.de/ltmodem (e.g. ltmodem-8.31b1.tar.gz). BEWARE: the official website seems to be down at the moment - try http://www.physcip.uni-stuttgart.de/heby/ltmodem/index.html instead.
extract it (tar xzf ltmodem-8.31b1.tar.gz)
as version 8.31b1 does not immediately work with linux 2.6.15 or higher, you have to do the following (otherwise: just skip these steps):
cd ltmodem-8.31b1 tar xzf source.tar.gz sed -i 's/PCI_DEVICE_ID_ATT_L56XMF/0x0440/' source/ltmodem.c tar czf source.tar.gz source rm -r source
now create a debian package containing the new modules and install it:
./build_deb dpkg -i ltmodem-2.6.15_8.31b1_i386.deb
Now you should load the modules:
modprobe ltmodem modprobe ltserial
wvdial should detect your new modem:
wvdialconf
Add the modules to your /etc/modules if everything worked well:
echo "ltmodem" >>/etc/modules echo "ltserial" >>/etc/modules
Additional stuff
hotswapping of ultrabay devices: http://www.thinkwiki.org/wiki/How_to_hotswap_UltraBay_devices
scrolling with your trackpoint: http://rsim.cs.uiuc.edu/~sachs/tp-scroll/
Comments
- maybe these links are interesting for you: