You are not logged in.

#1 2022-06-12 12:14:22

steeps
Member
Registered: 2021-01-04
Posts: 8

Early libvirt/QEMU start from initramfs?

I'm currently running an Arch Linux server with a separate OPNsense router. Ideally, I'd like to move to the OPNsense installation to a libvirt-managed QEMU image on the Arch sever, as the OPNsene hardware is starting to show its age. However, my Arch installation has a LUKS-encrypted root partition, which I'm unlocking with a initramfs SSH hook (à la this article). If I were to move OPNsense over to the Arch server, then since libvirt (and therefore the DHCP server) would load after the root partition is unlocked, I wouldn't be able to SSH in, giving me a catch-22. I could just plug in a monitor and keyboard whenever I need to do a reboot, but ideally, I'd like to remain entirely headless.

Does anyone know any way of starting a VM early, or independently of the host, or do I need to resign myself to either a) maintaining two separate devices, b) unencrypting my root partition or c) sucking it up and occasionally having to plug a keyboard and monitor in?

Last edited by steeps (2022-06-12 12:21:31)

Offline

#2 2022-06-15 12:06:56

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 10,142

Re: Early libvirt/QEMU start from initramfs?

It may be possible to start the OPNsense VM using the same technique.

Apart from ensuring all necessary modules are loaded, you need to execute some commands.

For a busybox initramfs (hook udev in mkinitcpio.conf) this would be done through a custom runtime hook.
Incase you're booting to a systemd initramfs (hook systemd in mkinitcpio.conf) systemd units could be used.

I am not aware of a method that works in both setups, so consider carefully which one you want to use.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
Did you use the guided installer ? If yes, I can't help you.

(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

Board footer

Powered by FluxBB