Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot boot VM with writableStoreOverlay + shares #43

Open
kraftnix opened this issue Jun 10, 2022 · 3 comments
Open

cannot boot VM with writableStoreOverlay + shares #43

kraftnix opened this issue Jun 10, 2022 · 3 comments

Comments

@kraftnix
Copy link

I am unable to use a writable store when using shares, the documentation states that the path at microvm.writableStoreOverlay must be writable, and #20 mentions that this should work with a writabe overlay on share.

I can get a writable store using microvm.volumes, i.e.

{ config, ... }:
{
  microvm.writableStoreOverlay = "/nix/.rw-store";
  microvm.volumes = [{
    mountPoint = config.microvm.writableStoreOverlay;
    image = "store.img";
    size = 2000;
  }];
}

however trying to use a share instead with something like:

{ config, ... }:
{
  microvm.writableStoreOverlay = "/nix/.rw-store";
  microvm.shares = [
    {
      source = "/tmp/test-writable-store";
      mountPoint = config.microvm.writableStoreOverlay;
      tag = "rw-store";
      proto = "virtiofs";
      socket = "nix-store-rw.sock";
    }
  ];
}

results in a VM which does not boot, stating that the upper fs is missing required features.

mounting overlay filesystem on /nix/store...
[    0.324712] overlayfs: upper fs missing required features.
mount: mounting overlay on /mnt-root/nix/store failed: Invalid argument

This was tested with cloud-hypervisor specifically.

I couldn't find a test or example which shows this usecase, is this meant to be supported or am I doing something wrong?

@astro
Copy link
Owner

astro commented Jun 12, 2022

Apologies, I only tested this feature with volumes. Do they work for you?

Alternatively, is there anything we could do about it in our custom stage-1?

I will update the docs to reflect the current situation.

astro added a commit that referenced this issue Jun 12, 2022
@kraftnix
Copy link
Author

Yes, volumes work fine with the writableStoreOverlay. I am not 100% sure whether it will be possible to support the writable overlay on virtiofsd shares, I ran into similar errors when I was attempting to run docker with it's overlayfs image driver on top of a virtiofsd share within an nspawn container before, I never found a fix except just not using virtiofsd, and instead sharing a block device/img (as done here with volumes).

I might have another go at it later, but for now volumes does support my use case, thanks for updating the docs to reflect that!

note: I may be misremembering not finding a fix for the situation, I believe I have a stale branch somewhere that passed in custom options to virtiofsd-rs that may allow overlayfs to work.

@kraftnix
Copy link
Author

kraftnix commented Jun 13, 2022

So I looked at my old notes where I encountered the issue before and did some testing based on other similar/reported issues with overlayfs on virtiofs, however I couldn't get overlayfs to mount the writable store overlay even after trying different mount options within stage-1.

Some suggestions pointed to using fuse-overlayfs instead, and it managed to mount (with no errors), however there seems to be an error somewhere in stage-2, since the store seems to be mounted (I ran a cat on the init script successfully).

mounting overlay filesystem on /nix/store...
cat /mnt-root//nix/store/gq2ljfy7gckln3mi4czi2s38x2bl825c-nixos-system-dev-test-22.11.20220609.46b9f39/init
<... removed ...>
stage 2 init script (/mnt-root//nix/store/gq2ljfy7gckln3mi4czi2s38x2bl825c-nixos-system-dev-test-22.11.20220609.46b9f39/init) not found

I have tried with quite a few combinations of virtiofs, overlayfs and fuse-overlayfs and fuse-overlayfs seems to get closest (at a great performance cost) and I couldn't quite get it working.

Thinking about it I cannot actually see a use case where we would need a full writable share instead of a volume, so if it is too complex it may be not be worth supporting, at least volumes will fit my use case for development machines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants