Digital Ocean - loukoster on the market of cloud VPS providers. Uses KVM virtualization technology. Good in terms of price / quality ratio and blah blah blah, you yourself know all this.
But there are several drawbacks in it, one of which is a limitation in supported operating systems. The official position of the host is that the space on the disks in droplets (virtual machine images) can be expanded from the control panel without the need to reinstall the system, so it’s better not to install the bootloader there. In this regard, libvirt does not read the bootloader inside the image, but uses the kernel pre-installed in the control panel from the host machine.
')
They promise to make support for loading custom kernels from day to day ... for just over a year.
We will not wait and beg.
In fact, everything is simple and comes down to three simple steps:
- Create a droplet from any image.
Currently supported: Ubuntu, CentOS, Debian, Arch, Fedora - Expand the image of the desired distribution.
- We supply it with a kernel spoofing script.
Now more about penguin juggling in conditions of poor visibility.
I will show the example of Gentoo. But the approach is applicable to any other are weak, the main thing is to observe the bit depth.
Live fast die young
We deploy the droplet on Ubuntu 13.04 x64.
Downloading and unpacking the image of the new OS in / root / gentoo, since the three lines below will make it much more difficult. In my case, this is the gentoo stage. I used stage3-amd64-hardened + nomultilib-20130801.tar.bz2.
Now install mc:
apt-get install mc . We start it.
What is it for? The fact is that mc has its own set of commands for working with files and it does not use the system mv, cp, etc. This minor
dirty trick will allow us to transfer / delete directories of the working system.
So, we move (jedi delete) everything from / root / ubuntu from the root to / dev, / sys, / proc, / run, / tmp and / root.
Hooray, we killed Ubuntu.
New brains Scarecrow
Transferring everything from / root / gentoo to /
Register in / etc / network settings, host name, sshd elevation, etc. you need for a comfortable console life. Do not forget the root password.
Already, you can restart the droplet and get a working image in the stage of easy schizophrenia:
prometheus ~ # uname -a
Linux prometheus 3.8.0-19-generic #30-Ubuntu SMP Wed May 1 16:35:23 UTC 2013 x86_64 QEMU Virtual CPU version 1.0 GenuineIntel GNU/Linux
prometheus ~ # lsb_release -a
LSB Version: n/a
Distributor ID: Gentoo
Description: NAME=Gentoo
Release: n/a
Codename: n/a
We consider the second stage successfully completed.

Round 3. Fight.
Kernel substitution.
Almost a decade ago, kexec technology was implemented for this purpose. We will exploit it:
emerge sys-apps/kexec-tools; rc-update add kexec
emerge sys-apps/kexec-tools; rc-update add kexec
As usual we build, configure and drop the kernel into / boot:
emerge hardened-sources
cd /usr/src/linux; make menuconfig && make && make modules_install && make install
To make kexec find it without unnecessary gestures, create symlinks in / boot:
ln -s vmlinuz-3.10.5-hardened-gnu vmlinuz
ln -s config-3.10.5-hardened-gnu config
ln -s System.map-3.10.5-hardened-gnu System.map
Now you can try to download our new kernel:
/etc/init.d/kexec start && mount -o ro,remount / && kexec -e
or
/etc/init.d/kexec start && reboot
Let us ease our life a little more and we will load our core when the system starts. To do this, in
/etc/conf.d/kexec, set
LOAD_DURING_SHUTDOWN = "no" and put such a script in
/etc/local.d/kexec.start
prometheus ~ # uname -pronis
Linux prometheus 3.10.5-hardened-gnu QEMU Virtual CPU version 1.0 GenuineIntel GNU/Linux
Everything. More penguins are nice and cool. Thanks for attention.