-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Description
tl;dr: for what needs fixing see: #12409 (comment) and #12409 (comment)
systemd version the issue has been seen with
...
241.67-1-arch
242.0-1
Used distribution
…
ArchLinux
Expected behaviour you didn't see
…
only one partition (loop0p1) should have the labelARCH_201904
Unexpected behaviour you saw
…
two partitions(loop0p1, loop0p3) and the device(loop0) all had the same label:ARCH_201904
Steps to reproduce the problem
1. download the archlinux iso from https://www.archlinux.org/download/
2. write it to an USB stick that's bigger than the ISO, or alternatively attempt to emulate that like this:
$ cd /tmp
$ mv archlinux-2019.04.01-x86_64.iso usbdevice
append 300MiB more(else can't create new partition):
$ dd if=/dev/zero of=usbdevice conv=notrunc oflag=append bs=1M count=300
$ cfdisk usbdevice
go to Free Space, press [New] button and Enter on the 300M, select [primary], go to [Write] press Enter then type yes and press Enter, then press q.
You now have:
$ fdisk -l usbdevice
Disk usbdevice: 904 MiB, 947912704 bytes, 1851392 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x377032cf
Device Boot Start End Sectors Size Id Type
usbdevice1 * 0 1236991 1236992 604M 0 Empty
usbdevice2 164 131235 131072 64M ef EFI (FAT-12/16/32)
usbdevice3 1236992 1851391 614400 300M 83 Linux
$ sudo partx -a usbdevice
(You get this error: partx: /dev/loop1: error adding partition 2 which you wouldn't see if you had the iso actually written to an usb instead.)
Now you have:
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 904M 0 loop
├─loop0p1 259:0 0 604M 0 part
└─loop0p3 259:1 0 300M 0 part
The symlink /dev/disk/by-label/ARCH_201904 points to ../../loop0p3
3. use the following command to see all the labels for the device and the partitions:
pick either a or b:
a. if iso is on a physical usb stick:
$ udevadm info -n /dev/sdd{,1,2,3}|grep by-label/ARCH_201904
b. if iso is in a file in /tmp/usbstick:
$ udevadm info /dev/loop0{,p1,p3}|grep by-label/ARCH_201904
S: disk/by-label/ARCH_201904
E: DEVLINKS=/dev/disk/by-uuid/2019-04-01-15-29-51-00 /dev/disk/by-label/ARCH_201904
S: disk/by-label/ARCH_201904
E: DEVLINKS=/dev/disk/by-partuuid/377032cf-01 /dev/disk/by-uuid/2019-04-01-15-29-51-00 /dev/disk/by-label/ARCH_201904
S: disk/by-label/ARCH_201904
E: DEVLINKS=/dev/disk/by-partuuid/377032cf-03 /dev/disk/by-uuid/2019-04-01-15-29-51-00 /dev/disk/by-label/ARCH_201904
As seen above, all three devices (loop0, loop0p1, loop0p3) have the same label ARCH_201904 but only loop0p1 is expected to have that label.
A small workaround for the new partition (loop0p3) to not inherit the same ARCH_201904 label is to have it formatted ext4(for example) and setting the ext4 filesystem label(as opposed to leaving it unset) to something (other than ARCH_201904):
$ sudo mkfs.ext4 /dev/loop0p3 -L somelabel
[sudo] password for user:
mke2fs 1.45.0 (6-Mar-2019)
Discarding device blocks: done
Creating filesystem with 307200 1k blocks and 76912 inodes
Filesystem UUID: 04077491-c861-4b0e-be7f-2f28390e99d2
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185
Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
$ udevadm info /dev/loop0{,p1,p3}|grep by-label/ARCH_201904
S: disk/by-label/ARCH_201904
E: DEVLINKS=/dev/disk/by-uuid/2019-04-01-15-29-51-00 /dev/disk/by-label/ARCH_201904
S: disk/by-label/ARCH_201904
E: DEVLINKS=/dev/disk/by-uuid/2019-04-01-15-29-51-00 /dev/disk/by-label/ARCH_201904 /dev/disk/by-partuuid/377032cf-01
This still leaves loop0 and loop0p1 both with the same label but at least loop0p3 doesn't "own" the /dev/disk/by-label/ARCH_201904 symlink anymore(it's loop0p1 which does) - this now actually allows the usbstick to boot normally into archlinux root prompt. The issue now is that if booting this usbstick file or usb stick, lsblk will show /dev/sdb as being mounted as /run/archiso/bootmnt and thus any attempt to mount /dev/sdb3 for example will yell that it's in use / already mounted! But if /dev/sdb1 instead of /dev/sdb would've been mounted(which would be the case if /dev/sdb (aka /dev/loop0 above) would not have had the same label that blkid correctly reports /dev/sdb1 as having) then /dev/sdb wouldn't show as mounted and likely /dev/sdb3 mouting would be allowed.
Btw, blkid does correctly report the labels (from within the booted usbstick)
(blkid shows nothing on the system with 242.0 with loop0 though)