The Hyperpessimist

The grandest failure.

Installing CoreOS

So, I wanted to set up a server. In the olden times, I used a Virtuozzo VPS at which I ended up being so annoyed that I switched to a dedicated server running first Xen, then KVM and multiple VMs. Now, this setup was always quite the pain, so I decided to try again with a VPS. Upside: backups aren’t my problem anymore. Also, I don’t want to build elaborate configurations that I have to administer, this time I want to keep it simple, so that a reinstall takes maybe 2 hours instead of weeks.

This time I went for netcup, because they provide virtual servers running on KVM. Why KVM? Because I want to use Docker and it will probably run a lot better if I use a recent kernel rather than some Virtuozzo/OpenVZ shared kernel. When I first got that server, it was running all kinds of stuff (MySQL, Postfix, ProFTPd, srsly?), so this had to go.

Now remember my premise, I wanted to keep the administrative overhead down (aka zero), so I was thinking about some OS that was specifically designed to get out of the way. A few weeks ago I found CoreOS so I gave it a go.

Logged in as root, ran the coreos-install script as written in the CoreOS docs and, well, didn’t work because the system was running. Bummer, no on-the-fly replacement of the current system. So I got myself the ISO and uploaded it to netcups FTP server to use as own install media. Reboot and it boots onto CoreOS.

You can sudo su into it (netcup provides a VNC console for it), and start coreos-install -d /dev/vda -C stable. Runs and installs, but at the end complains about some GPT bullshit. You need to run parted /dev/vda and call print all at which point it will ask you whether you want to fix the partition (course you do).

Next step is rebooting, which is a challenge in and itself because netcup does not support detaching custom ISOs, so you always start into the CoreOS installer. After fiddling for like 20 minutes, I figured out you can attach an “official” ISO instead and detach that ISO and then you get to boot into your OS. I should probably report a bug to netcup.

Then your glorious new CoreOS boots up and you have no way to log in, since you don’t know the root password or anything. There are no users set up. Ooops. Back to the installer.

This time, you actually read to the end and find out that you need to add a cloud-config file, which will get executed on first boot. I wrote mine kinda like this:

1
2
3
4
5
6
7
8
9
10
11
#cloud-config

ssh_authorized_keys:
  - ssh-rsa AAAAB...

users:
  - name: marek
    groups:
      - sudo
      - docker
    coreos-ssh-import-github: Leonidas-from-XIV

Pretty self-explanatory, the ability to import SSH keys from GitHub is kinda super neat. So, next up coreos-install -d /dev/vda -C stable -c cloud-config-file and off you go. Remember to fix up the GPT again with parted and do the stupid ISO detach dance that netcup forces you into, but there you go.

Afterwards, CoreOS boots fine, resizes itself to fill the whole partition and allows you to log in. Will probably post more adventures in CoreOS and Dockerland soon, so stay tuned (or don’t, I don’t own you).