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

Lulu_Su at wistron.com Lulu_Su at wistron.com
Tue Oct 5 13:32:29 AEDT 2021


Hi Jeremy,

> - 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.

Sorry for the confusion, thanks for the detailed explanation, the first option is what I expected.

> 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.

Thanks for your reminder. Knowing that duplicate device information will not be recorded, so I only used the device name of the mounted device and the duplicate device as a condition before, but this condition, as you said, was not fully considered.

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

For the user, when the device is mounted and displayed on the petitboot list (sda), they will not care whether the device has a partition (sda1); but when they tries to mount a new device (sdc), Due to duplicate UUID, it will not be mounted and will not be displayed any warning (although pb-discover.log has a record, but the user will not take the initiative to confirm this log), they will be confused whether the device or the system is malfunctioning.

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

udev_handle_block_add
#111	typestr = udev_device_get_devtype(dev);

What do you think about using DEVTYPE to distinguish sdc and sdc1? Only warnings are displayed on the disk because not all devices have partitions.
Although it will be displayed 3 times on my machine, it can distinguish sdc and sdc1 under normal circumstances, right?

I want to use the boolean you mentioned below, but I haven't fully understood it yet, sorry...

> 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.


> 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.

Tracking the code, it is found that the device action of the first two sdc and sdc1 is "add", and the device action of the last two sdc and sdc is "change". The debug log is still under study.

Regards,
Lulu Su


---------------------------------------------------------------------------------------------------------------------------------------------------------------
This email contains confidential or legally privileged information and is for the sole use of its intended recipient. 
Any unauthorized review, use, copying or distribution of this email or the content of this email is strictly prohibited.
If you are not the intended recipient, you may reply to the sender and should delete this e-mail immediately.
---------------------------------------------------------------------------------------------------------------------------------------------------------------



More information about the Petitboot mailing list