VirtualBox on Scaleway

Scaleway now has a very nice x86_64 offering, where one can utilize a bare metal server with up to 32GB of ram for just €0.05 an hour. One caveat of their service is that they inject their own kernel whilst the machine boots. This means that obtaining the Linux kernel headers for the kernel to compile the Virtual Box kernel module can be a bit tricky.

At the time of writing, a script included with the servers (/usr/local/sbin/oc-sync-kernel-headers) is supposed to handle syncing the currently selected kernel’s headers to the server, however this script does not work for Scaleway’s x86_64 offerings.

To get VirtualBox working on a Scaleway box:

  1. Download and extract the Kernel Sources currently used by Scaleway. At the time of writing, this is 4.4.6:
    1. sudo su
    2. cd ~
    3. wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.4.6.tar.xz
    4. tar xvfJ linux-4.4.6.tar.xz
  2. Place current configuration file in kernel directory
    1. zcat /proc/config.gz > linux-4.4.6/.config
  3. Compile the Kernel
    1. make -j8
      1. Replace 8 with the number of cores you would like to use
  4. Compile the Virtualbox Kernel Module
    1. export KERN_DIR=/root/linux-4.4.6/
    2. /sbin/rcvboxdrv setup

Ianloic below has mentioned that some changes were made to the .config file. One that works can be downloaded here:
https://raw.githubusercontent.com/scaleway/kernel-tools/f9c1acbfd1ff240f9c3f2b6cd50c1db5b8c01304/x86_64/4.4.4-std/.config

Thanks to Davide’s contribution in the comment section below, this has since been modified to obtain the .config file from /proc:
zcat /proc/config.gz