Difference between revisions of "Installing Ubuntu on a ThinkPad X31"

From ThinkWiki
Jump to: navigation, search
(Installing Ubuntu 16.04 on a Thinkpad X31)
 
(34 intermediate revisions by 18 users not shown)
Line 1: Line 1:
===Preface===
+
==Preface==
I installed hoary ([[Ubuntu]] "unstable") because of some specific needs. Netherless,
+
The content of this page was originally geared toward Hoary ({{Ubuntu 5.04}}),
this article should apply to Ubuntu 4.10 "The Warty Warthog" too.
+
but nearly everything here applies just as well to the Warty (4.10) and Breezy (5.10) releases.
  
===Choosing between APM and ACPI===
+
See [http://www.brixandersen.dk/papers/X31/X31.html Henrik Brix Andersens] page for a lot of useful background information.
  
Right now there is a crucial feature not working with ACPI on linux (2.6.9): suspend to ram does not switch off the LCD backlight.
+
==Installing without cdrom or floppy==
Ubuntu ships with ACPI enabled, but without ACPI suspend-to-disk being configured. In effect suspend is not working out of the box.
+
Look [[Installation on ThinkPads without CD-ROM drive|here]] or follow the [http://help.ubuntu.com/community/Installation/Netboot Netboot remarks] instructions at [http://wiki.ubuntu.com Ubuntu Wiki].
  
Simply disableing ACPI at boottime activates APM which works fine with suspend to ram and suspend to disk.
+
==Enabling the Access IBM Button and on-screen display for volume buttons==
 +
Install the tpb package (use Synaptic or ''$sudo apt-get install tpb''), then use the Users and Groups Administration tool to add your user account to the 'nvram' group. Now see [[ThinkPad Button|Access IBM Button]] for configuration details.
  
APM based suspend to disk needs a save2disk.img hibernation file on FAT16. See below.
+
==Choosing between APM and ACPI for power management==
===Installing without cdrom or floppy===
+
I tested both, APM and ACPI but settled with ACPI which now works like a charm.
  
Follow the instructions at [http://www.ubuntulinux.org/support UbuntuSupport]: [http://www.ubuntulinux.org/support/documentation/howto/helpcenterhowto.2004-11-26.2137127791/howto_view Netboot remarks ]
+
Since Ubuntu Dapper (6.06LTS) ACPI works out of the box, either in Standby Mode or Suspend to Disk Mode.  
 +
ACPI will make your system use about 10% less power than with apm, which reduces my battery runtime from ~4:00h to 3:40h.
  
===Disableing ACPI===
+
Please read "[[How to make use of Power Management features]]" for more in depth information.
  
To disable ACPI an activate APM boot your kernel with acpi=off
+
Unfortunately, if ACPI is used, hibernate and standby modes might not work with a CompactFlash card inserted. Read the [[Category_talk:X31|X31 Talk Page]] for further info.
  
...describe how to edit /boot/grub/menu.lst...
+
===Disabling ACPI and using APM===
 +
Simply disabling ACPI at boottime activates APM which works fine with suspend to ram and suspend to disk.
  
===Creating a APM hibernation file===
+
To disable ACPI boot your kernel with acpi=off
  
Use [[tphdisk]] utility to create a save2disk.img file on a hidden FAT16 partition,
+
''...describe how to edit /boot/grub/menu.lst...''
  
[[Category:X31]] [[Category:Ubuntu]]
+
APM based suspend to disk needs a save2disk.img hibernation file on FAT16. Use the [[tphdisk]] utility to create this file.
 +
 
 +
Use {{key|Fn}}{{Key|F4}} to suspend-to-ram and {{key|Fn}}{{key|F12}} to suspend-to-disk.
 +
 
 +
===Using ACPI===
 +
Get ubuntulinux, radeontool and this script (which goes in /etc/acpi), nothing more!
 +
{{NOTE|This procedure is not necessary with the Breezy Badger release, which already knows how to blank the radeon video. Just be sure you have the radeontool package installed.}}
 +
 
 +
{{cmduser|cat lid.sh}}
 +
 
 +
<pre>
 +
#!/bin/sh
 +
 
 +
. /usr/share/acpi-support/power-funcs
 +
 
 +
getXuser;
 +
 
 +
grep -q closed /proc/acpi/button/lid/*/state
 +
if [ $? = 0 ]
 +
then
 +
        . /usr/share/acpi-support/screenblank
 +
        echo `fgconsole` > $LIDSTATE
 +
        chvt 12
 +
 
 +
        # Unmount any NFS or SMB filesystems:
 +
        echo "unmounting NFS and SMB filesystems"
 +
        umount -a -r -t nfs,smbfs
 +
 
 +
        # remove modules
 +
        echo "remove modules"
 +
        #rmmod ipw2100    ## WLAN
 +
        rmmod ehci-hcd  ## USB module
 +
        rmmod uhci-hcd  ##  -||-
 +
 
 +
        # update the disk super block
 +
        echo "sync"
 +
        sync
 +
 
 +
 
 +
        # wait a second
 +
        sleep 1
 +
 
 +
 
 +
        # turn the LCD off
 +
        echo "backlight off"
 +
        radeontool light off
 +
 
 +
 
 +
        # suspend to ram
 +
        echo "suspend to ram"
 +
        echo -n mem > /sys/power/state
 +
 
 +
        # load modules
 +
        modprobe ehci-hcd
 +
        modprobe uhci-hcd
 +
 
 +
        # turn the LCD on
 +
        echo "turn the LCD on"
 +
        radeontool light on
 +
 
 +
        # go back to VT7 (X)
 +
        echo "back to VT7"
 +
        chvt 7
 +
 
 +
else
 +
        grep -q off-line /proc/acpi/ac_adapter/*/state
 +
        #if [ $? = 1 ]
 +
        #then
 +
                #su - $user -c "xscreensaver-command -unthrottle"
 +
        #fi
 +
        chvt `cat $LIDSTATE`
 +
fi
 +
</pre>
 +
 
 +
=Installing Ubuntu 10.04 on a Thinkpad X31=
 +
Ubuntu 10.04 out of the box has suspend/hibernate/resume failures and hard lockups.  Fortunately, they can all be solved.
 +
For the suspend/hibernate problems, modify /etc/default/grub, add 'nomodeset' to GRUB_CMDLINE_LINUX_DEFAULT.
 +
For networking problems with atheros, download a snapshot from wireless.kernel.org/download/compat-wireless-2.6, build and install it.
 +
For the problem with hard lockups, follow the steps on the ubuntu site for building a custom kernel.  Set processor type to 'PENTIUM-M' and disable SMP.
 +
 
 +
 
 +
=Installing Ubuntu 16.04 on a Thinkpad X31=
 +
To be able to install and boot Ubuntu 16.04, add [https://help.ubuntu.com/community/PAE <tt>forcepae</tt> to the boot options].
 +
 
 +
As with Ubuntu 10.04, resuming from standby will fail. Add <tt>nomodeset</tt> to the boot options to solve this. To do so permanently, open <tt>/etc/default/grub</tt> and modify <tt>GRUB_CMDLINE_LINUX</tt>:
 +
 
 +
<pre>GRUB_CMDLINE_LINUX="forcepae nomodeset"</pre>
 +
 
 +
With <tt>nomodeset</tt>, Ubuntu will now resume from standby properly. However, it will not turn off the display's backlight when it goes into standby. To solve this, install [[radeontool]] from the official PPA and [https://wiki.archlinux.org/index.php/Power_management#Sleep_hooks hook two services into systemd]:
 +
 
 +
<tt>/etc/systemd/system/backlight-suspend.service</tt>
 +
<pre>[Unit]
 +
Description=Turn off the backlight
 +
Before=sleep.target
 +
 
 +
[Service]
 +
Type=simple
 +
ExecStart=/usr/sbin/radeontool light off
 +
 
 +
[Install]
 +
WantedBy=sleep.target</pre>
 +
 
 +
<tt>/etc/systemd/system/backlight-resume.service</tt>
 +
<pre>[Unit]
 +
Description=Turn on the backlight
 +
After=suspend.target
 +
 
 +
[Service]
 +
Type=simple
 +
ExecStart=/usr/sbin/radeontool light on
 +
 
 +
[Install]
 +
WantedBy=suspend.target</pre>
 +
 
 +
Enable both services with:
 +
 
 +
<pre>systemctl enable backlight-suspend.service
 +
systemctl enable backlight-resume.service</pre>
 +
 
 +
=External Sources=
 +
*This guide is listed at the [http://tuxmobil.org/ibm.html TuxMobil Linux laptop and notebook installation survey (IBM/Lenovo)].
 +
 
 +
 
 +
[[Category:X31]]

Latest revision as of 21:36, 6 January 2017

Preface

The content of this page was originally geared toward Hoary (Ubuntu 5.04), but nearly everything here applies just as well to the Warty (4.10) and Breezy (5.10) releases.

See Henrik Brix Andersens page for a lot of useful background information.

Installing without cdrom or floppy

Look here or follow the Netboot remarks instructions at Ubuntu Wiki.

Enabling the Access IBM Button and on-screen display for volume buttons

Install the tpb package (use Synaptic or $sudo apt-get install tpb), then use the Users and Groups Administration tool to add your user account to the 'nvram' group. Now see Access IBM Button for configuration details.

Choosing between APM and ACPI for power management

I tested both, APM and ACPI but settled with ACPI which now works like a charm.

Since Ubuntu Dapper (6.06LTS) ACPI works out of the box, either in Standby Mode or Suspend to Disk Mode. ACPI will make your system use about 10% less power than with apm, which reduces my battery runtime from ~4:00h to 3:40h.

Please read "How to make use of Power Management features" for more in depth information.

Unfortunately, if ACPI is used, hibernate and standby modes might not work with a CompactFlash card inserted. Read the X31 Talk Page for further info.

Disabling ACPI and using APM

Simply disabling ACPI at boottime activates APM which works fine with suspend to ram and suspend to disk.

To disable ACPI boot your kernel with acpi=off

...describe how to edit /boot/grub/menu.lst...

APM based suspend to disk needs a save2disk.img hibernation file on FAT16. Use the tphdisk utility to create this file.

Use FnF4 to suspend-to-ram and FnF12 to suspend-to-disk.

Using ACPI

Get ubuntulinux, radeontool and this script (which goes in /etc/acpi), nothing more!

NOTE!
This procedure is not necessary with the Breezy Badger release, which already knows how to blank the radeon video. Just be sure you have the radeontool package installed.

$ cat lid.sh

#!/bin/sh

. /usr/share/acpi-support/power-funcs

getXuser;

grep -q closed /proc/acpi/button/lid/*/state
if [ $? = 0 ]
then
        . /usr/share/acpi-support/screenblank
        echo `fgconsole` > $LIDSTATE
        chvt 12

        # Unmount any NFS or SMB filesystems:
        echo "unmounting NFS and SMB filesystems"
        umount -a -r -t nfs,smbfs

        # remove modules
        echo "remove modules"
        #rmmod ipw2100    ## WLAN
        rmmod ehci-hcd   ## USB module
        rmmod uhci-hcd   ##  -||-

        # update the disk super block
        echo "sync"
        sync


        # wait a second
        sleep 1


        # turn the LCD off
        echo "backlight off"
        radeontool light off


        # suspend to ram
        echo "suspend to ram"
        echo -n mem > /sys/power/state

        # load modules
        modprobe ehci-hcd
        modprobe uhci-hcd

        # turn the LCD on
        echo "turn the LCD on"
        radeontool light on

        # go back to VT7 (X)
        echo "back to VT7"
        chvt 7

else
        grep -q off-line /proc/acpi/ac_adapter/*/state
        #if [ $? = 1 ]
        #then
                #su - $user -c "xscreensaver-command -unthrottle"
        #fi
        chvt `cat $LIDSTATE`
fi

Installing Ubuntu 10.04 on a Thinkpad X31

Ubuntu 10.04 out of the box has suspend/hibernate/resume failures and hard lockups. Fortunately, they can all be solved. For the suspend/hibernate problems, modify /etc/default/grub, add 'nomodeset' to GRUB_CMDLINE_LINUX_DEFAULT. For networking problems with atheros, download a snapshot from wireless.kernel.org/download/compat-wireless-2.6, build and install it. For the problem with hard lockups, follow the steps on the ubuntu site for building a custom kernel. Set processor type to 'PENTIUM-M' and disable SMP.


Installing Ubuntu 16.04 on a Thinkpad X31

To be able to install and boot Ubuntu 16.04, add forcepae to the boot options.

As with Ubuntu 10.04, resuming from standby will fail. Add nomodeset to the boot options to solve this. To do so permanently, open /etc/default/grub and modify GRUB_CMDLINE_LINUX:

GRUB_CMDLINE_LINUX="forcepae nomodeset"

With nomodeset, Ubuntu will now resume from standby properly. However, it will not turn off the display's backlight when it goes into standby. To solve this, install radeontool from the official PPA and hook two services into systemd:

/etc/systemd/system/backlight-suspend.service

[Unit]
Description=Turn off the backlight
Before=sleep.target

[Service]
Type=simple
ExecStart=/usr/sbin/radeontool light off

[Install]
WantedBy=sleep.target

/etc/systemd/system/backlight-resume.service

[Unit]
Description=Turn on the backlight
After=suspend.target

[Service]
Type=simple
ExecStart=/usr/sbin/radeontool light on

[Install]
WantedBy=suspend.target

Enable both services with:

systemctl enable backlight-suspend.service
systemctl enable backlight-resume.service

External Sources