astro / microvm.nix

NixOS MicroVMs
https://astro.github.io/microvm.nix/
MIT License
1.24k stars 93 forks source link

Issue mounting shares in sysroot #234

Closed IogaMaster closed 4 months ago

IogaMaster commented 4 months ago

When defining shares in microvm.shares, the sysroot in the systemd initrd fails to mount them.

    microvm = {

      shares = [
        {
          # Without sharing the hosts /nix/store, the images will be MASSIVE.
          tag = "ro-store";
          source = "/nix/store";
          mountPoint = "/nix/.ro-store";
        }
      ];
    };

Then the ro-store mount fails. Causing the system to be unbootable.

astro commented 4 months ago

Which hypervisor? Do you run it in a systemd unit? The share's proto is the default "9p"?

IogaMaster commented 4 months ago

cloud-hypervisor, it also failed with virtiofs proto.

astro commented 4 months ago

cloud-hypervisor supports only virtiofs but not 9p. virtiofs requires a separate daemon which is started by a systemd unit. If the microvm is run interactively, the daemon needs to be running.

Does that help you?

IogaMaster commented 4 months ago

Is there a way to start the virtiofs daemon from the systemd initrd? As I am doing fully declarative vms

IogaMaster commented 4 months ago

I will use qemu if i have to, however in my testing cloud-hypervisor is significantly faster. Even over firecracker

IogaMaster commented 4 months ago

Okay, it appears that I am not very smart, or careful in my reading lol. I was using the microvm guest module on the host, assuming that it was like a default module that other projects use. After removing these issues are no longer present.