How do I enable laptop mode to improve Linux laptop battery life?

Q. I’m using Redhat enterprise Linux desktop / workstation operating system with HP laptop. Several Linux distributions have a / script to enable to disable Laptop mode but Redhat misses the script. How do I enable or disable laptop mode on fly?

ADVERTISEMENTS

A. Modern Linux kernel includes very good support for Laptop mode. It is use to control the IO subsystem. When laptop mode is enabled, the Linux will try to be smart about when to do disk I/O. It gives as much time as possible to be in a low power state. If mode is disabled if value is set to zero (0). To enable mode use non zero value such as 5.

Display or print current Laptop mode

Type the following command:
$ cat /proc/sys/vm/laptop_mode
Output:

0

Turn on or enable Laptop mode

Type the following command as the root user:
$ sudo echo 5 > /proc/sys/vm/laptop_mode
OR
# echo 5 > /proc/sys/vm/laptop_mode

A note about Ubuntu Linux

According to this page:

Ubuntu has a laptop-mode-tools package, which is installed by default on laptops. However, laptop mode is disabled by default in Ubuntu Edgy (6.10), because some people have been experiencing hangups with it on certain laptops (mostly Thinkpads). Until now, nobody has any clue what is happening here. To reenable laptop mode, edit /etc/default/acpi-support and set ENABLE_LAPTOP_MODE=true.

If you want to use the latest version of laptop mode tools, you can use the Debian packages, they are compatible enough to work out-of-the-box on Ubuntu.

A note about Suse Linux

=> Suse Linux comes with powersaved tool, so please ignore above commands for power saving.

Updated for accuracy.

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
12 comments… add one
  • Owen Dec 23, 2007 @ 4:35

    The actual command needs a > symbol in it like follows: sudo echo 5 > /proc/sys/vm/laptop_mode

  • 🐧 nixCraft Dec 23, 2007 @ 8:21

    Owen,

    Thanks for the heads up.

  • Owen Dec 23, 2007 @ 8:37

    Your Welcome,
    I’ve ran into that problem on my blog before.

  • klez Mar 11, 2009 @ 21:17

    note that “sudo echo > root-owned-file” doesn’t work, since you echo as root but will still be writing via your shell, which is running as your regular user. I do realize it says ‘do this as root’ but it’s still a bit misleading. And if you’re already root, why sudo?

    as non-root try:
    sudo -s
    echo 5 > /proc/csys/vm/laptop_mode
    exit

    • Ikem Dec 8, 2012 @ 20:56

      That’s what I do:

      echo “5”|sudo tee /proc/sys/vm/laptop_mode

  • Casey May 26, 2009 @ 9:45

    sudo bash -c “echo 5 > /proc/sys/vm/laptop_mode”

  • gunnar-eee Aug 23, 2009 @ 20:50

    laptop mode is broken in Ubuntu. It keeps spinning the drive up/down at 10 second intervals, seems nobody have gotten the parameters right so it becomes usable.
    I hope it becomes sorted out. Until then its off for me.

  • shirish Sep 18, 2009 @ 2:18

    While its true its broken, its also due to merge not happening of laptop-mode-tools.

    https://bugs.launchpad.net/ubuntu/+source/laptop-mode-tools/+bug/422620

  • INDY Jul 18, 2010 @ 6:31

    We should save changed state of value if we add vm.laptop_mode = 5 in /etc/sysctl.conf

    Anyway, true way is:

    show current value:
    # /sbin/sysctl -n vm.laptop_mode

    set value:
    # /sbin/sysctl -w vm.laptop_mode=”5″

    • oot der hoos Oct 24, 2012 @ 13:58

      Using quotes, like “5”, failed with an error for me.
      I did:
      /sbin/sysctl -w vm.laptop_mode=5

  • Surendar.S Oct 9, 2012 @ 4:50

    sir i want answer for.. “how to improve battery life in ubuntu?”

  • handsome Dec 11, 2013 @ 5:51

    Ok great awesome but what does it do?

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.