home *** CD-ROM | disk | FTP | other *** search
/ Freelog Special Edition 1: Linux / CD1.iso / doc / HOWTO / mini / Battery-Powered < prev    next >
Text File  |  1998-10-14  |  32KB  |  1,057 lines

  1.   Battery Powered Linux Mini-HOWTO
  2.   Hanno Mueller, hanno@lava.de http://www.lava.de/~hanno/
  3.   v, 21 December 1997
  4.  
  5.   This document describes how to reduce a Linux system's power consump¡
  6.   tion by tweaking some of its configuration settings. This will be
  7.   helpful for everyone who runs Linux on a portable computer system.
  8.   There is also some general information about how to take care of your
  9.   battery. If you are using Linux on a desktop system, you probably
  10.   don't need to read all this.
  11.  
  12.   1.  Introduction
  13.  
  14.  
  15.   ``Ages 6 and up. Batteries included.''
  16.  
  17.  
  18.  
  19.   1.1.  Before you ask
  20.  
  21.  
  22.   This document does not describe how to install Linux on laptops, but
  23.   how to optimize a ready-configured Linux for use on laptops. Please
  24.   read the Installation-HOWTO or your distributor's handbook for help
  25.   with installing Linux.
  26.  
  27.  
  28.   This document does not describe how to use an uninterruptable power
  29.   supply and the powerd daemon, either (even though a ups is a big
  30.   battery). Read the UPS-HOWTO for details about that subject.
  31.  
  32.  
  33.  
  34.   1.2.  What this document is about
  35.  
  36.  
  37.   More and more people own portable computers these days and in turn,
  38.   more and more people install Linux on such machines.
  39.  
  40.  
  41.   Installing and using Linux on a laptop is usually no problem at all,
  42.   so go ahead and give it a try. Unlike some other operating systems,
  43.   Linux still supports and runs well on even very old hardware, so you
  44.   might give your outdated portable a new purpose in life by installing
  45.   Linux on it.
  46.  
  47.  
  48.   If you need help with installing Linux on a laptop or if you have
  49.   questions about laptop hardware, you can check the excellent Linux
  50.   Laptop webpage at http://www.cs.utexas.edu/users/kharker/linux-laptop/
  51.   where you will find a lot of useful information and detailed help. The
  52.   Linux Laptop page describes hardware configuration for specific laptop
  53.   models and chipsets.
  54.  
  55.  
  56.   This HOWTO however will focus on the one problem that is common to all
  57.   portable systems: Power consumption.
  58.  
  59.  
  60.   Yet, I have not found a Linux distribution that comes with a
  61.   configuration optimized for laptops. Since I could not find this kind
  62.   of information anywhere else, I have started to collect a few simple
  63.   but effective tricks that will help you save battery power and in turn
  64.   increase your system's uptime while running on battery.
  65.  
  66.  
  67.   (Sidenote. I received a complaint by a reader that these tips were not
  68.   very effective with his laptop. So does all this really work? Yes, but
  69.   don't expect miracles. I was able to increase my laptop's battery time
  70.   from 90 minutes to more than 120 minutes.)
  71.  
  72.  
  73.  
  74.   1.3.  Roadmap
  75.  
  76.  
  77.   If you are a laptop pro, you can probably skip the ``General
  78.   Information'' section. If you are a Linux pro, what you really want to
  79.   know can be found in the ``Changing some general system settings''
  80.   section. If you are a Linux distributor, please read ``A message to
  81.   Linux distributors''.
  82.  
  83.  
  84.  
  85.   1.4.  Feedback
  86.  
  87.  
  88.   Your feedback is welcome. Please send comments to hanno@lava.de. Did
  89.   it work on your system? Do you have new tips? Are there any outdated
  90.   links or addresses in this text?
  91.  
  92.  
  93.   I am sorry, but I will not be able to help you with questions about
  94.   specific laptop models. I don't claim to be a laptop guru, I just
  95.   happen to own one laptop myself and I simply want to share the
  96.   information I collected. Please check the Linux Laptop webpage first,
  97.   probably someone else has already written a page dedicated to your
  98.   model. Ask your manufacturer's technical support. Or go the the laptop
  99.   newsgroup comp.sys.laptops and ask there.
  100.  
  101.  
  102.  
  103.   1.5.  Disclaimer
  104.  
  105.  
  106.   All methods described here were tested by me and worked fine on my
  107.   laptop, unless noted otherwise. However, I cannot guarantee that any
  108.   of this won't crash or seriously damage your system. Life is
  109.   dangerous, so keep backup copies of your important files before
  110.   playing with your Linux configuration. If things go wrong, I do not
  111.   take any responsibility for your data loss. In other words: Don't sue
  112.   me. Thank you.
  113.  
  114.  
  115.  
  116.   1.6.  Copyright
  117.  
  118.  
  119.   This document shall be distributed under the standard HOWTO-copyright
  120.   notice, found in the HOWTO folder at
  121.   http://sunsite.unc.edu/mdw/linux.html.
  122.  
  123.  
  124.  
  125.   2.  General information
  126.  
  127.  
  128.   This section describes a few technical things about laptop batteries
  129.   and some general power saving tips. This information is not Linux-
  130.   specific and if you are experienced with laptops, you might already
  131.   know all this.
  132.  
  133.   2.1.  Be kind to your battery
  134.  
  135.  
  136.   (Please note the ``credits'' for this section.)
  137.  
  138.  
  139.   There are currently three types of batteries commonly used for
  140.   portable computers.
  141.  
  142.  
  143.  
  144.   ╖  NiCd batteries were the standard technology for years, but today
  145.      they are out of date and new laptops don't use them anymore. They
  146.      are heavy and very prone to the ``memory effect''. When recharging
  147.      a NiCd battery that has not been fully discharged, it ``remembers''
  148.      the old charge and continues there the next time you use it.
  149.  
  150.  
  151.      The memory effect is caused by crystallization of the battery's
  152.      substances and can permanently reduce your battery's lifetime, even
  153.      make it useless. To avoid it, you should completely discharge the
  154.      battery and then fully recharge it again at least once every few
  155.      weeks.
  156.  
  157.  
  158.      (A sidenote about the memory effect. James Youngman knows of a
  159.      rather drastic method to - uhm - ``repair'' batteries: ``If your
  160.      NiCd battery is suffering from the memory effect, remove it from
  161.      your computer, hold it about 30cm above a desk or the floor, and
  162.      drop it (make sure it lands flat).'' He says that this will break
  163.      the whiskers that have formed in the battery and that are the cause
  164.      of the memory effect if your battery is already affected by it. ``I
  165.      don't know if this works for non-NiCd batteries or not.'')
  166.  
  167.      Cadmium is a very hazardous poison, but if returned to your dealer,
  168.      the material can almost be fully recycled.
  169.  
  170.  
  171.      Just in case you might be interested, here are some specs for NiCd:
  172.  
  173.  
  174.  
  175.        Cell voltage: 1,2 V
  176.        Energy / mass: 40 Wh/kg
  177.        Energy / volume: 100 Wh/l
  178.        max. Energy: 20 Wh
  179.        Charge temp.: 10 to 35 C (50 to 95 F)
  180.        Discharge temp.: -20 to 50 C (-5 to 120 F)
  181.        Storage temp.: 0 to 45 C (30 to 115 F)
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.   ╖  NiMh batteries are the current standard used in most low price
  189.      laptops to date. They can be made smaller and are less affected by
  190.      the memory effect than NiCd.
  191.  
  192.  
  193.      However, they have problems at very high or low room temperatures.
  194.      And even though they use less hazardous and non-poisonous
  195.      substances, they cannot be fully recycled yet (but this will
  196.      probably change in the future).
  197.  
  198.  
  199.      NiMh specs:
  200.  
  201.  
  202.  
  203.        Cell voltage: 1,2 V
  204.        Energy / mass: 55 Wh/kg
  205.        Energy / volume: 160 Wh/l
  206.        max. Energy: 35 Wh
  207.        Charge temp.: 10 to 35 C (50 to 95 F)
  208.        Discharge temp.: 0 to 45 C (30 to 115 F)
  209.        Storage temp.: 0 to 30 C (30 to 85 F)
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.   ╖  The new high performance batteries use LiIon technology. In theory,
  217.      there is no memory effect at all with these batteries, but on
  218.      occasion, they seem to have similar problems. Their substances are
  219.      non-hazardous to the enviroment, but they should be returned for
  220.      recycling as well.
  221.  
  222.  
  223.      LiIon specs:
  224.  
  225.  
  226.  
  227.        Cell voltage: 3,6 V
  228.        Energy / mass: 100 Wh/kg
  229.        Energy / volume: 230 Wh/l
  230.        max. Energy: 60 Wh
  231.        Charge temp.: 0 to 45 C (30 to 115 F)
  232.        Discharge temp.: -20 to 60 C (-5 to 140 F)
  233.        Storage temp.: -20 to 60 C (-5 to 140 F)
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.   Even if the battery case looks the same, you cannot just upgrade to
  241.   another battery technology. The recharging process is different for
  242.   the kind of battery you use.
  243.  
  244.  
  245.   Some manufacturers integrate the recharging circuit inside the
  246.   laptop's external ac adapter, so you might just get away with buying a
  247.   new power supply to upgrade. A good indication for an external
  248.   recharging unit is when your ac adapter uses a proprietary connector
  249.   with a lot of power lines.
  250.  
  251.  
  252.   Other manufacturers put the recharging unit inside the laptop case
  253.   where users cannot simply replace it with a newer technology. If your
  254.   ac adapter only uses two power lines to connect to the computer (just
  255.   like mine), the recharging unit is probably inside the laptop.
  256.  
  257.  
  258.   When in doubt, ask your manufacturer if your laptop supports a more
  259.   modern battery.
  260.  
  261.  
  262.   A battery that is not used for a long time will slowly discharge
  263.   itself. And even with greatest care, a battery needs to be replaced
  264.   after 500 to 1000 recharges. But still it is not recommended to run a
  265.   laptop without the battery while on ac power - the battery often
  266.   serves as a big capacitor to protect against voltage peaks from your
  267.   ac outlet.
  268.  
  269.  
  270.   As the manufacturers change the shapes of their batteries every few
  271.   months, you might have problems to find a new battery for your laptop
  272.   in a few years from now. Buy a spare battery now - before it's out of
  273.   stock.
  274.  
  275.  
  276.  
  277.   2.2.  Power saving - The obvious stuff
  278.  
  279.  
  280.   There are some obvious things that you can do to reduce your system's
  281.   power consumption. Well, maybe not so obvious, since not very many
  282.   people follow these rules...
  283.  
  284.  
  285.  
  286.   ╖  Decrease or turn off your display's backlight when you don't need
  287.      it. By the way, tft displays use more power than dstn (so now you
  288.      have a fine excuse why you bought the cheaper laptop...).
  289.  
  290.  
  291.      (David Bateman tells me that using a crt screen while on battery
  292.      and turning off the laptop display will extend battery time by
  293.      about 30%: ``Not that this is a very useful piece of knowledge
  294.      though, if you've got the crt plugged in then why not the laptop
  295.      too.'')
  296.  
  297.  
  298.   ╖  How much processing power do you really need? I doubt that you will
  299.      be doing very much more than text editing when on the road (well,
  300.      at least I don't compile linux kernels then). While on battery,
  301.      reducing the cpu clock speed will decrease power consumption, too.
  302.      Quite a few laptops offer a cpu clock selector that will toggle
  303.      between normal and slow speed.
  304.  
  305.  
  306.  
  307.   ╖  Turn off the cpu cooler (if you have one). Many recent laptops
  308.      offer a bios option called ``cooling control''. If your system's
  309.      cpu is becoming too hot, this option allows you to have it cooled
  310.      by a tiny fan (setting ``performance'') or to have its cpu clock
  311.      slowed down (setting ``silence''). To increase your uptime while on
  312.      battery, use ``silence''.
  313.  
  314.  
  315.  
  316.   ╖  Avoid using external devices (printer, crt screen, zip drive,
  317.      portable camera etc.) with your computer while on battery. When
  318.      connected to a standard ink jet printer, my laptop's battery time
  319.      is reduced from up to 120 minutes down to 20 minutes.
  320.  
  321.  
  322.  
  323.   ╖  Avoid using any built in device unless necessairy: Diskette drive,
  324.      harddisk, cd-rom. Especially cd-rom access will dramatically
  325.      decrease your battery time.
  326.  
  327.  
  328.  
  329.   ╖  Pcmcia cards can also consume a lot of power, so don't leave your
  330.      modem or network adapter plugged in when it is not in use. But this
  331.      is different between the various pcmcia manufacturers, so check the
  332.      product specs before you buy (e. g. some cards never turn
  333.      themselves off even when not in use).
  334.  
  335.  
  336.      (By the way, I recently read that pcmcia cards are the biggest
  337.      problem for windows ce palmtops - they drain so much power that the
  338.      tiny machines' little batteries have to be replaced within
  339.      minutes...)
  340.  
  341.  
  342.  
  343.   ╖  Use simple software. A full blown multimedia application will
  344.      create a lot more system load and harddisk / cd-rom activity than a
  345.      small simple word processor.
  346.  
  347.  
  348.  
  349.   ╖  Grant Taylor has a tip for those of us who want to upgrade their
  350.      system: ``Newer versions of some upgradable components consume less
  351.      power. For example, IBM's Travelstar 2.5 inch 1.6 gigabyte ide
  352.      harddisk drive consumes 20 percent less than the 500 megabyte
  353.      toshiba harddisk my laptop came with.''
  354.  
  355.  
  356.  
  357.   ╖  If you are yet about to buy a laptop - don't buy a laptop with a
  358.      2nd level cache if battery uptime is important. A computer with 2nd
  359.      level cache is about 10% to 20% faster and it will be a lot better
  360.      with multimedia applications and number crunching, but it consumes
  361.      a lot of power. Bjoern Kriews tells me that he has two almost
  362.      identical laptops and the one without cache ram runs 4h30 compared
  363.      to 2h30 with cache.
  364.  
  365.  
  366.      If you already have 2nd level cache installed, turning it off will
  367.      probably not help you very much.  Give it a try and write me about
  368.      your experience.
  369.  
  370.  
  371.  
  372.   ╖  Another tip for those still buying a laptop - don't buy the latest,
  373.      fastest cpu type. Usually, the older generations are optimized by
  374.      the manufacturer after some time without notice. The ``new''
  375.      versions of old cpu types often create less heat and consume less
  376.      power than the product's premiere version.
  377.  
  378.  
  379.      There are also frankenstein laptops available that use cpus not
  380.      optimized for portable systems. As I wrote this in May 97, the
  381.      newest generation pentium-200 laptops ran about 20 minutes on
  382.      battery and became so hot that they burnt your lap. When writing
  383.      the second revision in Oct 97, pentium-233 laptops run two hours or
  384.      longer without ac power. Go figure.
  385.  
  386.  
  387.  
  388.   Well, you get the idea. Most of these are restrictions that will
  389.   probably stop you from doing any serious work with your Linux system.
  390.   (The best way to save power while on battery is... not to do anything
  391.   at all. That increases my laptop's battery uptime by almost 100
  392.   percent.)
  393.  
  394.  
  395.   So let's go ahead to some other, more useful measures that will save
  396.   power without disturbing your work.
  397.   3.  Advanced Power Management
  398.  
  399.  
  400.   Portable systems in general, but even many desktop computers come
  401.   equipped with support for apm, the ``advanced power management''
  402.   scheme. This section describes how to activate apm support in your
  403.   Linux kernel. People who are experienced with Linux may find this
  404.   section rather boring and want to skip to the next.
  405.  
  406.  
  407.  
  408.   3.1.  What APM can do for you
  409.  
  410.  
  411.   I won't describe it in detail here, check the Linux APM drivers page
  412.   at http://www.cs.utexas.edu/users/kharker/linux-laptop/apm.html for
  413.   more information. All that you need to know is that with the help of
  414.   apm, the cpu can tell the bios when there's nothing really exciting
  415.   going on so that the bios can take care of some power saving by itself
  416.   - e. g. reducing the cpu clock, turning off the harddisk, turning off
  417.   the display's backlight etc.
  418.  
  419.  
  420.   Apm is also responsible for the ``system suspend'' (or ``sleep'') mode
  421.   and for the ``suspend to disk'' (or ``hiberntation'') mode. And yet
  422.   another cool, though not very important feature is that with the help
  423.   of apm, shutdown -h will not just halt your system, but also turn it
  424.   off.
  425.  
  426.  
  427.   (By the way, most Linux systems put a shutdown -r in their
  428.   /etc/inittab and map it to pressing control-alt-delete. I prefer
  429.   having shutdown -h there, so when pressing the famous key combination,
  430.   my laptop simply turns itself off.)
  431.  
  432.  
  433.   Not all manufacturers implement a correct apm bios, so some laptops
  434.   have trouble with the Linux apm drivers (if your machine has trouble
  435.   with apm, it will most likely either lock up at Linux' boot up or
  436.   after returning from suspend). If you are not sure, check the Linux
  437.   laptop page for your specific model.
  438.  
  439.  
  440.  
  441.   3.2.  How to activate APM support in Linux
  442.  
  443.  
  444.   It's easy - just recompile the Linux kernel. Check the Kernel-HOWTO if
  445.   you don't know how to do that.
  446.  
  447.  
  448.   When the configuration script reaches the ``character devices''
  449.   section, the default setting for full apm bios support in kernel
  450.   version 2.0.30 or higher is:
  451.  
  452.  
  453.  
  454.  
  455.        Advanced Power Management BIOS support: Yes
  456.        Ignore USER SUSPEND: No
  457.        Enable PM at boot time: Yes
  458.        Make CPU Idle calls when idle: Yes
  459.        Enable console blanking using APM: Yes
  460.        Power off on shutdown: Yes
  461.  
  462.  
  463.   Please read the configuration script's help texts. They explain in
  464.   detail what each option does, so I won't repeat them here.
  465.  
  466.  
  467.   If your system does not fully support the apm bios standard, some of
  468.   those options might crash your system. Test all apm features with the
  469.   new kernel to make sure that everything works as it should.
  470.  
  471.  
  472.   (A sidenote about console blanking: David Bateman tells me that you
  473.   should not enable it because it can cause problems with the current
  474.   version of XFree 3.2: ``The symptoms are that the screen will be blank
  475.   when X starts, and it can be fixed usually by just hitting a key. It's
  476.   a small but annoying problem. The next relase of XFree, will have
  477.   pretty good DPMS support for a lot of laptop chipset, which should
  478.   include code to turn off the LCD. Check out the manpage for xset in
  479.   XFree 3.2A.'' David also notes that the lifetime of your display's
  480.   backlight is determined by the number of times it's switched on and
  481.   off: ``So its a compromise, lifetime of the battery versus lifetime of
  482.   the backlight.'')
  483.  
  484.  
  485.   (Update: With XFree 3.3, this problem still remained on my laptop. I
  486.   am told that this will be fixed in a future kernel version.)
  487.  
  488.  
  489.  
  490.   3.3.  APM support and the PCMCIA drivers
  491.  
  492.  
  493.   After recompiling the kernel, don't forget to recompile the linux
  494.   pcmcia drivers as well.
  495.  
  496.  
  497.   The precompiled pcmcia drivers that come with most linux distribution
  498.   have apm support disabled, so that the bios can't instruct your card
  499.   adapters to turn off.
  500.  
  501.  
  502.   Also, you must recompile the drivers if you upgrade to a new kernel
  503.   version and your old kernel was compiled with module version
  504.   information turned on (this option is found in the ``loadable module
  505.   support'' section of the kernel configuration).
  506.  
  507.  
  508.   Read the PCMCIA-HOWTO for detailed instructions on how to compile the
  509.   drivers or go to the Linux PCMCIA drivers homepage at
  510.   http://hyper.stanford.edu/HyperNews/get/pcmcia/home.html.
  511.  
  512.  
  513.  
  514.   3.4.  The apmd package
  515.  
  516.  
  517.   Now that you have APM support installed, go and get the apmd package
  518.   from the Linux APM drivers page. You don't really need it, but it is a
  519.   very useful collection of programs. The apmd daemon logs your
  520.   battery's behaviour and it will send out a warning if you are on low
  521.   power. The apm command will suspend your system with a shell command
  522.   and xapm shows the current state of your battery.
  523.  
  524.  
  525.   (BTW, if you have problems with pcmcia cards after returning from
  526.   suspend, you can check out an alternative apmd package at
  527.   http://www.cut.de/bkr/linux/apmd/apmd.html. It unloads the pcmcia
  528.   driver module before going to suspend and reloads the module on
  529.   resume.)
  530.  
  531.  
  532.   Grant Taylor has been playing a little with the apmd package and came
  533.   up with helpful tips.
  534.  
  535.  
  536.   He found that his laptop's harddisk forgets its hdparm -S standby
  537.   period when returning from suspend: ``I modified apmd to reset this
  538.   setting on each resume. This may be system-specific; but it's an
  539.   important thing to do...''
  540.  
  541.  
  542.   (Note: On my own laptop, the bios takes care of the harddisk standby
  543.   period and resets the value on resuming. So I could not test if this
  544.   little problem is system-specific. If it happens to you as well, send
  545.   me a message.)
  546.  
  547.  
  548.   Grant also had a nice trick for screen blanking with ``the XFree86
  549.   package'' and the help of the apmd package, you'll find it there.
  550.  
  551.  
  552.  
  553.   3.5.  And if my laptop does not support APM?
  554.  
  555.  
  556.   If your computer's bios does not offer any power saving settings (even
  557.   the old ones without apm should at least allow to set harddisk and
  558.   display standby), you can use hdparm -S to define your harddisk's
  559.   standby period. This will already help a lot, since harddisk activity
  560.   consumes a lot of power. Your system should have hdparm installed, so
  561.   read man hdparm for the command syntax.
  562.  
  563.  
  564.  
  565.   4.  Changing some general system settings
  566.  
  567.  
  568.   After I got Linux up and running on my laptop, I found it accessing
  569.   the harddisk every few seconds, even when there was no user logged in
  570.   to the system. The harddisk could never enter its power saving mode.
  571.   Reducing harddisk activity can greatly increase the battery runtime,
  572.   so this is why I collected the following recipes.
  573.  
  574.  
  575.   I tested all this with RedHat 4.1, the locations of some configuration
  576.   settings may be different for your distribution. (If so, please let me
  577.   know.)
  578.  
  579.  
  580.  
  581.   4.1.  The crond daemon and atrun
  582.  
  583.  
  584.   Check your /etc/crontab file if it starts a process every minute. You
  585.   will often find atrun there.
  586.  
  587.  
  588.   With the at command, you can spool commands that must be invoked some
  589.   time in the future. Some Linux systems use a dedicated atd daemon to
  590.   take care of this, others (e. g. RedHat) let the crond daemon run
  591.   atrun once every minute.
  592.  
  593.  
  594.  
  595.   This is not really necessairy on most systems, since at commands
  596.   rarely depend upon being invoked on exact time. So if you find a line
  597.   like this in your /etc/crontab:
  598.  
  599.  
  600.  
  601.        # Run any at jobs every minute
  602.        * * * * * root [ -x /usr/sbin/atrun ] && /usr/sbin/atrun
  603.  
  604.  
  605.  
  606.  
  607.  
  608.   Then you can safely change this to:
  609.  
  610.  
  611.  
  612.        # Run any at jobs every hour
  613.        00 * * * * root [ -x /usr/sbin/atrun ] && /usr/sbin/atrun
  614.  
  615.  
  616.  
  617.  
  618.  
  619.   Read man 5 crontab for details. Some folks can even work fine without
  620.   the crond daemon, so if you know what you are doing, you might want to
  621.   consider disabling it completely.
  622.  
  623.  
  624.  
  625.   4.2.  The update / bdflush daemon
  626.  
  627.  
  628.   Linux deals with a lot of open file buffers at any given moment, so
  629.   the system must make sure that file changes are saved to the harddisk
  630.   as soon possible. Otherwise, those changes will be lost after a system
  631.   crash.
  632.  
  633.  
  634.   The update / bdflush daemon takes care of this. (These are two names
  635.   for the same program, so you can use either name to start the daemon).
  636.   The default settings will make this daemon call flush every 5 seconds
  637.   and sync every 30 seconds.
  638.  
  639.  
  640.   With my Fujitsu disk this caused non-stop access. (It seems that this
  641.   harddisk flushes its ram cache even when nothing has changed. But this
  642.   depends on your harddisk's firmware: Other people told me that their
  643.   harddisk does enter its power saving mode even without the following
  644.   modification.)
  645.  
  646.  
  647.   Since Linux does not crash very often anymore, I have changed both
  648.   values to 3600 seconds (= one hour). This caused no problems at all
  649.   and the constant disk access has stopped. (But if my system crashes
  650.   now, there will be more broken files, of course.)
  651.  
  652.  
  653.   RedHat 4.1: In /etc/inittab, change the update call to:
  654.  
  655.  
  656.  
  657.        ud::once:/sbin/update -s 3600 -f 3600
  658.  
  659.  
  660.  
  661.   Suse 4.4.1: update is called in /sbin/init.d/boot.
  662.  
  663.  
  664.   Slackware: update is called in /etc/rc.d/rc.S.
  665.  
  666.  
  667.   See man update for details.
  668.  
  669.  
  670.  
  671.   4.3.  The syslogd daemon
  672.  
  673.  
  674.   The syslogd daemon is responsible for the various Linux system log
  675.   files that are found in the /var/log/ directory. By default syslogd
  676.   will sync the log file each time after logging a system message.
  677.  
  678.  
  679.   You can turn that off by preceding the filename with a dash in
  680.   /etc/syslog.conf. Here's an example as found in my system's
  681.   syslog.conf:
  682.  
  683.  
  684.  
  685.        # Log anything (except mail) of level info or higher.
  686.        # Don't log private authentication messages!
  687.        *.info;mail.none;authpriv.none                  -/var/log/messages
  688.  
  689.  
  690.  
  691.  
  692.  
  693.   This again means that if the system crashes, the message that reported
  694.   the problem may not have been stored to disk. Dilemma...
  695.  
  696.  
  697.  
  698.   4.4.  The init command
  699.  
  700.  
  701.   During the bootup, the initial processes and daemons will be started
  702.   using the init command. This command (yet again) calls sync before
  703.   each process it creates.
  704.  
  705.  
  706.   You can change this by removing the sync() call in the source code and
  707.   recompiling the command.
  708.  
  709.  
  710.   To avoid problems with lost file buffers, you should add a call to
  711.   sync in your system's /etc/rc.d/init.d/halt script, right before the
  712.   script unmounts the file systems.
  713.  
  714.  
  715.  
  716.   4.5.  The swap partition
  717.  
  718.  
  719.   The Linux swap partition is used to increase the physical ram space
  720.   with virtual memory. This again is a possible reason for harddisk
  721.   access. If your laptop already has a lot of ram or if the applications
  722.   that you use are quite simple (think of vi), you might want to
  723.   consider turning it off.
  724.  
  725.  
  726.  
  727.   This of course depends on what you plan to do. 4 to 8 megs are not
  728.   enough, you must use a swap partition then. With 8 to 16 megs, text
  729.   console applications will work fine and if you can avoid using a lot
  730.   of multitasking features, you can safely disable swap. The X-Windows
  731.   enviroment requires a lot of ram and you should not use it without a
  732.   swap partition unless you really have a lot more than 16 megs.
  733.  
  734.  
  735.   (Sidenote: My laptop with 16 megs and disabled swap partition can run
  736.   an emacs session, four bash shells and compile a kernel without
  737.   running out of memory. That's enough for me.)
  738.  
  739.  
  740.   If you already have installed a swap partition, you can disable it by
  741.   preceding the swapon command that is called in /etc/rc.d/rc.sysinit
  742.   with a hash mark. If you don't want to make it a permanent move, let
  743.   the system ask during boot if you want to use the swap partition. In
  744.   /etc/rc.d/rc.sysinit (RedHat 4.1) or /sbin/init.d/boot (Suse 4.4.1):
  745.  
  746.  
  747.  
  748.        echo "Should the system use swap?"
  749.        echo "  0: No."
  750.        echo "  1: Yes."
  751.        /bin/echo "Your choice: \c"
  752.        read SWAPCHOICE
  753.  
  754.        case "$SWAPCHOICE" in
  755.            0)
  756.                # Do nothing.
  757.                echo "(Swap partitions disabled)"
  758.                ;;
  759.            *)
  760.                # Start up swapping.
  761.                echo "Activating swap partitions"
  762.                swapon -a
  763.        esac
  764.  
  765.  
  766.  
  767.  
  768.  
  769.   Then you can use the swap partition while on ac power and drop it
  770.   while on battery.
  771.  
  772.  
  773.  
  774.   4.6.  The apache httpd webserver daemon
  775.  
  776.  
  777.   I am using my laptop to develop and test cgi scipts for websites, that
  778.   is why I am running a local webserver on it. The standard
  779.   configuration is a bit too much if all you want to do is just test a
  780.   script or check a page from time to time.
  781.  
  782.  
  783.   In httpd.conf, just change the values of MinSpareServers and
  784.   StartServers to 1. This will be enough for a local test site.
  785.  
  786.  
  787.   If you wish to turn off the webserver's logging, you must recompile
  788.   the httpd daemon. Read the documentation for details.
  789.  
  790.  
  791.   Grant Taylor recompiled apache's logging and found that this ``didn't
  792.   make it stop churning the disk. So I used another, IMHO better,
  793.   solution: I configured apache to run from inetd instead of
  794.   standalone.'' Read man inetd for details.
  795.  
  796.  
  797.  
  798.   4.7.  The XFree86 package
  799.  
  800.  
  801.   Configuring XFree86 for laptops is a story of its own. And yet again,
  802.   I have to refer you to the Linux Laptop page where you will find a lot
  803.   of help on this.
  804.  
  805.  
  806.   X's console blanking only turns the screen black, but does not turn it
  807.   off. As mentioned in the ``sidenote about console blanking'', you can
  808.   use xset's dpms option to change this.  However, this feature depends
  809.   on your laptop's graphics chipset and bios.
  810.  
  811.  
  812.   Grant Taylor uses the following setup to send his laptop to sleep with
  813.   the help of apmd and the screensaver:
  814.  
  815.  
  816.  
  817.  
  818.        # Run xscreensaver with APM program
  819.        xscreensaver -timeout 5 \
  820.                     -xrm xscreensaver.programs:apm_standby \
  821.                     -xrm xscreensaver.colorPrograms:apm_standby &
  822.  
  823.  
  824.  
  825.  
  826.  
  827.   Where ``apm_standby is a suid perl script that allows only certain
  828.   people to run apm -S.''
  829.  
  830.  
  831.  
  832.   4.8.  The emacs editor
  833.  
  834.  
  835.   Ok, emacs is not an editor, but a way of life. Here's a tip from
  836.   Florent Chabaud: ``If you use emacs, perhaps you have noticed that the
  837.   editor makes some automatic saves.  This is of course useful and
  838.   should not be disabled, but the default parameters can be adjusted to
  839.   a laptop use.
  840.  
  841.  
  842.   I have put in the file /usr/share/emacs/site-lisp/site-start.el the
  843.   two following lines:
  844.  
  845.  
  846.  
  847.  
  848.        (setq auto-save-interval 2500)
  849.        (setq auto-save-timeout nil)
  850.  
  851.  
  852.  
  853.  
  854.  
  855.   This disables auto-saving based on time, and makes the auto-saving be
  856.   done every 2500 keyboard actions. Of course if you are typing a text
  857.   this last parameter should be reduced, but for programming it is
  858.   sufficient. Since every action (up, down, left, backspace, paste,
  859.   etc...) is counted, 2500 actions are reached very rapidly.''
  860.  
  861.  
  862.  
  863.  
  864.   4.9.  How to find more ways to optimize
  865.  
  866.  
  867.   If your Linux system still seems to access the harddisk too often, you
  868.   can find out what is going on inside by using the ps ax command. This
  869.   will show all running processes and their full name, sometimes it also
  870.   reveals the command line arguments of each process.
  871.  
  872.  
  873.   Now read the man page of each process to find out what it does and how
  874.   to change its behaviour. With this method, you will most likely find
  875.   the process that is responsible. You may also find strace helpful.
  876.  
  877.  
  878.   Please send me an email if you found something new.
  879.  
  880.  
  881.  
  882.   5.  Appendix
  883.  
  884.  
  885.  
  886.   5.1.  A message to Linux distributors
  887.  
  888.  
  889.   If you happen to be a Linux distributor, thank you for reading all
  890.   this. Laptops are becoming more and more popular, but still most Linux
  891.   distributions are not very well prepared for portable computing.
  892.   Please make this document obsolete and change this for your
  893.   distribution.
  894.  
  895.  
  896.  
  897.   ╖  The installation routine should include a configuration, optimized
  898.      for laptops. The ``mimimal install'' is often not lean enough.
  899.      There are a lot of things that a laptop user does not need on the
  900.      road. Just a few examples. There is no need for three different
  901.      versions of vi (as found in Suse Linux). Most portable systems do
  902.      not need printing support (they will never be connected to a
  903.      printer, printing is usually done with the desktop system at home).
  904.      Quite a few laptops do not need any network support at all.
  905.  
  906.  
  907.  
  908.   ╖  Don't forget to describe laptop-specific installation problems, e.
  909.      g. how to install your distribution without a cd-rom drive or how
  910.      to setup the plip network driver.
  911.  
  912.  
  913.  
  914.   ╖  Add better power management and seamless pcmcia support to your
  915.      distribution. Add a precompiled kernel and an alternative set of
  916.      pcmcia drivers with apm support that the user can install on
  917.      demand. Include a precompiled apmd package with your distribution.
  918.  
  919.  
  920.  
  921.   ╖  Add support for dynamically switching network configurations. Most
  922.      Linux laptops travel between locations with different network
  923.      settings (e. g. the network at home, the network at the office and
  924.      the network at the university) and have to change the network id
  925.      very often. Changing a Linux system's network id is a pain with
  926.      most distributions.
  927.  
  928.  
  929.  
  930.   Please mail me if your distribution is optimized for portable
  931.   computing and what kind of features you added for that. Future
  932.   versions of this HOWTO will include a section where you can advertise
  933.   your distribution's laptop features.
  934.  
  935.  
  936.  
  937.   5.2.  Credits
  938.  
  939.  
  940.  
  941.   ╖  The information about battery technology is mostly based on the
  942.      article ``Stromkonserve'' by Michael Reiter, published in ``c't
  943.      Magazin fuer Computertechnik'' (Heise Verlag Hannover, Germany),
  944.      edition 10/96, page 204. Used by permission. Visit their website at
  945.      http://www.heise.de/.
  946.  
  947.  
  948.  
  949.   ╖  The following people contributed to this document:
  950.  
  951.  
  952.  
  953.  
  954.        Frithjof Anders <anders@goethe.ucdavis.edu>
  955.        David Bateman <dbateman@ee.uts.edu.au>
  956.        Florent Chabaud <chabaud@celar.fr>
  957.        Markus Gutschke <gutschk@uni-muenster.de>
  958.        Kenneth E. Harker <kharker@cs.utexas.edu>
  959.        Bjoern Kriews <bkr@rrz.uni-hamburg.de>
  960.        R. Manmatha <manmatha@bendigo.cs.umass.edu>
  961.        Juergen Rink <jr@ct.heise.de>
  962.        Grant Taylor <gtaylor@picante.com>
  963.        James Youngman <JYoungman@vggas.com>
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.   5.3.  About this document
  971.  
  972.  
  973.   This text mentions batteries 53 times.
  974.  
  975.  
  976.   The current version of this and many other HOWTOs, most of them a lot
  977.   more useful than this one, can be found at the main Linux
  978.   documentation site http://sunsite.unc.edu/mdw/linux.html or at one of
  979.   its many mirror sites.
  980.  
  981.  
  982.   Most of this text was written during my trips between Hamburg and
  983.   Hannover on German rail. (The new ice-2 coaches have power outlets for
  984.   laptops, yeah!).
  985.  
  986.  
  987.   And now hum along with me: ``...on the road again...''
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997.  
  998.  
  999.  
  1000.  
  1001.  
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.