nixos/qemu-vm: fix diskless VMs (round 2)#233847
nixos/qemu-vm: fix diskless VMs (round 2)#233847RaitoBezarius wants to merge 1 commit intoNixOS:masterfrom
Conversation
This reverts commit 5674901.
alyssais
left a comment
There was a problem hiding this comment.
This breaks virtualisation.mountHostNixStore:
nixosTest {
name = "test";
nodes.machine = {
virtualisation.mountHostNixStore = false;
};
testScript = "";
}error: dynamic attribute '"/nix/store"' already defined at /home/qyliss/src/nixpkgs/nixos/modules/virtualisation/qemu-vm.nix:1099:9
at /home/qyliss/src/nixpkgs/nixos/modules/virtualisation/qemu-vm.nix:1089:9:
1088| };
1089| "/nix/${if cfg.writableStore then ".ro-store" else "store"}" = lib.mkIf cfg.useNixStoreImage {
| ^
1090| device = "${lookupDriveDeviceName "nix-store" cfg.qemu.drives}";
(use '--show-trace' to show detailed location information)
|
More and more, I feel like we should leverage filesystem labels to identify devices instead of relying on |
For VM tests, we could use the PCI location of the disk, because QEMU lets us set that. |
|
Or we could do like #233350 and rename all of them via udev. :) |
7ec6bd0 to
3e5e088
Compare
This is now fixed via "let's not do that overlay cleanup now" because it's not the root cause of the revert which is unrelated to the contents of that PR. |
|
Pushing e6e049b to evaluate a baseline for this PR. |
alyssais
left a comment
There was a problem hiding this comment.
Looks good, but this absolutely must be verified not to cause any test regressions on Hydra when compared to its base.
|
Pushed 3e5e088 to https://hydra.nixos.org/jobset/nixos/python-test-refactoring ; it should appear there in ~ 45 minutes. |
|
This is failing for the exact same reasons as before |
|
So what's the way forward here? If we reintroduce the reverted changes, won't it be a channel blocker again? |
I am working towards a solution to make it safe. :) |
|
Can this be closed now? #236656 should've fixed it. On a separate note, we should probably add a test for diskless VMs down the road. |
|
Can you confirm it fixed it please? I'm away from laptop, if so, close it,
no problem :)
Le mar. 20 juin 2023 à 23:26, nikstur ***@***.***> a écrit :
… Can this be closed now? #236656
<#236656> should've fixed it.
On a separate note, we should probably add a test for diskless VMs down
the road.
—
Reply to this email directly, view it on GitHub
<#233847 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACMZRCG3UFDGFKP2XIZEMLXMIIR5ANCNFSM6AAAAAAYNTNCTU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
This should prove that diskless VMs with a volatile root work now: #238848 |
|
This can be closed now after #238848 has been merged (which proves that diskless images work). Please also note that #240175 is not relevant here because the systemd initrd never worked with a volatile root. I checked that even when the option to run a diskless VM was first introduced in this commit bf41254 it doesn't work with he systemd initrd. |
Description of changes
This is a revert of #230386 and reintroduction of #228047.
I spent all the day debugging this with symbols and shit. This is a Nix bug,
renameat2is called with the wrong arguments and causes a XDEV error, if you patch Nix with:You can discover that the problem is that you never had
kbd.devin your closure and no bootstrap seeds stuff, so you cannot rebootstrap everything. :)So while it's useful to perform the cleanup I am doing, I will remove this and reintroduce diskless VMs without them for now.
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Original thoughts
Now I have more time to deal with the cross-device link issues that arised.
Context:
Cross-device link errors are: Hard links performed across different "filesystems" or "mountpoints".
Source of "different filesystems":
/nix/.ro-storeand/nix/.rw-store. That's already 2 different filesystems and mountpoints./nix/storevia overlayfs (again another filesystem) viapostDeviceCommand, but, an installation CD-DVD profile, will do it too! viamkImageMediaOverridein its filesystem entries.boot.readOnlyNixStore = true;, we bind mount/nix/storeon/nix/storeAs you can see, we have multiple threats from multiple angles.~~~