Some linux notes
Linux suspend-to-RAM on a Dell D830 with NVIDIA graphics
After a recent system update, my laptop's power management went to hell:
I could no longer suspend the machine to RAM at all. As I'm always schlepping
my laptop everywhere I go, I constantly use suspend-to-RAM and need it
to work reliably.
A few years ago I ruined a laptop because its suspend feature chose to fail as
I was putting it in my bag for a cross-country flight. After the painful
experience of cooking one laptop, I really
want power management to work!
Power management software interacts with the BIOS, the video driver, the operating system, and (if you're running X) the window manager. This complicated
mess works in Windows
because hardware vendors work hard to make sure their hardware is
Windows-compliant, and they share proprietary specs with Microsoft.
With our small market share Linux is an afterthought, leaving
us to muddle through on our own. Because of all the different factors, getting
it working takes trial and error augmented by educated guessing and plain
luck. These notes are the result of several days'
experimentation with several different Linux kernels, BIOS versions, and
video drivers.
System configuration
The first step is to get low-level suspend-to-RAM working reliably.
In experimenting with options to s2ram
(see below) you
will probably hit on a combination that works. Unfortunately, those
same options may fail the next time! Lesson #1: when you see s2ram
working once, you're not done. Don't be satisfied until you can invoke
s2ram
over and over again without it failing. Remember: the
worst case is when s2ram
works most
of the time then fails when it's really needed, like on a cross-country flight.
To get reliable results, I needed to experiment with combinations of the BIOS
version, the kernel version, and the video driver.
- BIOS -- I have been unable to make S2R work with any
version of the BIOS other than D830-A02. Dell strongly recommends updating to
D830-A04, but after doing so, S2R fails sporadically. Upon upgrading to
the most recent version (as of 29 May, 2008), D830-A12, S2R
fails pretty much all the time.
If you need to change your BIOS, go to Dell's support page to download
a program to flash the BIOS. To run the flash program, you'll need
a bootable MS-DOS floppy disk (no kidding!). If you're running a laptop
recent enough to be running a 2.6.x kernel you probably don't have a
floppy drive, so you'll need to burn a disk image to CD. Google will point
you to many pages telling you how to make a DOS boot disk from Linux.
- Kernel -- version 2.6.22.17-0.1 works, as does 2.6.22.5-31.
- Video driver -- I was able to make S2R work using version
100.14.19
of the NVIDIA driver.
This combination is almost certainly not the only working solution, but
it is a place to start. In experimenting or when deciding to upgrade,
keep in mind that the behavior seems
to depend on the BIOS version most critically, NVIDIA driver next,
and kernel last. Be very conservative about updating
your BIOS firmware: your vendor probably never tests the BIOS software
on Linux at all, so all bets are off.
Having found a combination of BIOS, video driver, and kernel that works,
the next step is to set your system files so everything's ready to
go each time you start your system.
Bootloader configuration
At boot time, you should turn off framebuffer graphics and also
the default AGP module. Do this by passing
vga=0x0 agp=off
as arguments to the boot command line. If you are running the GRUB bootloader,
you can have this done automatically by
editing the appropriate line in
/boot/grub/menu.lst
Module configuration
Turn off all AGP modules. Run lsmod | grep agp
to find
all module names, and then blacklist them (except agpgart
).
For example, if you find
intel_agp
running, add
blacklist intel_agp
to /etc/modprobe.conf.local
NVIDIA driver configuration
After installing the correct NVIDIA driver and setting up xorg.conf
correctly, add
Option "NvAGP" "1"
to the Device section of xorg.conf
s2ram configuration
The mid-level command to invoke suspend-to-RAM is
s2ram. Allegedly this works
out-of-the box for many systems, but the Dell D830 with NVIDIA drivers
isn't among them. Advice on
dealing with an unknown machine
suggests combinations of command-line options to try. I found that
s2ram -f -a 1 -m
works on my combination of BIOS and video driver.
Having found command-line options that work, in the file
/etc/pm/config.d/config
set the variable
S2RAM_OPTS="-f -a 1 -m"
so they'll be used automatically upon invoking s2ram.
Permission configuration
At this point, you should be able to do suspend/resume reliably as root.
Alas, another nasty surprise may await: you may be forbidden to suspend
as an ordinary user. To see if this is likely to be an issue, click on the power icon to bring up
the kpowersave
menu. See if the Suspend-to-RAM selection is enabled.
If so, you're good to go. If Suspend-to-RAM is greyed out, you'll need
to change the PolicyKit
permissions.
On OpenSuSE 10.3, put
<match action="hal-power-*">
<match user="1000">
<return result="yes"/>
</match>
</match>
inside the <config>...</config>
block in /etc/PolicyKit/PolicyKit.conf.
Apparently the file formats
for PolicyKit configuration are in flux, so if you have a different
Linux distribution the format is likely to be different. However you do it,
you need to add your UID to the list of users allowed to access power
management functions.
Configuring suspension upon closing lid
If you run KDE, you can configure kpowersave
to suspend-to-RAM
upon closing the lid of your laptop. Click on the kpowersave
icon (which will be a battery or a power cord) and select
Configure KPowerSave.
Go to the General Settings
tab, then select Event Buttons.
For the lid-closing event,
select Suspend-to-RAM.
Close your lid, and see whether it works.
Try it a few times just to be sure.
You should now be done!
Back to Kevin Long's home page