Installing VirtualBox in unRAID5.0-i386

From unRAID
Jump to: navigation, search

Use these instructions with discretion.

This guide is a walk through for unRAID users that want to be able to compile their own kernel headers, and therefore compile and run VirtualBox into unRAID server. Note that a huge amount of RAM is necessary for compile and run VBox, so I recommend 4GB+ of RAM.


First of all, you have to satisfy these dependencies:

a) Vanilla copy of Linux kernel;

b) gcc, glibc, binutils, make, patch, perl, ncurses, cpio, pkgtools and cxxlibs packages;

c) VirtualBox Linux "All Distributions" 32bits package.

For unRAID version 5.x, those packages can be found here:

Installing the kernel source and making your own headers

First, install the ".tgz" or ".txz" packages from above. Code:

# unRAID 5.x "txz" files
installpkg binutils-
installpkg cxxlibs-6.0.13-i486-2.txz
installpkg gcc-4.4.4-i486-1.txz
installpkg gcc-g++-4.4.4-i486-1.txz 
installpkg glibc-2.11.1-i486-3.txz
installpkg make-3.81-i486-1.txz
installpkg mpfr-2.4.2p03-i486-1.txz
installpkg ncurses-5.7-i486-1.txz
installpkg patch-2.5.4-i486-1.txz
installpkg perl-5.10.1-i486-1.txz

Go to "/usr/src" directory, and rename the folder "linux" to "linux_original". Code:

$ mv /usr/src/linux-3.9.6p-unRAID /usr/src/linux_original

Now extract the vanilla kernel file (change linux-3.9.6.tar.gz to match your version's kernel) into "/usr/src": Code:

$ tar -C /usr/src -zxvf linux-3.9.6.tar.gz

Link the new source directory to "/usr/src/linux" path: Code:

$ ln -sf /usr/src/linux-3.9.6 /usr/src/linux

Copy all default drivers and configuration to the new source directory: Code:

$ cp -rf /usr/src/linux_original/* /usr/src/linux/
$ cp -f /usr/src/linux_original/.config /usr/src/linux/

Move existing kernel headers includes, and replace them with the new source includes: Code:

$ [ -e "/usr/include/linux" ] && mv /usr/include/linux /usr/include/linux_original
$ [ -e "/usr/include/asm-generic" ] && mv /usr/include/asm-generic /usr/include/asm-generic_original
$ [ -e "/usr/include/asm" ] && mv /usr/include/asm /usr/include/asm_original

On unRAID 5 RC13 and newer, install these 2 packages:


$ installpkg bc-1.06.95-i486-1.txz
$ installpkg kernel-headers-

Now it's time to compile the kernel source: Code:

$ cd /usr/src/linux
$ make oldconfig && make

Congratulations, now you have your own headers!

Installing VirtualBox

Make a directory to store your configuration (e.g. /boot/custom/vbox ), and link it to root home folder: Code:

$ mkdir -p /boot/custom/vbox && ln -sf /boot/custom/vbox /root/.VirtualBox

Create a temporary directory (e.g. mkdir /mnt/disk1/tmpdir ) and type: Code:

$ export TMPDIR=/mnt/disk1/tmpdir && sh VirtualBox<version>.run

If everything worked fine, you now have a working copy of VirtualBox running into your server. It's time to make it permanent over reboots.

Making a VBox package

VirtualBox installer extracts binary files to "/opt/VirtualBox" directory, creates an udev rule, compiles and insert the kernel modules and creates a lot of links, so we have to do all these steps using a package.

1) Create a folder for temporary files (e.g. /mnt/cache/vbox_package ):


$ mkdir /mnt/cache/vbox_package

2) Copy these directories to your temp folder:


$ cd /mnt/cache/vbox_package/
$ cp --parents -rf /opt/VirtualBox ./
$ cp --parents -f /lib/modules/`uname -r`/misc/vboxdrv.ko ./
$ cp --parents -f /lib/modules/`uname -r`/misc/vboxnetadp.ko ./
$ cp --parents -f /lib/modules/`uname -r`/misc/vboxnetflt.ko ./
$ cp --parents -rf /etc/vbox ./
$ cp --parents -f /etc/udev/rules.d/10-vboxdrv.rules ./

3) Make an "install" dir under your temp folder:


$ mkdir /mnt/cache/vbox_package/install

4) Or for unRAID 5.x, under the new "install" folder, create a "" file with this content:


# Insert VBox modules on the kernel
insmod /lib/modules/`uname -r`/misc/vboxdrv.ko
insmod /lib/modules/`uname -r`/misc/vboxnetadp.ko
insmod /lib/modules/`uname -r`/misc/vboxnetflt.ko

# Create some necessary links
ln -sf /opt/VirtualBox/ /usr/bin/VBoxHeadless
ln -sf /opt/VirtualBox/ /usr/bin/VBoxManage
ln -sf /opt/VirtualBox/ /usr/bin/VBoxSDL
ln -sf /opt/VirtualBox/ /usr/bin/VBoxVRDP
ln -sf /opt/VirtualBox/ /usr/bin/VirtualBox
ln -sf /usr/bin/VBoxHeadless /usr/bin/vboxheadless
ln -sf /usr/bin/VBoxManage /usr/bin/vboxmanage
ln -sf /usr/bin/VBoxSDL /usr/bin/vboxsdl
ln -sf /opt/VirtualBox/ /usr/bin/vboxwebsrv

# Reload udev rules
udevadm control --reload-rules

# Expac USB fix
groupadd vboxusers
usermod -aG vboxusers root
usermod -aG vboxusers nobody
mkdir /dev/vboxusb -m 0750
chown root:vboxusers /dev/vboxusb

# Create and link the configuration dir
mkdir -p /boot/custom/vbox -m 0777
ln -sf /boot/custom/vbox /root/.VirtualBox

# Auto-generated rules

5) Finally, create the package:


$ cd /mnt/cache/vbox_package && makepkg /boot/vbox-<version>-unRAID-3.9.6p.tgz

Other considerations

VBox can be managed from command line, but there is a very nice GUI that runs in php, named phpvirtualbox:

If you want to run it from your unRAID server, you will need a http server, like lighttpd, and the php package installed. If anyone wishes to contribute with directions, please be my guest.