LDP/LDP/howto/linuxdoc/Battery-Powered.sgml

869 lines
32 KiB
Plaintext

<!doctype linuxdoc system>
<article>
<title>
Battery Powered Linux Mini-HOWTO
<author>
Hanno Mueller,
<tt><htmlurl url="mailto:hanno@lava.de" name="hanno@lava.de"></tt>
<tt><htmlurl url="http://www.lava.de/~hanno/" name="http://www.lava.de/~hanno/"></tt>
<date>v, 21 December 1997
<abstract>
This document describes how to reduce a Linux system's power
consumption by tweaking some of its configuration settings. This
will be helpful for everyone who runs Linux on a portable
computer system. There is also some general information about
how to take care of your battery. If you are using Linux on a
desktop system, you probably don't need to read all this.
</abstract>
<!-- <toc> -->
<sect>Introduction<p>
``Ages 6 and up. Batteries included.''<p>
<sect1>Before you ask<p>
This document does not describe how to install Linux on
laptops, but how to optimize a ready-configured Linux for
use on laptops. Please read the <em/Installation-HOWTO/ or your
distributor's handbook for help with installing Linux.<p>
This document does not describe how to use an uninterruptable
power supply and the <tt/powerd/ daemon, either (even though
a ups is a big battery). Read the <em/UPS-HOWTO/ for details
about that subject.<p>
<sect1>What this document is about<p>
More and more people own portable computers these days and in
turn, more and more people install Linux on such machines.<p>
Installing and using Linux on a laptop is usually no problem at
all, so go ahead and give it a try. Unlike some other operating
systems, Linux still supports and runs well on even very old
hardware, so you might give your outdated portable a new
purpose in life by installing Linux on it.<p>
If you need help with installing Linux on a laptop or if you
have questions about laptop hardware, you can check the
excellent <em/Linux Laptop webpage/ at
<tt><htmlurl url="http://www.cs.utexas.edu/users/kharker/linux-laptop/"
name="http://www.cs.utexas.edu/users/kharker/linux-laptop/"></tt>
where you will find a lot of useful information and detailed
help. The Linux Laptop page describes hardware configuration
for specific laptop models and chipsets.<p>
This HOWTO however will focus on the one problem that is
common to all portable systems: <em/Power consumption/.<p>
Yet, I have not found a Linux distribution that comes with a
configuration <em/optimized/ for laptops. Since I could not find this
kind of information anywhere else, I have started to collect a
few simple but effective tricks that will help you save battery
power and in turn increase your system's uptime while running
on battery.<p>
(Sidenote. I received a complaint by a reader that these tips were
not very effective with his laptop. So does all this really
work? Yes, but don't expect miracles. I was able to increase my
laptop's battery time from 90 minutes to more than 120
minutes.)<p>
<sect1>Roadmap<p>
If you are a laptop pro, you can probably skip the
<ref id="GeneralInformation" name="General Information"> section. If
you are a Linux pro, what you really want to know can be found in the
<ref id="Changingsomegeneralsystemsettings" name="Changing some general system settings">
section. If you are a Linux distributor, please read
<ref id="AmessagetoLinuxdistributors" name="A message to Linux distributors">.<p>
<sect1>Feedback<p>
Your feedback is welcome. Please send comments to
<tt><htmlurl url="mailto:hanno@lava.de" name="hanno@lava.de"></tt>. Did
it work on your system? Do you have new tips? Are there any outdated links
or addresses in this text?<p>
I am sorry, but I will not be able to help you
with questions about specific laptop models. I don't claim
to be a laptop guru, I just happen to own one laptop myself
and I simply want to share the information I collected. Please
check the Linux Laptop webpage first, probably someone else has
already written a page dedicated to your model. Ask your
manufacturer's technical support. Or go the the laptop newsgroup
<tt><htmlurl url="news:comp.sys.laptops" name="comp.sys.laptops"></tt>
and ask there.<p>
<sect1>Disclaimer<p>
All methods described here were tested by me and worked fine
on my laptop, unless noted otherwise. However, I cannot
guarantee that any of this won't crash or seriously damage
your system. Life is dangerous, so keep backup copies of
your important files before playing with your Linux
configuration. If things go wrong, I do not take any
responsibility for your data loss. In other words: Don't
sue me. Thank you.<p>
<sect1>Copyright<p>
This document shall be distributed under the standard
HOWTO-copyright notice, found in the HOWTO folder at
<tt><htmlurl url="http://sunsite.unc.edu/mdw/linux.html"
name="http://sunsite.unc.edu/mdw/linux.html"></tt>.<p>
<sect>General information<label id="GeneralInformation"><p>
This section describes a few technical things about laptop
batteries and some general power saving tips. This information
is not Linux-specific and if you are experienced with
laptops, you might already know all this.<p>
<sect1>Be kind to your battery<p>
(Please note the <ref id="credits" name="credits"> for this
section.)<p>
There are currently three types of batteries commonly used
for portable computers.<p>
<itemize>
<item>
<em/NiCd/ batteries were the standard technology for years, but
today they are out of date and new laptops don't use them
anymore. They are heavy and very prone to the
``memory effect''. When recharging a NiCd battery that has not
been fully discharged, it ``remembers'' the old charge and
continues there the next time you use it.<p>
The memory effect is caused by crystallization of the
battery's substances and can permanently reduce your battery's
lifetime, even make it useless. To avoid it, you should
completely discharge the battery and then fully recharge it again
at least once every few weeks.<p>
(A sidenote about the memory effect. James Youngman knows of a rather
drastic method to - uhm - ``repair'' batteries: ``If your NiCd
battery is suffering from the memory effect, remove it from your
computer, hold it about 30cm above a desk or the floor, and drop
it (make sure it lands flat).'' He says that this will break the
whiskers that have formed in the battery and that are the cause of
the memory effect if your battery is already affected
by it. ``I don't know if this works for non-NiCd batteries or not.'')
Cadmium is a very hazardous poison, but if returned
to your dealer, the material can almost be fully recycled.<p>
Just in case you might be interested, here are some specs for NiCd:
<tscreen><verb>
Cell voltage: 1,2 V
Energy / mass: 40 Wh/kg
Energy / volume: 100 Wh/l
max. Energy: 20 Wh
Charge temp.: 10 to 35 C (50 to 95 F)
Discharge temp.: -20 to 50 C (-5 to 120 F)
Storage temp.: 0 to 45 C (30 to 115 F)
</verb></tscreen><p>
<item>
<em/NiMh/ batteries are the current standard used in most low
price laptops to date. They can be made smaller and are less
affected by the memory effect than NiCd.<p>
However, they have problems at very high or low room
temperatures. And even though they use less hazardous
and non-poisonous substances, they cannot be fully
recycled yet (but this will probably change in the future).<p>
NiMh specs:
<tscreen><verb>
Cell voltage: 1,2 V
Energy / mass: 55 Wh/kg
Energy / volume: 160 Wh/l
max. Energy: 35 Wh
Charge temp.: 10 to 35 C (50 to 95 F)
Discharge temp.: 0 to 45 C (30 to 115 F)
Storage temp.: 0 to 30 C (30 to 85 F)
</verb></tscreen><p>
<item>
The new high performance batteries use <em/LiIon/
technology. In theory, there is no memory effect at all
with these batteries, but on occasion, they seem to have similar
problems. Their substances are non-hazardous to the
enviroment, but they should be returned for recycling as well.<p>
LiIon specs:
<tscreen><verb>
Cell voltage: 3,6 V
Energy / mass: 100 Wh/kg
Energy / volume: 230 Wh/l
max. Energy: 60 Wh
Charge temp.: 0 to 45 C (30 to 115 F)
Discharge temp.: -20 to 60 C (-5 to 140 F)
Storage temp.: -20 to 60 C (-5 to 140 F)
</verb></tscreen><p>
</itemize>
Even if the battery case looks the same, you cannot just
upgrade to another battery technology. The recharging
process is different for the kind of battery you use.<p>
Some
manufacturers integrate the recharging circuit inside the
laptop's external ac adapter, so you might just get away
with buying a new power supply to upgrade. A good
indication for an external recharging unit is when your ac
adapter uses a proprietary connector with a lot of power
lines.<p>
Other manufacturers
put the recharging unit inside the laptop case where users
cannot simply replace it with a newer technology. If
your ac adapter only uses two power lines to connect to
the computer (just like mine), the recharging unit is
probably inside the laptop.<p>
When in doubt, ask your manufacturer
if your laptop supports a more modern battery.<p>
A battery that is not used for a long time will
slowly discharge itself. And even with greatest care, a
battery needs to be replaced after 500 to 1000
recharges. But still it is not recommended to run a laptop
without the battery while on ac power - the battery often
serves as a big capacitor to protect against voltage peaks
from your ac outlet.<p>
As the manufacturers change the shapes of their batteries
every few months, you might have problems to find a new
battery for your laptop in a few years from now. Buy a
spare battery now - before it's out of stock.<p>
<sect1>Power saving - The obvious stuff<p>
There are some obvious things that you can do to reduce your system's
power consumption. Well, maybe not so obvious, since not very many
people follow these rules...<p>
<itemize>
<item>
Decrease or turn off your display's backlight when you
don't need it. By the way, tft displays use more power than
dstn (so now you have a fine excuse why you bought the cheaper
laptop...).<p>
(David Bateman tells me that using a crt screen while on battery and
turning off the laptop display will extend battery time by about 30%:
``Not that this is a very useful piece of knowledge though, if you've
got the crt plugged in then why not the laptop too.'')
<item>
How much processing power do you really need? I doubt that
you will be doing very much more than text editing when on
the road (well, at least I don't compile linux kernels then). While
on battery, reducing the cpu clock speed will decrease power
consumption, too. Quite a few laptops offer a cpu clock
selector that will toggle between normal and slow speed.<p>
<item>
Turn off the cpu cooler (if you have one). Many recent laptops
offer a bios option called ``cooling control''. If your
system's cpu is becoming too hot, this option allows you to
have it cooled by a tiny fan (setting ``performance'') or
to have its cpu clock slowed down (setting ``silence''). To
increase your uptime while on battery, use ``silence''.<p>
<item>
Avoid using external devices (printer, crt screen, zip drive, portable
camera etc.) with your computer while on battery. When
connected to a standard ink jet printer, my laptop's
battery time is reduced from up to 120 minutes down to
20 minutes.<p>
<item>
Avoid using any built in device unless necessairy: Diskette
drive, harddisk, cd-rom. Especially cd-rom access will
dramatically decrease your battery time.<p>
<item>
Pcmcia cards can also consume a lot of power, so don't
leave your modem or network adapter plugged in when it
is not in use. But this is different between the various
pcmcia manufacturers, so check the product specs before you buy
(e. g. some cards never turn themselves off even when
not in use).<p>
(By the way, I recently read that pcmcia cards are the
biggest problem for windows ce palmtops - they drain so
much power that the tiny machines' little batteries have
to be replaced within minutes...)<p>
<item>
Use simple software. A full blown multimedia application
will create a lot more system load and harddisk / cd-rom
activity than a small simple word processor.<p>
<item>
Grant Taylor has a tip for those of us who want to upgrade
their system: ``Newer versions of some upgradable components
consume less power. For example, IBM's Travelstar 2.5 inch 1.6
gigabyte ide harddisk drive consumes 20 percent less than the
500 megabyte toshiba harddisk my laptop came with.''<p>
<item>
If you are yet about to buy a laptop - don't buy a laptop
with a 2nd level cache if battery uptime is important. A
computer with 2nd level cache is about 10% to 20% faster
and it will be a lot better with multimedia
applications and number crunching, but it consumes a lot of
power. Bjoern Kriews tells me that he has two almost
identical laptops and the one without cache ram runs
4h30 compared to 2h30 with cache.<p>
If you already have 2nd level cache installed, turning
it off will probably not help you very much.
Give it a try and write me about your experience.<p>
<item>
Another tip for those still buying a laptop - don't buy the
latest, fastest cpu type. Usually, the older generations are
optimized by the manufacturer after some time without
notice. The ``new'' versions of old cpu types often create
less heat and consume less power than the product's
premiere version.<p>
There are also frankenstein laptops
available that use cpus not optimized for portable systems. As
I wrote this in May 97, the newest generation pentium-200
laptops ran about 20 minutes on battery and became so hot that
they burnt your lap. When writing the second revision
in Oct 97, pentium-233 laptops run two hours
or longer without ac power. Go figure.<p>
</itemize>
Well, you get the idea. Most of these are restrictions
that will probably stop you from doing any serious work
with your Linux system. (The best way to save power
while on battery is... not to do anything at all. That
increases my laptop's battery uptime by almost 100 percent.)<p>
So let's go ahead to some other, more useful measures that will
save power without disturbing your work.<p>
<sect>Advanced Power Management<p>
Portable systems in general, but even many desktop computers
come equipped with support for
apm, the ``advanced power management'' scheme. This section
describes how to activate apm support in your Linux
kernel. People who are experienced with Linux may find this
section rather boring and want to skip to the next.<p>
<sect1>What APM can do for you<p>
I won't describe it in detail here, check the
<em/Linux APM drivers page/ at
<tt><htmlurl
url="http://www.cs.utexas.edu/users/kharker/linux-laptop/apm.html"
name="http://www.cs.utexas.edu/users/kharker/linux-laptop/apm.html"></tt>
for more
information. All that you need to know is that with the
help of apm, the cpu can tell the bios when there's nothing
really exciting going on so that the bios can take care of
some power saving by itself - e. g. reducing the cpu clock, turning
off the harddisk, turning off the display's backlight etc.<p>
Apm is also responsible for the ``system suspend''
(or ``sleep'') mode and for the ``suspend to disk''
(or ``hiberntation'') mode. And yet
another cool, though not very important feature is
that with the help of apm, <tt/shutdown -h/ will not just
halt your system, but also turn it off.<p>
(By the way, most Linux systems put a <tt/shutdown -r/ in
their <tt>/etc/inittab</tt> and map it to pressing
control-alt-delete. I prefer having <tt/shutdown -h/
there, so when pressing the famous key combination, my laptop
simply turns itself off.)<p>
Not all manufacturers implement a correct apm bios, so some
laptops have trouble with the Linux apm drivers (if your
machine has trouble with apm, it will most likely either lock
up at Linux' boot up or after returning from suspend). If you are
not sure, check the Linux laptop page for your specific
model.<p>
<sect1>How to activate APM support in Linux<p>
It's easy - just recompile the Linux kernel. Check the
Kernel-HOWTO if you don't know how to do that.<p>
When the configuration script reaches the ``character
devices'' section, the default setting for full apm
bios support in kernel version 2.0.30 or higher is:<p>
<tscreen><verb>
Advanced Power Management BIOS support: Yes
Ignore USER SUSPEND: No
Enable PM at boot time: Yes
Make CPU Idle calls when idle: Yes
Enable console blanking using APM: Yes
Power off on shutdown: Yes
</verb></tscreen><p>
Please read the configuration script's help texts. They explain
in detail what each option does, so I won't repeat them here.<p>
If your system does not fully support the apm bios standard, some
of those options might crash your system. Test all apm features
with the new kernel to make sure that everything works as it
should.<p>
(A <label id="sidenoteaboutconsoleblanking">sidenote
about console blanking: David Bateman tells me that
you should not enable it because it can cause problems with the
current version of XFree 3.2: ``The symptoms are that the screen
will be blank when X starts, and it can be fixed usually by just
hitting a key. It's a small but annoying problem. The next relase
of XFree, will have pretty good DPMS support for a lot of laptop
chipset, which should include code to turn off the LCD. Check out
the manpage for <tt/xset/ in XFree 3.2A.'' David also notes that
the lifetime of your display's backlight is determined by the number
of times it's switched on and off: ``So its a compromise, lifetime
of the battery versus lifetime of the backlight.'')<p>
(<em/Update:/ With XFree 3.3, this problem still remained on my
laptop. I am told that this will be fixed in a future kernel
version.)<p>
<sect1>APM support and the PCMCIA drivers<p>
After recompiling the kernel, don't forget to recompile
the linux pcmcia drivers as well.<p>
The precompiled pcmcia
drivers that come with most linux distribution have apm
support disabled, so that the bios can't instruct your card
adapters to turn off.<p>
Also, you must recompile the drivers
if you upgrade to a new kernel version and your old kernel
was compiled with module version information turned on (this
option is found in the ``loadable module support''
section of the kernel configuration).<p>
Read the PCMCIA-HOWTO for detailed
instructions on how to compile the drivers or go to the
<em/Linux PCMCIA drivers homepage/ at
<tt><htmlurl url="http://hyper.stanford.edu/HyperNews/get/pcmcia/home.html"
name="http://hyper.stanford.edu/HyperNews/get/pcmcia/home.html"></tt>.<p>
<sect1>The apmd package<p>
Now that you have APM support installed, go and get the <tt/apmd/ package
from the <em/Linux APM drivers page/. You don't really need it, but
it is a very useful collection of programs. The <tt/apmd/ daemon logs your
battery's behaviour and it will send out a warning if you are on
low power. The <tt/apm/ command will suspend your system with a
shell command and <tt/xapm/ shows the current state of your battery.<p>
(BTW, if you have problems with pcmcia cards after returning from
suspend, you
can check out an alternative <tt/apmd/ package at
<tt><htmlurl url="http://www.cut.de/bkr/linux/apmd/apmd.html"
name="http://www.cut.de/bkr/linux/apmd/apmd.html"></tt>. It unloads the
pcmcia driver module before going to suspend and reloads the module
on resume.)<p>
Grant Taylor has been playing a little with the <tt/apmd/
package and came up with helpful tips.<p>
He found that his laptop's harddisk forgets its <tt/hdparm -S/
standby period when returning from suspend: ``I modified <tt/apmd/ to
reset this setting on each resume. This may be system-specific;
but it's an important thing to do...''<p>
(Note: On my own laptop, the bios takes care of the harddisk standby
period and resets the value on resuming. So I could not test if this
little problem is system-specific. If it happens to you as
well, send me a message.)<p>
Grant also had a nice trick for screen blanking with
<ref id="TheXFree86package" name="the XFree86 package"> and
the help of the <tt/apmd/ package, you'll find it there.<p>
<sect1>And if my laptop does not support APM?<p>
If your computer's bios does not offer any power saving
settings (even the old ones without apm should at least allow
to set harddisk and display standby), you can
use <tt/hdparm -S/ to define your harddisk's standby period. This
will already help a lot, since harddisk activity
consumes a lot of power. Your system should have <tt/hdparm/
installed, so read <tt/man hdparm/ for the command syntax.<p>
<sect>Changing some general system settings<label id="Changingsomegeneralsystemsettings"><p>
After I got Linux up and running on my laptop, I found
it accessing the harddisk every few seconds, even when there was
no user logged in to the system. The harddisk could never
enter its power saving mode. Reducing harddisk activity
can greatly increase the battery runtime, so this is why I
collected the following recipes.<p>
I tested all this with RedHat 4.1, the locations of some
configuration settings may be different for your
distribution. (If so, please let me know.)<p>
<sect1>The crond daemon and atrun<p>
Check your <tt>/etc/crontab</tt> file if it starts a process
every minute. You will often find <tt/atrun/ there.<p>
With the <tt/at/ command, you can spool commands that must be
invoked some time in the future. Some Linux systems use a
dedicated <tt/atd/ daemon to take care of this, others
(e. g. RedHat) let the <tt/crond/ daemon run <tt/atrun/ once every
minute.<p>
This is not really necessairy on most systems, since <tt/at/
commands rarely depend upon being invoked on exact time. So
if you find a line like this in your <tt>/etc/crontab</tt>:
<tscreen><verb>
# Run any at jobs every minute
* * * * * root [ -x /usr/sbin/atrun ] && /usr/sbin/atrun
</verb></tscreen><p>
Then you can safely change this to:
<tscreen><verb>
# Run any at jobs every hour
00 * * * * root [ -x /usr/sbin/atrun ] && /usr/sbin/atrun
</verb></tscreen><p>
Read <tt/man 5 crontab/ for details. Some folks can even
work fine without the <tt/crond/ daemon, so if you know
what you are doing, you might want
to consider disabling it completely.<p>
<sect1>The update / bdflush daemon<p>
Linux deals with a lot of open file buffers at any given
moment, so the system must make sure that file changes are saved
to the harddisk as soon possible. Otherwise, those changes
will be lost after a system crash.<p>
The <tt/update/ / <tt/bdflush/ daemon takes care of this. (These
are two names for the same program, so you can use either
name to start the daemon). The default settings will make
this daemon call <tt/flush/ every 5 seconds and <tt/sync/ every
30 seconds.<p>
With my Fujitsu disk this caused non-stop access. (It
seems that this harddisk flushes its ram cache even when
nothing has changed. But this depends on your harddisk's
firmware: Other people told me that their harddisk does enter
its power saving mode even without the following modification.)<p>
Since Linux does not crash very often anymore, I have changed both
values to 3600 seconds (= one hour). This caused no problems at all
and the constant disk access has stopped. (But if my system crashes
now, there will be more broken files, of course.)<p>
RedHat 4.1: In <tt>/etc/inittab</tt>, change the update call to:
<tscreen><verb>
ud::once:/sbin/update -s 3600 -f 3600
</verb></tscreen><p>
Suse 4.4.1: <tt>update</tt> is called in <tt>/sbin/init.d/boot</tt>.<p>
Slackware: <tt>update</tt> is called in <tt>/etc/rc.d/rc.S</tt>.<p>
See <tt>man update</tt> for details.<p>
<sect1>The syslogd daemon<p>
The <tt/syslogd/ daemon is responsible for the various Linux
system log files that are found in the
<tt>/var/log/</tt> directory. By default <tt/syslogd/ will
sync the log file each time after logging a system message.<p>
You can turn that off by preceding the filename with a dash
in <tt>/etc/syslog.conf</tt>. Here's an example as found in
my system's <tt>syslog.conf</tt>:
<tscreen><verb>
# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none -/var/log/messages
</verb></tscreen><p>
This again means that if the system crashes, the message that
reported the problem may not have been stored to disk. Dilemma...<p>
<sect1>The init command<p>
During the bootup, the initial processes and daemons will be
started using the <tt/init/ command. This command (yet again)
calls <tt/sync/ before each process it creates.<p>
You can change this by removing the <tt/sync()/ call in the
source code and recompiling the command.<p>
To avoid problems with lost file buffers, you should add a
call to <tt/sync/ in your system's
<tt>/etc/rc.d/init.d/halt</tt> script, right before the script
unmounts the file systems.<p>
<sect1>The swap partition<p>
The Linux swap partition is used to increase the physical ram space
with virtual memory. This again is a possible reason for harddisk
access. If your laptop already has a lot of ram or if
the applications that you use are quite simple
(think of <tt/vi/), you might want to consider turning it off.<p>
This of course depends on what you plan to do. 4 to 8 megs are not
enough, you must use a swap partition then. With 8 to 16 megs,
text console applications will work fine and if you can avoid
using a lot of multitasking features, you can safely disable
swap. The X-Windows enviroment requires a lot of ram and you
should not use it without a swap partition unless you really
have a lot more than 16 megs.<p>
(Sidenote: My laptop with 16 megs and disabled swap partition can run
an <tt/emacs/ session, four <tt/bash/ shells and compile a
kernel without running out of memory. That's enough for me.)<p>
If you already have installed a swap partition, you can disable
it by preceding the <tt/swapon/
command that is called in <tt>/etc/rc.d/rc.sysinit</tt> with
a hash mark. If you don't want to make it a permanent move, let
the system ask during boot if you want to use the swap
partition. In <tt>/etc/rc.d/rc.sysinit</tt> (RedHat 4.1) or
<tt>/sbin/init.d/boot</tt> (Suse 4.4.1):
<tscreen><verb>
echo "Should the system use swap?"
echo " 0: No."
echo " 1: Yes."
/bin/echo "Your choice: \c"
read SWAPCHOICE
case "$SWAPCHOICE" in
0)
# Do nothing.
echo "(Swap partitions disabled)"
;;
*)
# Start up swapping.
echo "Activating swap partitions"
swapon -a
esac
</verb></tscreen><p>
Then you can use the swap partition while on ac power and drop
it while on battery.<p>
<sect1>The apache httpd webserver daemon<p>
I am using my laptop to develop and test cgi scipts for
websites, that is why I am running a local webserver on
it. The standard configuration is a bit too much if all you
want to do is just test a script or check a page from time
to time.<p>
In <tt>httpd.conf</tt>, just change the values of
<tt/MinSpareServers/ and <tt/StartServers/ to <tt/1/. This
will be enough for a local test site.<p>
If you wish to turn off the webserver's logging, you must
recompile the <tt/httpd/ daemon. Read the documentation for
details.<p>
Grant Taylor recompiled apache's logging and found
that this ``didn't make it stop churning the disk. So I used
another, IMHO better, solution: I configured apache to run
from inetd instead of standalone.'' Read <tt/man inetd/ for
details.<p>
<sect1>The XFree86 package<label id="TheXFree86package"><p>
Configuring XFree86 for laptops is a story of its own. And
yet again, I have
to refer you to the Linux Laptop page where you
will find a lot of help on this.<p>
X's console blanking only turns the screen black, but does
not turn it off. As mentioned in the
<ref id="sidenoteaboutconsoleblanking" name="sidenote about console blanking">,
you can use <tt/xset/'s dpms option to change this.
However, this feature depends on your laptop's
graphics chipset and bios.<p>
Grant Taylor uses the following setup to send his laptop to
sleep with the help of <tt/apmd/ and the screensaver:<p>
<tscreen><verb>
# Run xscreensaver with APM program
xscreensaver -timeout 5 \
-xrm xscreensaver.programs:apm_standby \
-xrm xscreensaver.colorPrograms:apm_standby &
</verb></tscreen><p>
Where ``<tt/apm_standby/ is a suid perl script that allows only
certain people to run <tt/apm -S/.''<p>
<sect1>The emacs editor<p>
Ok, <tt/emacs/ is not an editor, but a way of life. Here's
a tip from Florent Chabaud: ``If you use <tt/emacs/, perhaps
you have noticed that the editor makes some automatic saves.
This is of course useful and should <em/not/ be disabled, but
the default parameters can be adjusted to a laptop use.<p>
I have put in the file
<tt>/usr/share/emacs/site-lisp/site-start.el</tt>
the two following lines:<p>
<tscreen><verb>
(setq auto-save-interval 2500)
(setq auto-save-timeout nil)
</verb></tscreen><p>
This disables auto-saving based on time, and makes the
auto-saving be done every 2500 keyboard actions. Of course
if you are typing a text this last parameter should be reduced,
but for programming it is sufficient. Since every action
(up, down, left, backspace, paste, etc...) is counted, 2500
actions are reached very rapidly.''<p>
<sect1>How to find more ways to optimize<p>
If your Linux system still seems to access the harddisk too
often, you can find out what is going on inside by using
the <tt/ps ax/ command. This will show all running processes
and their full name, sometimes it also reveals the command
line arguments of each process.<p>
Now read the <tt/man/ page of each process to find out what
it does and how to change its behaviour. With this
method, you will most likely find the process that is
responsible. You may also find <tt>strace</tt> helpful.<p>
Please send me an email if you found something new.<p>
<sect>Appendix<p>
<sect1>A message to Linux distributors<label id="AmessagetoLinuxdistributors"><p>
If you happen to be a Linux distributor, thank you for reading
all this. Laptops are becoming more and more popular, but still
most Linux distributions are not very well prepared for portable
computing. Please make this document obsolete and change this for
your distribution.<p>
<itemize>
<item>
The installation routine should include a configuration, optimized
for laptops. The ``mimimal install'' is often not lean
enough. There are a lot of things that a laptop user does not
need on the road. Just a few examples. There is no need for
three different versions of
vi (as found in Suse Linux). Most portable systems do not need
printing support (they will never be connected to a
printer, printing is usually done with the desktop system at
home). Quite a few laptops do not need any network support at
all.<p>
<item>
Don't forget to describe laptop-specific installation
problems, e. g. how to install your distribution without
a cd-rom drive or how to setup the plip network driver.<p>
<item>
Add better power management and seamless pcmcia support to your
distribution. Add a precompiled kernel and an alternative set of
pcmcia drivers with apm support that the user can install on
demand. Include a precompiled <tt/apmd/ package with your
distribution.<p>
<item>
Add support for dynamically switching network configurations. Most
Linux laptops travel between locations with different
network settings (e. g. the network at home, the network at
the office and the network at the university) and have
to change the network id very often. Changing a Linux system's
network id is a pain with most distributions.<p>
</itemize>
Please mail me if your distribution is optimized for portable
computing and what kind of features you added for that. Future
versions of this HOWTO will include a section where you can
advertise your distribution's laptop features.<p>
<sect1>Credits<label id="credits"><p>
<itemize>
<item>
The information about battery technology is mostly based
on the article ``Stromkonserve''
by Michael Reiter, published in ``c't Magazin fuer
Computertechnik'' (Heise Verlag Hannover, Germany), edition
10/96, page 204. Used by permission. Visit their website at
<tt><htmlurl url="http://www.heise.de/" name="http://www.heise.de/"></tt>.<p>
<item>
The following people contributed to this document:<p>
<tscreen><verb>
Frithjof Anders <anders@goethe.ucdavis.edu>
David Bateman <dbateman@ee.uts.edu.au>
Florent Chabaud <chabaud@celar.fr>
Markus Gutschke <gutschk@uni-muenster.de>
Kenneth E. Harker <kharker@cs.utexas.edu>
Bjoern Kriews <bkr@rrz.uni-hamburg.de>
R. Manmatha <manmatha@bendigo.cs.umass.edu>
Juergen Rink <jr@ct.heise.de>
Grant Taylor <gtaylor@picante.com>
James Youngman <JYoungman@vggas.com>
</verb></tscreen>
</itemize>
<sect1>About this document<p>
This text mentions batteries 53 times.<p>
The current version of this and many other HOWTOs,
most of them a lot more useful than this one,
can be found at the main Linux documentation site
<tt><htmlurl url="http://sunsite.unc.edu/mdw/linux.html"
name="http://sunsite.unc.edu/mdw/linux.html"></tt> or at
one of its many mirror sites.<p>
Most of this text was written during my trips between Hamburg
and Hannover on German rail. (The new ice-2 coaches have
power outlets for laptops, yeah!).<p>
And now hum along with me: ``...on the road again...''<p>
</article>