Skip to content

Instantly share code, notes, and snippets.

@PaulFurtado
Created October 21, 2014 02:17
Show Gist options
  • Save PaulFurtado/cd94b7292137c265eead to your computer and use it in GitHub Desktop.
Save PaulFurtado/cd94b7292137c265eead to your computer and use it in GitHub Desktop.
Script to run arch with any kernel version in DigitalOcean
#!/bin/sh
# Digital Ocean stores the arch kernel outside of the VM's disk and the hypervisor boots the
# kernel directly. This hack allows you to boot any arch kernel version by using kexec to
# basically turn the DO-provided kernel into a bootloader.
#
# By default, the DO kernel is started with /sbin/init as its command line and /sbin/init
# is a symlink to /usr/lib/systemd/systemd. By replacing /sbin/init with this shell script
# which calls kexec, we can boot a kernel on the VM's disk.
kexec --load /boot/vmlinuz-linux --initrd=/boot/initramfs-linux.img --append="root=LABEL=DOROOT init=/usr/lib/systemd/systemd" &&
mount -o ro,remount / &&
kexec -e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment