4

I currently use Ubuntu in a virtual machine, using VirtualBox software on my host operating system, OS X, on my MacBook Pro 2015.

However, the battery life drains quickly when Ubuntu is used continuously. The battery life only lasts about four hours at the best. If I do not run Ubuntu, the battery life would be about seven hours.

Will the battery life be longer if I run Ubuntu natively (dual boot), or if I run Ubuntu in a virtual machine, with VirtualBox software?

  • What kind of information are you looking for which is not already included in the answers given on May 3rd? – nohillside May 8 '16 at 11:40
  • Merely a confirmation - I need a reliable opinion/answer on the subject, as it is for professional use. – Ring Ø May 8 '16 at 13:41
  • 1
    Given how the site works, people usually refrain from answering on their own if an existing answer already states whatever they would have answered. – nohillside May 8 '16 at 14:08
  • 1
    Out of curiosity..what are you hoping to do in Linux that you can't do in OS X? – Allan May 8 '16 at 14:23
  • 1
    Totally out of the scope of your question, but you should look into Vagrant, particularly providers for hosted VMs. If you're primarily using Ubuntu to test deployment, it's super nice to have repeatable, disposable environments, and your battery life won't suffer at all. – Jay Thompson May 12 '16 at 0:36
6

Booting Ubuntu on a dual boot partition has a similar battery life to OS X, perhaps slightly shorter, due to less efficient optimization for the MacBook Pro's hardware.

In a virtual machine, despite lots of "clever" optimizations and CPU hardware virtualization features, there are two complete operating systems, with two kernels, and two display managers* running. There is no way around the fact that these require significantly more processing power, thus, sucking up more battery life.

If you want longer battery life in Ubuntu, try disabling the eye candy. (This, of course, is assuming the virtual machine is not running headless.)

  • 1
    Have you tested this side-by-side? Which Mac? Which display drivers? My intuition tells me that if you limit VirtualBox to the embedded graphics chip on a dual-GPU MacBook, you'll wind up with longer battery life as OS X can optimize better – agentroadkill May 8 '16 at 21:23
  • It is true I have only tested on the single-GPU 2012 Retina Macbook Pro 13", so that may be the case, but there are some Ubuntu packages that allow switching between embedded and discrete graphics cards on the fly while booted into linux (e.g. help.ubuntu.com/community/HybridGraphics) – cortices May 9 '16 at 4:24
2

Note that it looks like the VirtualBox in particular has very poor battery efficiency when compared to other virtual machine emulators. I came across this page below that benchmarked different vms and found that running Windows in Parallels or Fusion on a Mac results in the battery lasting nearly twice as long as VirtualBox.

Details at https://www.tekrevue.com/2015-vm-benchmarks-parallels-11-vs-fusion-8/13/

2

I am not using other OS X apps while working in ubuntu which is anyway my main OS. I decided to go for virtualbox since I can take full advantage of the power saving features of OS X and still use the builtin webcam, the audio system, and USB devices in ubuntu.

I am running virtualbox (at this point 5.1.26) on a Macbook 2015 (OS X 10.11.6) with 8GB RAM and CPU capable of running 4 threads. The default settings were not the best (when playing back videos on the VM) and I needed some tweaking. I am using xubuntu (currently 16.04). I have assigned 3 CPUs despite the warning in VBox and about half of the RAM.

The most annoying tweak is the fact that xubuntu does not like the high native screen resolution. I am using the scripts below to reduce resolution on the OS X side. This works very well and does not give the pixelish appearance of downscaling in virtualbox.

Here is the code you'll need - thanks to those who wrote it:

https://gist.github.com/atr000/207602

Create yourself e.g. a BASH script called set_1440x900.sh

#!/bin/bash

/Users/myusername/Apps/setgetscreenres/setgetscreenres 1440 900

which would set to 1440x900, a perfect resolution for 10 inch Retina macbooks (e.g. 2015 model).

You can also create an AppleScript application to call the script using the OS X Script Editor in Utilities. You can save this as "Application" and then add it to the dock.

do shell script"/Users/myusername/Apps/setgetscreenres/set_1440x900.sh"

After rebooting OS X, which I rarely do, I just click once on this application, and the screen resolution is (smoothly) reduced. It will look blurred for a while, but after a while, you will no longer miss the Retina native resolution, if you work in Xubuntu. If you want to go back to native retina resolution, you can choose any of the modes from the "System Preferences" > "Display". You would probably do this if you would like to work with a native OS X application.

Videos in fullscreen mode now will run smoothly in xubuntu. If you close your macbook, you will send the virtualbox to "save the machine state" in the background, which is exactly what you will want to do on a laptop. This conveniently happens after a while of inactivity in closed state, i.e. for shorts pauses, you will not have "wake up breaks". You can get through a full day with some breaks with a single battery charge (5-6 hours). If you're at a meeting and want to save on battery, slightly dim the display and remove one of the 3 CPUs from the VBox configuration. You might experience some video flickering, but for using google drive, libreoffice, etc., everything will run smoothly.

Using this setup you -get a long battery life -can use native drivers for all hardware -have no issues inside VBox with drivers for linux concerning Mac hardware -can run other virtual OS in a 2nd and 3rd VBox and exchange data between all OSes easily, including the host OS X -don't need to like or be familiar with OS X. You barely don't need to touch it. However, it might come in handy to run some non-free applications, be some firmware updater for a device and alike. -can transfer your "favorite working linux configuration" easily to any other standard PC, laptop, server, etc. with the same CPU architecture -even control homebuilt hardware based on e.g. arduino and ESP32 from inside virtualbox in a hassle-free manner. -do not need to purchase any software license on top of what you get with the computer itself.

  • I have not tried anything else than virtualbox. Might well be that Parallels and or Fusion are performing better, but VBox is free. They have done quite some improvement, especially regarding camera integration. – Jürgen Hench Aug 31 '17 at 12:38
1

Yes, running Ubuntu natively (dual booting) may be a better way, but you will lose all "pros" of your MacBook Pro 2015 (Mac OS X).

There is another way of "using Ubuntu," which is Docker. I bet you have heard of it, but you may not know that the latest Docker beta uses a native virtualization mechanism, and it does not need VirtualBox, or any other virtual machine software, anymore.

  • While it is true there are many other ways to run unix and Linux executables on mac, you are not really answering the OP's question. – cortices May 3 '16 at 5:21
  • I don't think so. I said dual boot is better, and I just gave him another option – david30xie May 3 '16 at 5:23
1

Are you sure your battery life problems during native boot are OS related? I would try installing the SMC fan control available from Debian…

First,you will need to navigate to the repository configurations and add the contrib and non-free repositories as follows:

nano /etc/apt/sources.list

After main, add "contrib" and "non-free" ... For example:

deb http://site.example.com/debian distribution main contrib non-free
deb-src http://site.example.com/debian distribution main contrib non-free

After that ...

sudo apt update
sudo apt install macfanctld

Then, once installed, type macfanctl at the shell emulator of your choice. It will direct you to the config. Tweak some settings and watch - battery life will improve by a factor of 2/3.

This will not impact VM installs, only the first part of your question.

You must log in to answer this question.

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