47 lines
1.7 KiB
Diff
47 lines
1.7 KiB
Diff
From 0d466cb25e86ab6f7f6838d35afb37b99f83e0e4 Mon Sep 17 00:00:00 2001
|
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
Date: Wed, 16 Apr 2025 10:13:52 +0100
|
|
Subject: [PATCH] daemon: inspect: Resolve Ubuntu 22+ /dev/disk/by-uuid/ in
|
|
fstab
|
|
|
|
Ubuntu 22= uses /dev/disk/by-uuid/ followed by a filesystem UUID in
|
|
fstab entries. Resolve these to mountables.
|
|
|
|
A typical fstab entry looks like this:
|
|
|
|
# /boot was on /dev/vda2 during curtin installation
|
|
/dev/disk/by-uuid/b4e56462-5a64-4272-b76d-f5e58bd8f128 /boot ext4 defaults 0 1
|
|
|
|
The comment is generated by the installer and appears in the fstab.
|
|
This entry would be translated to /dev/sda2.
|
|
|
|
(cherry picked from commit 7a1ffd744b12c4c79fa1b78341ea714d831f4205)
|
|
---
|
|
daemon/inspect_fs_unix_fstab.ml | 13 +++++++++++++
|
|
1 file changed, 13 insertions(+)
|
|
|
|
diff --git a/daemon/inspect_fs_unix_fstab.ml b/daemon/inspect_fs_unix_fstab.ml
|
|
index f5817a31..45c62175 100644
|
|
--- a/daemon/inspect_fs_unix_fstab.ml
|
|
+++ b/daemon/inspect_fs_unix_fstab.ml
|
|
@@ -394,6 +394,19 @@ and resolve_fstab_device spec md_map os_type =
|
|
resolve_diskbyid part default
|
|
)
|
|
|
|
+ (* Ubuntu 22+ uses /dev/disk/by-uuid/ followed by a UUID. *)
|
|
+ else if String.is_prefix spec "/dev/disk/by-uuid/" then (
|
|
+ debug_matching "diskbyuuid";
|
|
+ let uuid = String.sub spec 18 (String.length spec - 18) in
|
|
+ try
|
|
+ (* Try a filesystem UUID. Unclear if this could be a partition UUID
|
|
+ * as well, but in the Ubuntu guest I tried it was an fs UUID XXX.
|
|
+ *)
|
|
+ Mountable.of_device (Findfs.findfs_uuid uuid)
|
|
+ with
|
|
+ Failure _ -> default
|
|
+ )
|
|
+
|
|
else if PCRE.matches re_freebsd_gpt spec then (
|
|
debug_matching "FreeBSD GPT";
|
|
(* group 1 (type) is not used *)
|