Forum archive
TKLPatch for VirtualBox headless (?)
Update: Revision R with PAE enabled attached. Patch is for phpvirtualbox 4.0-4b: This version includes an excellent authentication mechanism. With this revision done, there is no more need for the default password. Really butchered some python I'm afraid - see the damage in inithooks. Sorry Alon!
As of revision R, phpvirtualbox includes authentication. Until I figure it out, the default username and password are admin.
ISOs derived from the patch are available at http://9while9.com.
Thanks to the kind dev of phpvirtualbox, Ian Moore, conf now pulls the latest revision of phpvirtualbox. Created Apache configuration for phpvirtualbox (rather than modifying default) and it's now enabled by conf. There's still work to do. But now, /etc/init.d/vboxdrv setup happens post install, after security updates. Download and install of Extension Pack is offered as a choice, post install, post security updates (my first dialog box...I learn stuff). I have added samba, webmin-samba, and have, I think, fully configured a share for at /var/virtualbox/import. So if I understand licensing at all, I think the ISO produced by the patch can be distributed since the installation of the element with the restristive license, extension pack, has been removed and is downloaded based on the user's decision.
I wanted to experiment with my team with what VirtualBox had to offer headlessly. To install to bare metal, I needed an install medium that wouldn't take up a lot of real estate. Core 11.0 to the rescue. (The marks the first I started to feel invested in 64-bit appliances from TKL, btw.)
So we needed an ISO to burn that would take care of Lucid for us and install VirtualBox 4.0 along the way (yes, both ashamed and dirty).
I prolly shouldn't even post this...because, it doesn't use open-source edition of VirtualBox. Part of our experiment was whether VRDP (VRDE now?) can do better for us than VNC with ESXi infrastructure has been doing (so OSE wasn't an option for us).
So, attached is a TKLPatch for VirtualBox 4.0. We haven't gotten far into the experiment
In any event, if there's feedback, I'd love to hear it. If this gets scrubbed since VB isn't open source, I completely understand. But if anyone finds it helpful as we have, the post was worth it.
Here's a screenshot of phpvirtualbox from the dev's page:

Update: Thanks Liraz! I've included authenication, through Apache, to protect phpvirtualbox from potential abuse.
Overlay and Explanation:
overlay/etc/apache2/sites-available - Modified default to include authentication suggestions between <Directory /> tags.
overlay/etc/confconsole/services.txt - A list of services at startup. Actually, you can access the phpvirtualbox interface through http://$ipaddr/vb, virtualbox, or phpvirtualbox.
overlay/usr/local/bin/install_ext - install VirtualBox extension in case it didn't take on first boot
overlay/usr/lib/inithooks/firstboot.d/32virtualboxpass - calls script for setting user virtualbox password
overlay/usr/lib/inithooks/firstboot.d/32InstallExtPack: calls script to setup /etc/init.d/vboxdrv
overlay/usr/lib/inithooks/firstboot.d/99sethtpass: calls script to ask for htaccess password (sloppy)
overlay/usr/lib/inithooks/bin/EnableVBExtPack.sh: sets up vboxdrv and installs VB extension pack
overlay/usr/lib/inihools/bin/SetWebPass.sh: asks for password for web access for user virtualbox
overlay/usr/lib/inithooks/bin/vboxsetpass: dialog asking for password for system user virtualbox
Here's Conf for the P-pae version:
#!/bin/bash -ex #By Rik Goldman # Set Hostname HOSTNAME=virtualbox echo "$HOSTNAME" > /etc/hostname sed -i "s|127.0.1.1 \(.*\)|127.0.1.1 $HOSTNAME|" /etc/hosts echo "deb http://download.virtualbox.org/virtualbox/debian lucid contrib" >> /etc/apt/sources.list.d/sources.list wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | apt-key add - useradd --home /var/virtualbox virtualbox #If home directory isn't created, create one now and set permissions if [ ! -d /var/virtualbox ]; then mkdir /var/virtualbox mkdir /var/virtualbox/import chown -R virtualbox:virtualbox /var/virtualbox chmod 777 /var/virtualbox/import fi apt-get update DEBIAN_FRONTEND=noninteractive apt-get -y \ -o DPkg::Options::=--force-confdef \ -o DPkg::Options::=--force-confold \ install build-essential \ dkms \ linux-generic-pae \ linux-headers-generic-pae \ apache2 \ libapache2-mod-php5 \ php5 \ virtualbox-4.0 \ webmin-apache \ dialog \ samba \ webmin-samba \ webmin-phpini #Make a request of VBoxManage so service can be setop #VboxManage list ostypes - doesn't work #Setup vboxdrv #/etc/init.d/vboxdrv setup - moved to inithook #Create vbog.cfg echo -e "VBOXWEB_USER=virtualbox" > /etc/vbox/vbox.cfg #Set vboxweb-service service update-rc.d vboxweb-service defaults #Original Way to download, place phpvirtualbox, then clean up #wget http://phpvirtualbox.googlecode.com/files/phpvirtualbox-4.0-3.zip wget `wget -q -O - http://phpvirtualbox.googlecode.com/files/LATEST.txt` -O phpvirtualbox-latest.zip unzip -n phpvirtualbox-latest.zip -d /var/www/ #rm phpvirtualbox-latest.zip #Install extpack - Moved to firstboot.d #wget http://download.virtualbox.org/virtualbox/4.0.2/Oracle_VM_VirtualBox_Extension_Pack-4.0.2-69518.vbox-extpack -O /var/virtualbox/Oracle_VM_VirtualBox_Extension_Pack-4.0.2-69518.vbox-extpack #VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.0.2-69518.vbox-extpack #rm /var/virtualbox/Oracle_VM_VirtualBox_Extension_Pack-4.0.2-69518.vbox-extpack #Soft Links to phpvirtualbox ln -s /var/www/phpvirtualbox-4.0-3 /var/www/phpvirtualbox ln -s /var/www/phpvirtualbox-4.0-3 /var/www/virtualbox ln -s /var/www/phpvirtualbox-4.0-3 /var/www/vb #Enable virtualbox site a2ensite phpvirtualbox #Stop Services /etc/init.d/apache2 stop /etc/init.d/vboxdrv stop /etc/init.d/vboxweb-service stop
I won't be able to test this on bare metal til the start of the week; aside from adding to the Twin Peaks factor in my life, creating and modifying virtual machines within a virtual machine seems to go well.
My single concern so far is that the phpVirtualBox web interface has no security [taken care of in the current revision].
To apply the patch, download the patch and follow the docs at /docs/tklpatch or our TKLPatch primer at http://9while9.com/index.php?option=com_content&view=section&id=8&Itemid=22 . It will take a while for us, but unless we're not suffering from lack of the second ESXi box, we'll be trying this out, and in turn, trying XenServer and in turn ProxMox.
This is very helpful. Thanks for taking the time, Ian. I look forward to getting an effective dialog built for firstboot over the weekend; I'll upload a revised patch as soon as it's tested and I'm confident in the result.
Thanks Ian,
Rik