gfjardim

VirtualBox in unRAID

529 posts in this topic

Use these instructions with discretion. ;D

 

This guide intention is to allow unRAID users to be able to compile their own kernel headers, and with that be able to compile and run VirtualBox into unRAID server. Note that a huge amount of RAM is necessary for compile and run VBox, and I recommend over 4GB or RAM.

 

Wiki: http://lime-technology.com/wiki/index.php?title=Installing_VirtualBox_in_unRAID

0

Share this post


Link to post
Share on other sites

This looks great and your presentation is very clear.

 

As someone who can follow directions well but sometimes lacks the Linux savvy to understand what's going on, a couple of questions;

 

1. Will this survive updates?

Say there a 4.7.1 or 4.8. Will the whole things need to be done again? I had VMWare Server running under 4.5.3 but was locked out of upgrades as I'd need to go through the whole involved process each time.

 

2. Vanilla Kernel?

Is this replacing something customised in unraid and if so, what features might be affected?

 

3. Implemented in unRAID?

This is all implemented in unRAID, right? No need for a developer system?

 

4. v5 equivalents?

What should I be looking for to do this on 5 (when stable)? What versions of what have been updated?

 

Appreciate patience with Linux newbie

 

Peter

0

Share this post


Link to post
Share on other sites

[..]

As someone who can follow directions well but sometimes lacks the Linux savvy to understand what's going on, a couple of questions;

[..]

 

1) It may survive some unRAID updates, but it's the same problem that afflicts VMware, if the kernel is changed in the update, you may have to recompile the modules.

 

2) "Vanilla" is the source of the kernel from kernel.org. It has stock configurations, so it's supposed to be used by system builders, like Lime-Technology. In the guide, after replace the "original source" (stripped from the released version) with the "vanilla" one, we copy the md driver, the System.map and the build ".config" used by Tom to built unRAID, and apply it to the source before compile it. It's used only to make the headers necessary to compile the VBox modules, and is erased after a simple reboot, so it makes no permanent changes into the system.

 

3) Yes, in the guide we install all development packages needed to make the headers and compile the VBox modules, so there's no need to use a developer system. Most of the dependencies can be satisfied with unMENU gcc, perl and cpio packages, requiring only ncurses, patch and pkgtools.

 

4) You have to download the right vanilla source from kernel.org . In the shell, type "uname -r", and the kernel version needed is that before "-unRAID" prefix. You also have to download the equivalent packages for Slackware 13.1, that can be found here.

 

 

0

Share this post


Link to post
Share on other sites

Excellent

 

I'm looking forward to getting my unRaid server doing more than just unRaid again and have taken a liking to VirtualBox recently.

 

Many thanks.

 

Peter

0

Share this post


Link to post
Share on other sites

If it helps, I made some very simple scripts to automate these jobs.

 

I use the first one to install and compile the headers. Note that all package versions are suitable for version 4.x of unRAID, but not for 5.x.

#!/bin/bash

P="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")"

 

[ ! -d "$P/packages" ] && mkdir $P/packages

 

cd $P/packages

 

[ ! -e "linux-2.6.32.9.tar.gz" ] && wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.32.9.tar.gz

[ ! -e "gcc-4.2.4-i486-1.tgz" ] && wget http://slackware.oregonstate.edu/slackware-12.2/slackware/d/gcc-4.2.4-i486-1.tgz

[ ! -e "glibc-2.7-i486-17.tgz" ] && wget http://slackware.oregonstate.edu/slackware-12.2/slackware/l/glibc-2.7-i486-17.tgz

[ ! -e "binutils-2.18.50.0.9-i486-1.tgz" ] && wget http://slackware.oregonstate.edu/slackware-12.2/slackware/d/binutils-2.18.50.0.9-i486-1.tgz

[ ! -e "make-3.81-i486-1.tgz" ] && wget http://slackware.oregonstate.edu/slackware-12.2/slackware/d/make-3.81-i486-1.tgz

[ ! -e "cxxlibs-6.0.9-i486-1.tgz" ] && wget http://slackware.oregonstate.edu/slackware-12.2/slackware/a/cxxlibs-6.0.9-i486-1.tgz

[ ! -e "pkgtools-12.1.0-noarch-7.tgz" ] && wget http://slackware.osuosl.org/slackware-12.2/slackware/a/pkgtools-12.1.0-noarch-7.tgz

[ ! -e "perl-5.10.0-i486-1.tgz" ] && wget http://slackware.osuosl.org/slackware-12.2/slackware/d/perl-5.10.0-i486-1.tgz

[ ! -e "cpio-2.5-i486-3.tgz" ] && wget http://slackware.osuosl.org/slackware-12.2/slackware/a/cpio-2.5-i486-3.tgz

[ ! -e "patch-2.5.4-i486-1.tgz" ] && wget http://slackware.osuosl.org/slackware-12.2/slackware/a/patch-2.5.4-i486-1.tgz

[ ! -e "ncurses-5.6-i486-3.tgz" ] && wget http://slackware.osuosl.org/slackware-12.2/slackware/l/ncurses-5.6-i486-3.tgz

 

installpkg *.tgz

 

cd /

 

mv /usr/src/linux /usr/src/linux_original

 

if [ ! -d "$P/headers" ]; then

mkdir -p $P/headers

tar -C $P/headers -zxvf $P/packages/linux-2.6.32.9.tar.gz

cp -rf /usr/src/linux_original/* $P/headers/linux-2.6.32.9/

cp -f /usr/src/linux_original/.config $P/headers/linux-2.6.32.9/

fi

 

ln -sf $P/headers/linux-2.6.32.9 /usr/src/linux

[ -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

ln -sf /usr/src/linux/include/asm-generic /usr/include/asm-generic

ln -sf /usr/src/linux/include/linux /usr/include/linux

ln -sf /usr/src/linux/arch/x86/include/asm /usr/include/asm

 

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

 

 

The second one I used to automate the package-making process:

#!/bin/bash

P="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")"

 

TMPDIR="$P/vbox_temp"

 

[ -d "$TMPDIR" ] && rm -rf $TMPDIR

 

mkdir $TMPDIR

 

cd $TMPDIR

cp --parents -rf /opt/VirtualBox $TMPDIR/

cp --parents -f /lib/modules/2.6.32.9-unRAID/misc/vboxdrv.ko $TMPDIR/

cp --parents -f /lib/modules/2.6.32.9-unRAID/misc/vboxnetadp.ko $TMPDIR/

cp --parents -f /lib/modules/2.6.32.9-unRAID/misc/vboxnetflt.ko $TMPDIR/

cp --parents -rf /etc/vbox $TMPDIR/

cp --parents -f /etc/udev/rules.d/10-vboxdrv.rules $TMPDIR/

 

 

mkdir $TMPDIR/install

 

cat >>$TMPDIR/install/doinst.sh << 'THE_END_OF_SCRIPT'

# Insert VBox modules on the kernel

insmod /lib/modules/2.6.32.9-unRAID/misc/vboxdrv.ko

insmod /lib/modules/2.6.32.9-unRAID/misc/vboxnetadp.ko

insmod /lib/modules/2.6.32.9-unRAID/misc/vboxnetflt.ko

 

# Create some necessary links

ln -sf /opt/VirtualBox/VBox.sh /usr/bin/VBoxHeadless

ln -sf /opt/VirtualBox/VBox.sh /usr/bin/VBoxManage

ln -sf /opt/VirtualBox/VBox.sh /usr/bin/VBoxSDL

ln -sf /opt/VirtualBox/VBox.sh /usr/bin/VBoxVRDP

ln -sf /opt/VirtualBox/VBox.sh /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/VBox.sh /usr/bin/vboxwebsrv

 

# Reload udev rules

udevadm control --reload-rules

 

# Link the configuration dir

[ ! -d "/boot/custom/vbox" ] && mkdir -p /boot/custom/vbox

ln -sf /boot/custom/vbox /root/.VirtualBox

 

# Auto-created rules

THE_END_OF_SCRIPT

 

cd $TMPDIR/ && makepkg ../VirtualBox-4.0.2-unRAID.tgz

rm -rf $TMPDIR

 

 

I hope it helps.

0

Share this post


Link to post
Share on other sites

Your instructions and scripts look really great.

 

My older server running unRAID 4.7 probably does not have enough memory to run VirtualBox, and perhaps not enough to even compile it, but I'm going to give it a whirl this week when I get some time.

 

I might even try to put the basics of it into an unMENU package.  (talk about opening up a can of worms)  ;D

 

Just the ability to compile non-standard driver modules would be super.

 

Looks like I need to also add ncurses, patch and pkgtools packages to unMENU's package manager.  I'm really happy it made your task a little easier.

 

Joe L.

0

Share this post


Link to post
Share on other sites

gfjardim thats is freaking AWSOME  ;D

Joe, if you could somehow add this to unmenu, that would be beyond awsome.

 

Right, off to try this right now  :D

0

Share this post


Link to post
Share on other sites

That is indeed awesome and very promising to finally replace the dying VMWare server product line.

 

I've a question thought: is USB passthrough supported with the above installation method or it would require some additional modules?

0

Share this post


Link to post
Share on other sites

 

I might even try to put the basics of it into an unMENU package.  (talk about opening up a can of worms)  ;D

 

Just the ability to compile non-standard driver modules would be super.

 

Looks like I need to also add ncurses, patch and pkgtools packages to unMENU's package manager.  I'm really happy it made your task a little easier.

 

Joe L.

 

Thank you, Joe, your unMENU always made my life a lot easier. The headers are essential to compile new modules and/or drivers, but it requires a lot of RAM when uncompressed. In the script I extract the source to a disk, and then I link all paths, so the only RAM I need is the necessary to install the dependencies and obviously the amount needed to compile. I don't recommend using the flash drive to doing this, because of permissions mess up.

 

I've a question thought: is USB passthrough supported with the above installation method or it would require some additional modules?

It's enabled, but only USB 1.1. You have to add an extension pack to add the closed source part of VBox, including USB 2.0 and RDP support.

 

You can install extension packs using this command> vboxmanage extpack install <path to pack>

0

Share this post


Link to post
Share on other sites

Hum, built the package but end up with the following when I run it.

 

Installing package vbox-unRAID...
PACKAGE DESCRIPTION:
Executing install script for vbox-unRAID...
': No such file or directoryules/2.6.32.9-unRAID/misc/vboxdrv.ko
': No such file or directoryules/2.6.32.9-unRAID/misc/vboxnetadp.ko
': No such file or directoryules/2.6.32.9-unRAID/misc/vboxnetflt.ko
: command not foundline 5:
: command not foundline 16:
'ontrol: unrecognized option `--reload-rules
: command not foundline 19:
install/doinst.sh: line 21: syntax error near unexpected token `('
install/doinst.sh: line 21: ` ln -sf /boot/custom/vbox /root/.VirtualBox( cd opt/VirtualBox/components ; rm -rf VBoxRT.so )'

0

Share this post


Link to post
Share on other sites

Hum, built the package but end up with the following when I run it.

 

Installing package vbox-unRAID...
PACKAGE DESCRIPTION:
Executing install script for vbox-unRAID...
': No such file or directoryules/2.6.32.9-unRAID/misc/vboxdrv.ko
': No such file or directoryules/2.6.32.9-unRAID/misc/vboxnetadp.ko
': No such file or directoryules/2.6.32.9-unRAID/misc/vboxnetflt.ko
: command not foundline 5:
: command not foundline 16:
'ontrol: unrecognized option `--reload-rules
: command not foundline 19:
install/doinst.sh: line 21: syntax error near unexpected token `('
install/doinst.sh: line 21: ` ln -sf /boot/custom/vbox /root/.VirtualBox( cd opt/VirtualBox/components ; rm -rf VBoxRT.so )'

 

What is your unRAID version? What is the output of "uname -r"?

0

Share this post


Link to post
Share on other sites

Hum, thats odd, did you created the script file with unix-like end of line?

 

Note that the second script don't install VBox, only creates the package after the installation.

0

Share this post


Link to post
Share on other sites

I followed the step by step you  laid out in the first post.

I'm not exactly a Linux genius though so I probably screwed up something.

 

Couldn't get the scripts to run right either, again, Linux idiot.

Whats the deal with the "end of line" you mentioned.

0

Share this post


Link to post
Share on other sites

OK, getting further now.

 

Installing package vbox-unRAID...
PACKAGE DESCRIPTION:
Executing install script for vbox-unRAID...
insmod: error inserting '/lib/modules/2.6.32.9-unRAID/misc/vboxdrv.ko': -1 File exists
insmod: error inserting '/lib/modules/2.6.32.9-unRAID/misc/vboxnetadp.ko': -1 File exists
insmod: error inserting '/lib/modules/2.6.32.9-unRAID/misc/vboxnetflt.ko': -1 File exists
ln: creating symbolic link `/root/.VirtualBox/vbox': Operation not permitted

0

Share this post


Link to post
Share on other sites

The first three errors are caused by already installed modules. The fourth is caused by an already created symlink.

 

If you reboot your unRAID now and then install the package, you should not receive these errors again, because they are probably caused by installing the package for the second time.

0

Share this post


Link to post
Share on other sites

Hey, wow...this really looks like a winner!

Nicely done and well specified.

 

...now I know on what to spend my time for the next weekend ;-)

 

Is there a way to change the kernel config to produce the VIRTIO set of drivers and package them as well?

I gather that VMs would greatly benefit from it....VBox supports at least the virtio.net driver.

 

VBox can be managed from command line, but there is a very nice GUI that runs in php, named phpvirtualbox: http://code.google.com/p/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.

 

You do not need to install that on the unraid host...a VM will do

(However you'll need to install this VM manually via console)

It is not too hard to produce a VM that can then be imported by VBox.

A minimal debian or ubuntu server install + XAMPP should do and is quite straightforward to make.

I'd volunteer to produce it but I do not know where to host the image.

0

Share this post


Link to post
Share on other sites

The first three errors are caused by already installed modules. The fourth is caused by an already created symlink.

 

If you reboot your unRAID now and then install the package, you should not receive these errors again, because they are probably caused by installing the package for the second time.

 

God I'm an idiot.

I rolled my test box back and behold, it now works.

Thanks gfjardim.

 

Still cant get this blasted webgui to work though.

0

Share this post


Link to post
Share on other sites

The easiest way to run phpvirtualbox is to install unRAID-Web package from unMENU and then, in the "Personal Webserver Setup" menu, choose the path of the extracted phpvirtualbox files, pick a non-used port, save the configuration and restart the webserver.

 

You need to set the authentication mode of Vbox webserver to null:

VBoxManage setproperty websrvauthlibrary null

 

And you will need to launch the vboxwebserver:

vboxwebsrv -b -H <ip of unRAID> --logfile /dev/null >/dev/null

0

Share this post


Link to post
Share on other sites

This is very intriguing!  Thank you for the detailed guide and I love that it can be done without a Dev system - that's a huge plus.

 

Question to Virtualbox users - How does the speed/performance compare to VMware Server 2.0?  My biggest issue with VMware is a perceived lack of speed or sluggishness at times.  I may have to give this a shot and compare it myself.

 

Joe L. if you can get an all-in-one installer going through unMenu that would be fantastic!  I see a lot more people using unRAID with an easy to use VM feature.

 

0

Share this post


Link to post
Share on other sites

Another thank you to gfjardim and to Joe for possibly trying to make this into unMenu. 

 

Both efforts are very much appreciated.

 

 

0

Share this post


Link to post
Share on other sites

 

Question to Virtualbox users - How does the speed/performance compare to VMware Server 2.0?  My biggest issue with VMware is a perceived lack of speed or sluggishness at times.  I may have to give this a shot and compare it myself.

 

 

Here I get, with Windows 7:

4.5 points on RAM (DDR3 1333);

4.6 points on CPU (Athlon II 245);

6.7 points on HDD (7200RPM cache disk);

 

The down side is USB performance, here I get 400K/s with a WD My Passport.

0

Share this post


Link to post
Share on other sites

Well, im currently installing xp on vbox.

Kinda funny as its running under a windows vbox session of unRAID  :D

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

Copyright © 2005-2017 Lime Technology, Inc. unRAID® is a registered trademark of Lime Technology, Inc.