Making VirtualBox Guest Addition for Fatdog
It is specific to Fatdog64 and requires you to know the terms like SFS, devx, kernel-source, load the sfs, sandbox, etc which is explained elsewhere.
This articule is written for Fatdog64 700 but with minor tweaks should be applicable to other versions of Fatdog that supports similar commands and features.
Skip directly to the steps.
VirtualBox is a very well designed, versatile, likeable, desktop-class virtualisation solution. It is multi-platform (Windows, Mac, Linux of various brands, and Solaris). What's not to like? It is open-source; the entire source code are available under GPLv2 license. It also comes with proprietary drivers for things like USB and RDP access; but these drivers are free (as in beer) for personal use only; and their definition of personal use is rather unique and broader than what you think it is.
It has a very long history, initially offered by its developers through and independent company called Innotek, it was acquired by Sun Microsystem and thus now belongs to Oracle after Sun was absorbed by Oracle. Unlike many of other products, however, VirtualBox continues to flourish and stays independently open, and apart from relative slowness of its development (which I don't mind because for me, it is already feature-complete), the offering - both the product and licensing - remains effectively identical since the day I tried its version 1.x.
The latest Fatdog64 (700 as of this time of writing) plays very well with VirtualBox (4.3.26 as of this time of writing), both as a host and as a guest.
- As a host, installing is easy - get the 64-bit "All distribution"
tarball, and just run it - (with devx and it will install to reasonable location and
it will update the init script as necessary.
- As a guest, Fatdog is immediately usable, booting directly to desktop with mouse integration.
When run as a guest operating system, some features, however, needs the VirtualBox guest additions software to be installed. There are many ways of doing it; the one on this article helps you to make re-distributable package that you can use on many guest installations.
The standard true-and-tested method to install the Guest additions is as follows:
- Get the kernel source and devx SFS into the guest.
- Load both devx and kernel SFS.
- From VirtualBox Manager, load the Guest Addition CD image.
- Then from inside the guest, mount the disc, and launch
VBoxLinuxAdditions.runinside the mounted disc.
- Wait and cross your finger that everything goes smoothly, and if necessary adjust some of the paths after the installation is complete.
It works, but there are two minor problems:
- Loading the devx and kernel source SFS to the guest OS is not easy
(especially since folder sharing etc does not work yet - folder
sharing requires guest addition software to be up and running).
- The resulting installation is only applicable to *that* guest. You will need to repeat the same procedure if you want to enable guest addition on other virtual machine.
Can we do better? Yes. The benefits first:
- You are doing this on the host, so you have full access to host's tools.
- Yet, the host is not affected by this process.
- The guest does not need to be running.
- The end result is a package (either installable TXZ package or SFS) that can be used over and over for many guest installs.
Interested? Read on.
How is it done?
- Load devx and kernel source on the host.
- Extract contents of
VBoxLinuxAdditions.runon the host.
- Run the installer from the extracted contents of
- Collect the files from the sandbox copy-on-write layer and update/modify the paths as necessary.
- Package it with
The actual steps
- Make sure you have devx and kernel source loaded on the host.
Oh, and you also need VirtualBox itself installed. You don't
actually need it, but the installation provides you with a copy of
the Guest Addition CD image that you need.
- Mount the Guest Addition iso image
- Make a temporary directory in /tmp, then
cdto it (It has to be somewhere in /tmp, since we want to access it from sandbox later)
mkdir -p /tmp/xxx cd /tmp/xxx
- Extract the contents
VBoxLinuxAdditions.runfrom the mounted ISO image, storing it in our temporary directory.
sh /mnt/+opt+VirtualBox+additions+VBoxGuestAdditions+iso/VBoxLinuxAdditions.run --noexec --keep
installdirectory inside your working directory (of
- We are done with the Guest Addition iso image, so un-mount it (same
command as when you mounted it).
- Launch sandbox-lxc, and enable "desktop emulation".
sandbox-lxc.shNote: You must use sandbox-lxc, not the standard sandbox. The installation process does something funny to the host OS, which cannot be prevented by the normal sandbox, thus sandbox-lxc is required.
Also, you need to enable "desktop emulation". Not that we are going to use it, but doing that will share
/tmpfrom the parent so we can access the Guest Addition files we have just extracted above.
- Now, inside the sandbox, run the installed and be patient and
wait until it finishes. It will attempt to start some services
and they will fail - worry not, what we need are the installation
files, not trying to run the actual guest services in our host
cd /tmp/xxx/install sh install.sh
- Open another terminal. Do not EXIT or terminate the sandbox, keep
it up and running until instructed to do otherwise.
Now, in this newly opened terminal, type these commands. You don't have to type the comments, of couse - they are there so that you know what the commands are doing.
# collect the newly created files from sandbox cow layer to /tmp/vboxadd sb2dir.sh vboxadd # remove unneeded cruft cd /tmp/vboxadd rm -rf dev var rm -r etc/xdg/autostart rm etc/rc.d/rc.local rm etc/* find lib ! -name '*.ko' -delete rm -f sbin/poweroff sbin/reboot # correct paths, create proper Fatdog startup script mv etc/rc.d etc/init.d mkdir etc/xdg/Startup cat << "EOF" > etc/xdg/Startup/vboxclient #!/bin/sh VBoxClient-all EOF chmod +x etc/xdg/Startup/vboxclientIf you make a mistake, delete /tmp/vboxadd and re-do this step again. You can do this as often as needed - as long the sandbox-lxc process remains open.
- Once you have completed the previous step, you know have a nicely
set of files in
/tmp/vboxaddwhich is good for making a installation package, or an SFS.
To make an installable package:
# from within /tmp/vboxadd makepkg -c n -l n /root/vbox-additions-4.3.26-x86_64-1.txz
To make an SFS:
cd /tmp mksquashfs vboxadd /root/vbox-additions-4.3.26.sfsChange 4.3.26 to VirtualBox version you are using.
/tmp/vboxaddwhen you are done.
- We are done. Now shutdown the sandbox-lxc by typing in its terminal
poweroff. It will ask for your confirmation whether you really want to power off, and just click yes. Only the sandbox will be powered off, not the entire system. (If you use the regular sandbox, it will power down the entire system - so don't do this in a regular sandbox).
- Once the sandbox-lxc is shutdown, you can remove
That's all there is to it.