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
wget https://raw.githubusercontent.com/divx118/crouton-packages/master/change-kernel-flags
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
wget https://raw.githubusercontent.com/divx118/crouton-packages/master/rc.local
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
wget https://github.com/divx118/crouton-packages/raw/master/pool/main/l/linux-source-3.8.11/linux-headers-3.8.11_20160501_amd64.deb
wget https://github.com/divx118/crouton-packages/raw/master/pool/main/l/linux-source-3.8.11/linux-image-3.8.11_20160501_amd64.deb

# 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:

https://github.com/divx118/crouton-packages/tree/master/pool/main/l

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/
wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo
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!

Cheers!

 
23
Kudos
 
23
Kudos

Now read this

Perfection. Today. – Running Fedora on Dell XPS 7590

The new Dell XPS 7590 is a great machine. Like every great machine it has some drawbacks, but since it is much greater than the sum of its features you bond with it and forgive it. Take mine for example. Even though the keyboard is far... Continue →