Introduction
I recently installed [http://debian.org 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 [http://dri.freedesktop.org/wiki/ dri] to work
- using suspend to RAM (standby)
turning on hibernate with [http://suspend2.net suspend2]
- using the internal modem
You will find (my) solutions for these problems below.
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 # necessary as the soundcard does work after suspend without removing the modules # this (sadly) kills all sound related apps invoke-rc.d alsa suspend # 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 # load the sound modules again invoke-rc.d alsa resume
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
[http://suspend2.net 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 [http://suspend2.net 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 [http://suspend2.net 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 [http://suspend2.net/downloads/all/ 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 work after resuming, if you do not unload the modules before. This can be easily achieved by adding the following lines to your /etc/hibernate/hibernate.conf:
OnSuspend 20 invoke-rc.d alsa suspend OnResume 20 invoke-rc.d alsa resume
This will stop all processes accessing the soundcard and unload the modules before suspending the machine.
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
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).
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/lt_modem.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