partname: Ignore root=PARTUUID...
authorBrian Norris <computersforpeace@gmail.com>
Sat, 7 Jan 2023 02:04:22 +0000 (18:04 -0800)
committerChristian Marangi <ansuelsmth@gmail.com>
Fri, 20 Jan 2023 14:02:30 +0000 (15:02 +0100)
We're assuming all root= arguments are /dev/ paths, but many targets
utilize root=PARTUUID=<xxx> strategies. At least allow them to fall back
to scanning all block devices.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
libfstools/partname.c

index f59c52eb8f3c6da0e8ee6c4080abd7cdac3db715..9c27015643ad683620aa9c44ad167616a5f56fb3 100644 (file)
@@ -128,12 +128,12 @@ static struct volume *partname_volume_find(char *name)
                        return NULL;
        }
 
-       if (get_var_from_file("/proc/cmdline", "root", rootparam, sizeof(rootparam))) {
+       if (get_var_from_file("/proc/cmdline", "root", rootparam, sizeof(rootparam)) && rootparam[0] == '/') {
                rootdev = rootdevname(rootparam);
                /* find partition on same device as rootfs */
                snprintf(ueventgstr, sizeof(ueventgstr), "%s/%s/*/uevent", block_dir_name, rootdev);
        } else {
-               /* no 'root=' kernel cmdline parameter, find on any block device */
+               /* no useful 'root=' kernel cmdline parameter, find on any block device */
                snprintf(ueventgstr, sizeof(ueventgstr), "%s/*/uevent", block_dir_name);
        }