31

How can I optimize Ubuntu for minimal energy usage? I use my laptop for development, but also for writing. I have a 9 hour flight coming up and a 6 hour battery life when already using

  • limited screen brightness
  • no usb devices
  • no networking
  • bumblebee installed and the nvidia card switched off
  • TLP set on powersave

How can I now increase my battery life knowing that I only want to write (using LibreOffice)? I essentially want a very minimal system for a sort of 'writing mode.'

  • Should I limit my quadcore to one core?
  • Should I disable some services? Here is the list of service --status-all

    [ + ]  acpid
    [ + ]  anacron
    [ + ]  apache2
    [ - ]  apparmor
    [ ? ]  apport
    [ + ]  atd
    [ + ]  avahi-daemon
    [ ? ]  binfmt-support
    [ + ]  bluetooth
    [ - ]  brltty
    [ + ]  bumblebeed
    [ + ]  console-font
    [ + ]  console-setup
    [ + ]  cron
    [ + ]  cups
    [ + ]  cups-browsed
    [ - ]  dbus
    [ ? ]  dns-clean
    [ - ]  elasticsearch
    [ - ]  fancontrol
    [ + ]  friendly-recovery
    [ - ]  grub-common
    [ ? ]  irqbalance
    [ - ]  kerneloops
    [ ? ]  killprocs
    [ + ]  kmod
    [ ? ]  lightdm
    [ - ]  lighttpd
    [ - ]  lm-sensors
    [ ? ]  mysql
    [ ? ]  networking
    [ + ]  nmbd
    [ ? ]  ondemand
    [ - ]  openvpn
    [ + ]  postgresql
    [ ? ]  pppd-dns
    [ + ]  prey-trigger
    [ - ]  procps
    [ - ]  pulseaudio
    [ ? ]  rc.local
    [ + ]  resolvconf
    [ + ]  rfkill-restore
    [ + ]  rfkill-store
    [ - ]  rsync
    [ + ]  rsyslog
    [ + ]  samba
    [ + ]  saned
    [ - ]  selfcontrol
    [ ? ]  sendsigs
    [ + ]  setvtrgb
    [ - ]  smartmontools
    [ + ]  smbd
    [ ? ]  speech-dispatcher
    [ - ]  sudo
    [ - ]  timidity
    [ ? ]  tlp
    [ - ]  udev
    [ ? ]  umountfs
    [ ? ]  umountnfs.sh
    [ ? ]  umountroot
    [ - ]  unattended-upgrades
    [ - ]  urandom
    [ + ]  winbind
    [ - ]  x11-common
    
    • Should install a more lightweight desktop environment? Can I do this in a nice and clean way (after all I have my laptop nicely set up and do not want to have to reinstall before 14.04).
    • Should I do something else?

One last thing: I would like to activate or deactivate all these options with one script (which I will run only when working on battery). Please be as kind as to include suggestions on how to do what you suggest.

PS: the info in some of the possible duplicates is dated for 13.10.

don.joey
  • 29,392

6 Answers6

14

you can use a tool named as pm-powersave. It will turn your Ubuntu into low power mode.

usage:

  • pm-powersave true will start power save mode.

  • pm-powersave false will stop the power save mode.

enter image description here

Fore more information

manpage for the http://manpages.ubuntu.com/manpages/saucy/man8/pm-powersave.8.html command Manpage icon

Raja G
  • 105,327
  • 107
  • 262
  • 331
4

One of the biggest uses of power is the hard drive. If you're just using the computer for it's word processing capabilities, you might be able to go for significant periods of time without reading or writing to the hard disk.

  1. Disable filesystem journaling. This is one of the most frequent uses of the hard drive. It will also allow the next item to be much more effective.
  2. Use buffered disk writes. It's possible to buffer disk writes for a significant period of time before writing them to the hard disk. If you're only running one program, this could potentially allow your hard disk to remove off for 20 or 30 minutes even if you're writing to the device. I use laptop-mode-tools. I don't know the ubuntu approved method for this.
  3. Other hard disk power saving options. (Spindown more often, etc.)
  4. As mentioned previously, use powertop to find other configuration changes that can be made to reduce power consumption.
  5. Undervolt your CPU. This one is quite a bit more involved than the others. https://wiki.ubuntu.com/UndervoltingHowto
user606723
  • 1,802
3

You can set the cpu governor of all your cpu cores to "powersave". That's the lowest cpu clock, and uses the least power.

user@host:~$ for x in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo powersave | sudo tee $x > /dev/null; done

To see which governor is currently active type:

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

Default value is "ondemand".

EDIT:

When you boot you can set the number of max cpus in the grub entry by pressing e to edit the entry and add:

maxcpus=1

After changing the entry press F10 to boot.

BUT, you can limit your cpu cores, but that does not mean that you use less power consumption, than before. Note, that when the system is able to efficiently use multiple cpus, it needs for the same task less time and produces less heat, so you have to test it for your purposes. For more info cf. the kernel parameters.

Langdon
  • 81
chaos
  • 28,186
1

powertop provides a (not particularly accurate) estimate of the power usage of individual pieces of hardware and running processes.

Shutting down some unneeded services relating to eg, networking/bluetooth, or useless user-space processes (eg Dropbox/Ubuntu One when you have no network connection) might make a small difference. Anything running a timed loop will cause the processor to wake up from sleep and use a little extra power.

chronitis
  • 12,647
1

Should install a more lightweight desktop environment?

How about 0 GUI's. Pure text-based environment, no Xserver running in background etc...

Should I disable some services?

I would disable/stop apache, samba, ntp, pulse, insert your network/audio related service here services.

Should I limit my quadcore to one core?

Do you need them? -> yes

No.

Do you need them? -> no

Yes.

Should I do something else?

Thousands! You can run off a USB/SSD and forget about the HDD spinning out of control. Put the CPU's in powersave mode. Disable all radio interfaces. Use powertop and set to true all power_saving mechanisms. Get an extra battery. Ad absurdium.

Related of the same author:

Braiam
  • 69,112
1

The screen is by far the biggest user of power, just push the brightness down to 0 and turn off bluetooth and wireless lan if you have a cable connection; that makes THE biggest difference and I'm not sure disabling services and tweaking caching will improve much over that