kaens
August 16th, 2006, 06:13 PM
This isn't too hard to fix, but it's an annoying problem. When swapping an optical drive for a battery, Thinkpads (at the very least the T30 series) will freeze.
This is due to the "eject" command not being sent to ibm_acpi when the release lever is pulled.
To fix this, you need to compile and install the module lt_hotswap, which can be found here (http://sourceforge.net/projects/lths/).
Download the latest version of the module, read through the README.
To compile, make sure you have the source and headers (and build-essential) installed on your system. To install these, you can do this :
First, find the version of the kernel you are running:
cat /proc/version
This will give you output something like this:
Linux version 2.6.x.x stuff.....
All you need to remember are the numbers
Now, you need to install the headers and sources for your kernel:
apt-cache search linux-source | grep those-numbers
apt-cache search linux-headers | grep those-numbers
now run
sudo apt-get install names-of-packages-returned-by-apt-cache
Now change to the directory where you downloaded the lt_hotswap module and do the following:
tar xzf lt_hotswap-X.X.X
cd lt_hotswap-X.X.X
make
sudo make install
If everything went fine, we should be in business. To see what this adds, do this:
cat /proc/acpi/ibm/bay
#release the eject lever
cat /proc/acpi/ibm/bay
#should still be the same - push the lever back in
sudo modprobe lt_hotswap autoeject=1
cat /proc/acpi/ibm/bay
#release the eject lever
cat /proc/acpi/ibm/bay
#sweet.
Alright! You should be seeing the ststus go from occupied to unoccupied once you have issued the modprobe command.
Now you probably want this to load on boot. I know that I don't want to have to issue a modprobe command every time I startup my laptop. Normally, this would be a matter of adding a line to /etc/modules, and the options for the module in /etc/module.d/options. lt_hotswap, however, needs to be loaded after all the ACPI modules (so you probably could do this if you have all that compiled into your kernel) and for reasons unkown to me, udev won't load modules in a specific order, and apparently it's used to load the modules at boot.
There is a way though, it's just slightly more complicated than that.
Firstly, you do want to add the options to /etc/modules.d/options - add this line (minus quotes):
"options lt_hotswap autoeject=1"
This will allow the module, whenever loaded to detect the lever being released and issue that eject command.
Now, you need to write a small bash script. I called it lt_hotswap.sh:
#!/bin/bash
/sbin/modprobe lt_hotswap
This script needs to be setuid so:
chmod u+s lt_hotswap.sh
copy this file into the /etc/init.d directory, then issue the command
sudo update-rc.d lt_hotswap.sh defaults
and there! Now you should be loading it on boot, with no more not being able to swap your optical drives without freezing!
This is due to the "eject" command not being sent to ibm_acpi when the release lever is pulled.
To fix this, you need to compile and install the module lt_hotswap, which can be found here (http://sourceforge.net/projects/lths/).
Download the latest version of the module, read through the README.
To compile, make sure you have the source and headers (and build-essential) installed on your system. To install these, you can do this :
First, find the version of the kernel you are running:
cat /proc/version
This will give you output something like this:
Linux version 2.6.x.x stuff.....
All you need to remember are the numbers
Now, you need to install the headers and sources for your kernel:
apt-cache search linux-source | grep those-numbers
apt-cache search linux-headers | grep those-numbers
now run
sudo apt-get install names-of-packages-returned-by-apt-cache
Now change to the directory where you downloaded the lt_hotswap module and do the following:
tar xzf lt_hotswap-X.X.X
cd lt_hotswap-X.X.X
make
sudo make install
If everything went fine, we should be in business. To see what this adds, do this:
cat /proc/acpi/ibm/bay
#release the eject lever
cat /proc/acpi/ibm/bay
#should still be the same - push the lever back in
sudo modprobe lt_hotswap autoeject=1
cat /proc/acpi/ibm/bay
#release the eject lever
cat /proc/acpi/ibm/bay
#sweet.
Alright! You should be seeing the ststus go from occupied to unoccupied once you have issued the modprobe command.
Now you probably want this to load on boot. I know that I don't want to have to issue a modprobe command every time I startup my laptop. Normally, this would be a matter of adding a line to /etc/modules, and the options for the module in /etc/module.d/options. lt_hotswap, however, needs to be loaded after all the ACPI modules (so you probably could do this if you have all that compiled into your kernel) and for reasons unkown to me, udev won't load modules in a specific order, and apparently it's used to load the modules at boot.
There is a way though, it's just slightly more complicated than that.
Firstly, you do want to add the options to /etc/modules.d/options - add this line (minus quotes):
"options lt_hotswap autoeject=1"
This will allow the module, whenever loaded to detect the lever being released and issue that eject command.
Now, you need to write a small bash script. I called it lt_hotswap.sh:
#!/bin/bash
/sbin/modprobe lt_hotswap
This script needs to be setuid so:
chmod u+s lt_hotswap.sh
copy this file into the /etc/init.d directory, then issue the command
sudo update-rc.d lt_hotswap.sh defaults
and there! Now you should be loading it on boot, with no more not being able to swap your optical drives without freezing!