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

Old NixOS QEMU VM disk images no longer work #249300

Open
Enzime opened this issue Aug 15, 2023 · 2 comments
Open

Old NixOS QEMU VM disk images no longer work #249300

Enzime opened this issue Aug 15, 2023 · 2 comments
Labels
0.kind: regression Something that worked before working no longer

Comments

@Enzime
Copy link
Member

Enzime commented Aug 15, 2023

Describe the bug

When my darwin.linux-builder stopped working, I realized that pre-#236656 NixOS disk images no longer work, showing an error like:

starting device mapper and LVM...
waiting for device /dev/disk/by-label/nixos to appear.......................
Timed out waiting for device /dev/disk/by-label/nixos, trying to mount anyway.
mounting /dev/disk/by-label/nixos on /...
[   21.840445] /dev/disk/by-label/nixos: Can't open blockdev
mount: mounting /dev/disk/by-label/nixos on /mnt-root/ failed: No such file or directory

An error occurred in stage 1 of the boot process, which must mount the
root filesystem on `/mnt-root' and then start stage 2.  Press one
of the following keys:

  r) to reboot immediately
  *) to ignore the error and continue

As we can't drop into a shell here, we can't manually mount the root partition which means we are unable to use our old disk image.

The main breaking change in that PR is that the rootfs needs to be labelled as nixos.

You can migrate your VM disk images manually by using the old VM run script, then running sudo e2label /dev/vda nixos. In the case of darwin.linux-builder, the path to this script can be found in your old profiles e.g. /nix/var/nix/profiles/system-N-link/Library/LaunchDaemons/org.nixos.linux-builder.plist.

Expected behavior

It would be nice if there was an automated migration as most, if not all, disk images are going to be ext4, so it should be possible to use the old logic to find the rootfs and use e2label to change its label. Alternatively, a manual migration script which users can run on their disk images would be great too for users who want to retain the disk images after this PR.

Notify maintainers

@nikstur

@Enzime Enzime added the 0.kind: regression Something that worked before working no longer label Aug 15, 2023
@Enzime
Copy link
Member Author

Enzime commented Aug 16, 2023

The qcow2 images can be mounted locally as shown in https://gist.github.com/shamil/62935d9b456a6f9877b5 or with https://libguestfs.org/guestmount.1.html which should expose a block device that you can use with e2label

cc @emilazy

@bjornfor
Copy link
Contributor

qcow2 files can also be viewed as block devices with nbd: https://unix.stackexchange.com/questions/268460/how-to-mount-qcow2-image/598265#598265.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: regression Something that worked before working no longer
Projects
None yet
Development

No branches or pull requests

2 participants