I would like to make a custom DVD that I can attach to cloud VMs for services like Vultr that don’t have custom root disk support.
This DVD should be an auto-installer but also a rescue system.
I’m thinking it would do these things on boot:
- If any of the following steps fail, send a message and wait
- check that /dev/vda exists
- format it if necessary
- mount it
- if it has ssh host keys, copy them
- run sshd
- copy the keys to the disk if it didn’t have them
- install a minimal nixos system if there’s none
- wait a second or two
- wait until there are no SSH sessions running
- kexec into the system
This means that if the DVD is attached, it will ensure that there’s a NixOS system on the root for further installation with nixops/morph or it will allow rescueing a system that won’t boot.
- how to safely detect a disk that isn’t formatted? The first MB is all 0?
- is it easy to kexec a nixos system?
- is this way too complex and I should do things in a different way instead?