How to run a custom kernel on a VPS (VC1S, etc.)


Sometime in the last year, Scaleway seems to have enabled kexec. This lets us switch to a custom kernel after booting :slight_smile:

I’ve written a few scripts for the Ubuntu 16.04 image to get this process going smoothly, automatically switching kernels immediately after boot:

As an alternative, apparently you can add KEXEC_KERNEL and KEXEC_INITRD options to the server tags, which means you won’t need kexec-tools nor the systemd services. However, you’ll still need to fix your /etc/fstab to mount root properly (rw) and also either disable the new network naming system or configure it to use DHCP properly.


You are expected to be running as root. The install scripts are written for a clean image, and might overwrite other settings.

  1. Clone this repository somewhere.

  2. Install a custom or distro-official kernel. In Ubuntu, this can be accomplished with apt install linux-generic. You are expected to end up with a /vmlinuz and /initrd.img file in the root. If it prompts you, do not install grub on any devices - leave them all unticked and press enter, then yes continue without installing grub.

  3. Install kexec. In Ubuntu, apt install kexec-tools. If it prompts you, you do not want it to handle reboots.

  4. Run This will copy some configs necessary to get prevent errors during the boot.

  5. Run uname -r and record the output. This is your old (Scaleway) kernel.

  6. Test by running systemctl kexec, which should switch into the new kernel. You will need to reconnect to SSH.

  7. Check uname -r again – you should now be in your new (custom) kernel.

  8. If the manual reboot worked, you can enable auto-switch on boot by running If it did not work, I would recommend figuring out why first so you do not get stuck in an unbootable system.

Further details are available on the linked GitHub repo.

1 Like

Come to think of it, it should be possible to modify this process and get it to boot into Windows instead, crazy as it sounds.


Just learned about the Scaleway server tags for KEXEC, which is probably a cleaner way than the post-boot scripts. But still need the fstab and udev entries to get the filesystem and network into a good state.


The ARMv8 Linux kernel does not have KEXEC, so this does not work there ;-(.


Yea, I’ve requested it but we’ll have to wait for them to enable it.

1 Like

Here are two other projects on how to run non-Scaleway kernels on Ubuntu (x86_64) and Arch (armv7l) using kexec:


You don’t actually need kexec, ARM64 (and the new x86 too) can boot any EFI OS, so you can create a GPT on /dev/vda, add an EFI partition, place a boot loader here, it will boot whatever you want. I managed to run FreeBSD :slight_smile: