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

Jeremy Kerr jk at ozlabs.org
Mon Oct 4 20:27:32 AEDT 2021


Hi Lulu,

> > According to your requirements above, in this case it sounds like
> > you want to the following to happen:
> > 1) sda: shows a boot option
> > 2) sda1: is a duplicate of sda, skipped, no message displayed
> > 3) sdc: duplicate of sda, skipped, message is displayed
> > 4) sdc1: duplicate of sda, skipped, no message displayed
> 
> Yes this is exactly what I want to achieve.

Ok, but you say below:

> > If no policy is obvious, then you may even want to do something
> > like warning *once* when we see a duplicate UUID as the first-
> > discovered device, no matter how many duplicates you see. Would
> > that suit your intended UX?
> 
> Yes this is exactly what i expected.

- this is different from the case above, so they can't be both what you
want?

The first option is that you generate a message for each *device* that
holds a duplicate option, but do not generate a message where the
duplicate is on a partition of a device already discovered.

The second option is that you generate one message if a duplicate is
found, and no further messages.

So, to match the list above, the second option would give you:

 1) sda: shows a boot option
 2) sda1: is a duplicate of sda, skipped, message is displayed
 3) sdc: is a duplicate of sda, skipped, no message displayed
 4) sdc1: is a duplicate of sda, skipped, no message displayed

The difficulty is that the first option requires us to track the devices
that we have seen with a duplicate UUID (sdc in your example), so that
we can then suppress further messages for any partitions that may be on
that device. At the moment, we just skip all duplicates, so do not track
that information.

So, if you want the first option, we will need to not skip those
duplicates, but instead implement some kind of duplicate tracking.

Keep in mind that we absolutely *cannot* allow normal discovery to
proceed for a device with a duplicate UUID - there are a lot of
assumptions that require UUIDs to represent a unique device, both in
petitboot and the bootloader configurations that petitboot reads.

So, my question was whether the second option is acceptable, as it'll be
considerably less code to implement.

> > If so, you could just add a 'dup_warn' boolean on struct
> > discover_device, and only generate the warning if you haven't done
> > so already.
> 
> I thought about it before, but I didn't find a condition to reset
> this boolean. I will try again, thank you for your suggestion.

You would never clear the boolean. Once we have generated a warning
about seeing a duplicate of a device, we do not generate any further
warnings about that same UUID.

> > Somewhat unlreated, but can you see why you're getting three events
> > for sdc? That's probably not helping with multiple log outputs in
> > the UI.
> 
> When the petitboot list has mounted the USB device (the USB has been
> plugged into the machine), this will happen when using virtual media
> to mount the same iso file; but on the contrary, only sdc and sdc1
> will be displayed.
> I have seen this phenomenon on two platforms: Mihawk and Mowgli

Yes, I understand there will be duplicates if you connect the same
filesytstem both locally and via virtual media. However, seeing the same
device (sdc in your logs) appear in three separate udev events is
unusual - we might want to investigate that.

Regards,


Jeremy



More information about the Petitboot mailing list