Building Virtualbox 6.1.22 from tarball

13 June 2021
With Slackware 15 now in beta I decided that I would install it on my professional workstation in preference to Slackware 14.2, but long story short in order to get Virtualbox working it needs to be built from the latest up-stream source tarball release. Pending the official Slackware 15 release I am able to tolerate a few loose threads and some outright breakages but having Virtualbox running was non-negotiable. These are some notes from getting it built and installed on Slackware-current.

Installing dependencies

The Slackware 14.2 SlackBuild script for Makeself will happily build on Slackware-current. However the Acpica SlackBuild uses an older version of the upstream tarball that won't compile with the stricter checks that newer versions of GCC do, so a newer version of the former needs to be built manually. If the program need to go somewhere other than the default /usr/bin then the $PREFIX installation path in generate/unix/Makefile.config needs to be changed manually.

tar -tjvf acpica-unix-20210604.tar_0.gz cd acpica-unix-20210604/ make -j 12 make install

Building & installing Virtualbox

The Python & Java bindings as well as the documentation causes build failures, but since they are not required they can be disabled by passing the appropraie parameters to the configuration script as shown below. Note that this is not a true autoconf script, so typical parameters such as --prefix do not work.

tar -tjvf VirtualBox-6.1.22.tar.bz2 cd VirtualBox-6.1.22 ./configure --disable-python --disable-docs --disable-java

The recomendation is for production builds to be hardened, which means that binary paths become hardcoded into Virtualbox itself. For /opt/virtualbox create a file with the following content and save it as LocalConfig.kmk:

VBOX_WITH_TESTCASES := VBOX_WITH_VALIDATIONKIT := VBOX_WITH_ORIGIN := VBOX_DOCBOOK_WITH_LATEX := 1 KBUILD_MSG_STYLE := brief VBOX_PATH_APP_PRIVATE_ARCH := /opt/virtualbox/lib VBOX_PATH_SHARED_LIBS := $(VBOX_PATH_APP_PRIVATE_ARCH) VBOX_WITH_RUNPATH := $(VBOX_PATH_APP_PRIVATE_ARCH) VBOX_PATH_APP_PRIVATE := /opt/virtualbox/share VBOX_PATH_APP_DOCS = $(VBOX_PATH_PACKAGE_DOCS) VBOX_WITH_VBOX_IMG := 1

Virtualbox can then be built:

source env.sh kmk all

If this is successful the next step is to build and install the Virtualbox host kernel drivers:

cd ./out/linux.amd64/release/bin/src make make install

Finally, the files need to be copied into /opt/virtualbox which the snippet below will do. It is assumed that it is only distribution packagers who would ever do this, so a little effort is needed to seperare everything out.

cd .. mkdir /opt/virtualbox/ mkdir /opt/virtualbox/lib mkdir /opt/virtualbox/share rm -r src sdk dtrace testcase nls mv UnattendedTemplates icons /opt/virtualbox/share mv * /opt/virtualbox/lib

Running virtualbox

There is a script that I think sets everything such as current user's membership of the vboxusers, but a little care is needed as Slackware typically does not include system utilities in the standard search path:

PATH=$PATH:/usr/sbin ./loadall.sh

You might also need to manually modprobe the Virtualbox host kernel drivers, which can be done using the following script. I am sure one of the scripts within Virtualbox also does this, but I did not go digging through them.

#!/bin/bash for i in vboxdrv vboxnetadp vboxnetflt; do echo "Modprobe ${i}.." /sbin/modprobe $i; done

There might also be a vboxpci module that needs modprobing, and you might also have to set more liberal permissions on /dev/vbox*. If everything goes to plan the Virtualbox user interface can be started:

/opt/virtualbox/lib/VirtualBox

Guest additions

The source for the guest additions kernel modules for things like access to the host filesystem seem to end up under /opt/virtualbox/lib/additions/src, but there is more to geting it to work than copying it to a guest and doing a make && make install. It is easier to just grab the pre-built additions ISO since this in itself is a source-based software package.