[PATCH] discover/udev.c: Added warning in system status log

Jeremy Kerr jk at ozlabs.org
Tue Sep 28 14:36:22 AEST 2021


Hi Lulu,

> But still, I don't know why you're making the log message conditional
> on not being a prefix of the other device. From your log in the
> previous
> discussion, you end up with four devices with the same UUID; surely
> you
> want to inform the user about all of them, rather than a subset?

Thinking about this a little more, let me know if I have your
requirements correct:

 - you have a system with two storage devices connected, both containing
   the same installer image

 - petitboot is suppressing the duplicates

 - you want to display a message indicating that petitboot has skipped
   *some* of the duplicates. Specifically, those duplicates that exist
   on the separate devices, but *not* the duplicates that exist as part
   of the partition layout that a single device is presenting.

Is that what you're trying to do here?

If that's the case, then the conditional that you've proposed makes
sense, but using the device names (to establish whether the devices are
on the same underlying media) doesn't seem like a reliable method of
doing this - the names are fairly arbitrary.

Instead, if you do want to do that, I'd suggest looking at the udev
properties of the device. Two options here:

 - the ID_PATH properties of the two partitions will be the same on
   sda/sda1 in your examples

 - the DEVPATH property of the sda device will be a substring of the
   DEVPATH for the sda1 device.

This way, you're not relying on the "sda" -> "sda1" matching, which is
specific to the drivers' naming scheme.

[that's mainly why I'd suggested making the log message unconditional -
the duplicate matching isn't as straightforward as you're proposing
here. If it's not a problem that you generate 3 log messages instead of
1, then that may be a simpler approach]

Cheers,


Jeremy



More information about the Petitboot mailing list