30

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.

4
  • 1
    Writing script is an easy task but I am wondering what else is remaining to save power..you have done most of the things already! ;) Nov 19, 2013 at 12:18
  • 2
    You are going trough hoops and the result will be that you save a few minutes. You really expect to win 3 or more hours? If there was a way to get 50% more power out of battery we would have an option for it in power management. Easiest solution: get a second battery. Heck, I have 3 myself just for those 4, 5 times a year my trains are running very late.
    – Rinzwind
    Nov 19, 2013 at 18:30
  • You're from holland right? There the trains run late a lot more than 4 or 5 times :) How much can be gained really is not fully documented and not all tests can do things as dramatic as change desktop environment, so quite frankly, I don't think there is data to support your claim.
    – don.joey
    Nov 19, 2013 at 18:42
  • 1
    @don.joey you really believe the creators of both Jupiter and ttlp and the guys fron Phoronic would not have this as a feature the second they know it would work? They all did the tests for us ;)
    – Rinzwind
    Nov 19, 2013 at 19:26

6 Answers 6

13

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

2
  • I like the manpage for pm-powersave as it points to /etc/pm/power.d/ and thus is easily extensible (just add a new script to this directory).
    – don.joey
    Nov 19, 2013 at 16:01
  • 1
    Difference with TLP's powersave mode? I'll do my test but even so, your feedback would be appreciated.
    – tuk0z
    Jun 5, 2016 at 21:20
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
1
  • 2
    Disabling filesystem journaling is terrible advice, especially when you don't inform users of the serious dangers of (frequent) irrecoverable crashed drives. Journing prevents massive chunks of your disk disappearing (unless you have a faulty disk). If you disable journaling and your battery dies thus causing a forced shutdown, you're basically playing Russian Roulette with your data. Dec 12, 2021 at 20:15
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 > $x; done

To see which governor is currently active type:

user@host:~$ echo $(cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor)
powersave powersave powersave powersave

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.

3
  • Is there a simply way to not use certain cpu cores?
    – don.joey
    Nov 19, 2013 at 16:02
  • @don.joey see my edit
    – chaos
    Nov 20, 2013 at 7:26
  • Nice edit. Can you add a source?
    – don.joey
    Nov 20, 2013 at 7:27
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.

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:

2
  • How can I work with LibreOffice documents without an Xserver?
    – don.joey
    Nov 19, 2013 at 16:41
  • 1
    @don.joey how about not using LibreOffice? Is there a characteristic of LO that other text-based text processor can't offer? Maybe you should consider just plain text and do formatting at the end of the flight?
    – Braiam
    Nov 19, 2013 at 16:57
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

1
  • And yet the same machine's battery lasts 5x longer when running Windows. Dec 12, 2021 at 20:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .