VirtualBox 5.0 and Crouton Fedora 24

Recently I had to install VirtualBox onto my Chromebook which is running the latest version of Crouton Fedora with Fedora 24 which you can get from Github.

Installing VirtualBox in the original Crouton with Ubuntu/Debian is very easy because one of the Crouton developers divx118 (huge props to him) builds .deb packages with kernel headers, so you don’t have to compile the entire kernel yourself to get the VirtualBox modules running.

Installing VirtualBox on Crouton Fedora is also very easy because it can use the mentioned prebuilt packages, but there are a few extra steps needed.

Modifying the cmdline to enable module sideload and VT-x #

We have to tell the ChromeOS kernel that we want to load extra modules ourselves and that we want to enable virtualization. There is a very nice script by divx118 which does this for us:

Execute this from crosh shell (not Fedora shell):

cd ~/Downloads
sudo sh ~/Downloads/change-kernel-flags

and reboot (power off then on). Afterwards check to see if lsm.module_locking=0 and disablevmx=off parameters are present by executing cat /proc/cmdline.

Install dependencies #

Drop to Fedora shell and install the following packages:

sudo dnf install binutils gcc make patch libgomp glibc-headers glibc-devel dpkg wget

Setup local.rc #

We have to unbind the /lib/modules folder so we don’t accidentally overwrite ChromeOS kernel modules, which would mean that you have to recover from an USB drive and lose all your data. Do the following from the Crouton Fedora shell:

sudo su
cd ~/Downloads
cp rc.local /etc/rc.local
chmod +x /etc/rc.local

and exit the chroot and reenter it for rc.local to do it’s thing.

Get kernel headers and extract them #

Do the following:

# get kernel headers from divx118 repo

sudo su
cd ~/Downloads/
mkdir vbox
cd vbox

# unpack them

dpkg-deb -R ./linux-headers-3.8.11_20160501_amd64.deb .
dpkg-deb -R ./linux-image-3.8.11_20160501_amd64.deb .

# set kernel path for vbox installer:

export KERN_DIR=/root/Downloads/vbox/usr/src/linux-headers-3.8.11/

You can see what your kernel version and architecture is by issuing uname -a to the shell. In my case, my Toshiba Chromebook 1 is on kernel 3.8.11 with x86_64 architecture. Substitute the files for your kernel/architecture. You can find additional packages here:

Be careful to use raw github links instead of the http ones which would result in getting a webpage instead of the .deb file.

Last thing is to “trick” the kernel packages to use gcc6 which we installed earlier instead of gcc5 with:

cp /root/Downloads/vbox/usr/src/linux-headers-3.8.11/include/linux/compiler-gcc5.h /root/Downloads/vbox/usr/src/linux-headers-3.8.11/include/linux/compiler-gcc6.h

and you are good to go!

Install VirtualBox #

sudo su
cd /etc/yum.repos.d/
dnf install VirtualBox-5.0 -y

DNF will tell you if kernel modules compiled successfully and point you to the log file if they haven’t.

Screenshot from 2016-06-11 15-22-56.png

Have fun and contact me if you run into issues!



Now read this

Chromium browser on Fedora ARM (23, LXDE) - Raspberry Pi 2

One of the few things missing from the official Fedora repositories is the Chromium browser. On an i686 or x86_64 system its pretty easy to find the correct Chromium build and install it. Sadly on ARM it seems like nobody is building it... Continue →