[systemd-devel] About a problem with GRUB2 rescue images and /dev/disk/by-label
Thomas Schmitt
scdbackup at gmx.net
Wed Nov 27 11:55:25 PST 2013
Hi,
the content of /dev/disk/by-label does not look right with
USB sticks which carry bootable ISO 9660 images produced
by GRUB2 script grub-mkrescue.
The maintainer of Debian's udev package advised me to report
the problem here:
---------------------------------------------------------------
A not mountable partition becomes link target in /dev/disk/by-label
under the name of the filesystem on the mountable parent device.
grub-mkrescue ISO images are suitable for booting from CD/DVD
and from USB stick. They begin by an MBR which marks a single
partition beginning at LBA 1. The ISO filesystem has to begin
at LBA 0, because else it would not be bootable from CD/DVD.
So the partition is not mountable, intentionally. It just protects
the ISO filesystem from partition editors and alike, but leaves
the MBR unclaimed in order to please some boot firmware.
I verified that the problem still exists in
http://cgit.freedesktop.org/systemd/systemd/plain/rules/60-persistent-storage.rules
as of today, by experimenting with archlinux-2013.11.01-dual.iso
which has an identical file 60-persistent-storage.rules .
---------------------------------------------------------------
When i discussed this issue at grub-devel, Andrey Borzenkov pointed
me to this rule in 60-persistent-storage.rules
# for partitions import parent information
ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*"
The properties ID_FS_USAGE and ID_FS_LABEL_ENC get imported
and later cause the wrong link:
ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
This happens because the blkid rule does not overwrite the
imported ID_FS_LABEL_ENC and ID_FS_TYPE by own findings:
# probe filesystem metadata of disks
KERNEL!="sr*", IMPORT{builtin}="blkid"
To prove my assessment, i booted archlinux-2013.11.01-dual.iso,
verified that the link in /dev/disk/by-label is wrong, and then
set some properties to empty text. I picked the names from the
output of blkid -o udev:
# for partitions import parent information
ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*", \
ENV{ID_FS_LABEL}="" , ENV{ID_FS_LABEL_ENC}="" , \
ENV{ID_FS_TYPE}="" , ENV{ID_FS_USAGE}=""
After this change, udevadm control --reload, and replugging
the USB stick, i get in /dev/disk/by-label a mountable link
to /dev/sdb.
So i assume that with the original rules file, the link to
the parent device was made, but immediately overwritten by the
inappropriate link to the partition.
---------------------------------------------------------------
I fail to imagine a use case where a filesystem ID should
propagate from mountable parent to not mountable partition.
Is there any ?
Have a nice day :)
Thomas
More information about the systemd-devel
mailing list