Side by side minimal installs have identical UUIDs #9
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
(This was originally posted as an issue against the installer: https://github.com/AsahiLinux/asahi-installer/issues/265 . Reposting here at the request of marcan.)
I tried to install two copies of Fedora Asahi 39 on a single M2 Mac Mini, both minimal installs. This led to various bad outcomes, such as booting in to one of them showing the other's root filesystem mounted at /. And the boot process not completing, but leaving me at a prompt "Enter root password for maintenance", and after rebooting, "Press enter for maintenance" (That's not the exact wording of the two messages, but captures the gist; I'm writing just from memory.)
On examination, I found the two installs were using the same set of 3 filesystem UUIDs for /, /boot, and /boot/efi. I am guessing that this is the cause of the above problems. Also, I would guess the UUIDs are hard coded in the filesystem images used by the installer, and that similar problems would occur whenever doing side by side installs of the same type.
On the other hand, I have tried doing a minimal install beside a KDE install. And on another occasion, a minimal install beside a server install. Both cases seemed to be fine. When I checked the UUIDs in the minimal+server case, they were all different. I imagine this would true with any pair of different type installs, but haven't tested any further.
How bad could the consequences of this be? I don't know, but I'd worry about the possibility that someone might have had an install for some time, then decide to install another copy beside it, using the same type, and wind up losing all their data from the original install.
What could be done about this? I suppose the ideal would be to randomize the UUIDs on each install. Failing that, perhaps the installer could display a warning?
Conan-Kudo writes at https://github.com/AsahiLinux/asahi-installer/issues/265#issuecomment-2143417487:
("it" referring to randomizing the UUIDs at first boot.)
Also tune2fs -U for /boot and mlabel -N for /boot/efi. But with those, maybe it's practical to just unmount them, do the change, and remount them.
Maybe the first boot could use a special initramfs that changes the root filesystem UUID before mounting it? Seems like a fair bit of work, though. :-(
Marcan writes at https://github.com/AsahiLinux/asahi-installer/issues/265#issuecomment-2143339648:
That's nice to know, in the sense that this problem is a bit less likely to occur, and there are more workarounds. But it still leaves the side by side install as a case that sometimes works and sometimes fails in ways likely to baffle a naive user.
I think we're going to need to track getting this limitation removed from
btrfs-progsand come up with a workaround. It's probably not acceptable to not have a way to auto-rotate and fixup UUIDs on first boot.I suspect that limitation might involve the kernel (i.e. no way to tell the kernel the UUID changed for whatever purposes it uses it for while mounted) so I wouldn't hold my breath that that will be that easy to fix.
I think, if we play it right, we can probably build this functionality into the asahi-scripts dracut stuff, in a vaguely generic way that might work for other distros (opt-in though, so nobody gets caught enabling it without testing). We can do it with the filesystems unmounted there, without relying on anyone else. It's going to be finicky and subtle, but doable I think.
Marcan writes at https://github.com/AsahiLinux/asahi-installer/issues/265#issuecomment-2143339648:
I'm guessing there are two issues here?
Perhaps instead the installer could just do a global search and replace to change the common UUIDs to unique ones? This could be done to the filesystem images before or during the copy to the partitions. Or to the partitions themselves, after the copy. Both binary and text forms of the UUIDs might have to be replaced.
Since the /boot/efi serial number ("UUID") is just 32 bits, it might be worthwhile when generating the image to check that the serial number doesn't occur anywhere it shouldn't (e.g by counting the number of occurrences).
@marcan:
Yeah, a dracut module is probably the way to go, and we can structurally handle the ESP, the boot partition, and the Btrfs volume all in one go there.
This isn't feasible, besides being slow there are issues with checksums, compression, etc. You need to do it from a context with real FS drivers (hence dracut). Forget about hacks like this, they aren't going to work and are extremely ugly and brittle even if they do.
After talking to upstream, supporting online updates of the uuid is technically possible, but it's non-trivial to implement and would be operationally expensive, as the uuid is encoded in all of the metadata. For the time being we're probably better off going the dracut module route for this.