partitions can have different major numbers
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
snapd |
Fix Released
|
Critical
|
Ian Johnson |
Bug Description
ll /dev/block/
total 0
drwxr-xr-x 2 root root 620 Nov 19 2019 ./
drwxr-xr-x 17 root root 4640 Apr 1 2020 ../
lrwxrwxrwx 1 root root 10 Apr 1 2020 179:0 -> ../mmcblk0
lrwxrwxrwx 1 root root 12 Apr 1 2020 179:1 -> ../mmcblk0p1
lrwxrwxrwx 1 root root 15 Apr 1 2020 179:16 -> ../mmcblk0boot1
lrwxrwxrwx 1 root root 12 Apr 1 2020 179:2 -> ../mmcblk0p2
lrwxrwxrwx 1 root root 12 Apr 1 2020 179:3 -> ../mmcblk0p3
lrwxrwxrwx 1 root root 12 Apr 1 2020 179:4 -> ../mmcblk0p4
lrwxrwxrwx 1 root root 12 Apr 1 2020 179:5 -> ../mmcblk0p5
lrwxrwxrwx 1 root root 12 Apr 1 2020 179:6 -> ../mmcblk0p6
lrwxrwxrwx 1 root root 12 Apr 1 2020 179:7 -> ../mmcblk0p7
lrwxrwxrwx 1 root root 15 Apr 1 2020 179:8 -> ../mmcblk0boot0
lrwxrwxrwx 1 root root 12 Apr 1 2020 259:0 -> ../mmcblk0p8
lrwxrwxrwx 1 root root 12 Apr 1 2020 259:1 -> ../mmcblk0p9
lrwxrwxrwx 1 root root 13 Apr 1 2020 259:10 -> ../mmcblk0p18
lrwxrwxrwx 1 root root 13 Apr 1 2020 259:2 -> ../mmcblk0p10
lrwxrwxrwx 1 root root 13 Apr 1 2020 259:3 -> ../mmcblk0p11
lrwxrwxrwx 1 root root 13 Apr 1 2020 259:4 -> ../mmcblk0p12
lrwxrwxrwx 1 root root 13 Apr 1 2020 259:5 -> ../mmcblk0p13
lrwxrwxrwx 1 root root 13 Apr 1 2020 259:6 -> ../mmcblk0p14
lrwxrwxrwx 1 root root 13 Apr 1 2020 259:7 -> ../mmcblk0p15
lrwxrwxrwx 1 root root 13 Apr 1 2020 259:8 -> ../mmcblk0p16
lrwxrwxrwx 1 root root 13 Apr 1 2020 259:9 -> ../mmcblk0p17
this seems to trip up the checks in snap-bootstrap that encrypted partition comes from the same block device as the boot device.
if/when kernel runs out of (or clahes) minor number, it can allocate a new major number and start using that for further partitions.
Thus inspecting something like $ cat /sys/block/
tags: | added: core20 |
Changed in snapd: | |
status: | New → In Progress |
importance: | Undecided → Critical |
assignee: | nobody → Ian Johnson (anonymouse67) |
$ basename $(readlink /dev/block/$(cat /sys/block/ $(basename $(readlink /dev/block/`grep /run/mnt/data /proc/self/ mountinfo | tail -n1 | cut -d\ -f3`))/ slaves/ */../dev) )
sda
so this interates mountinfo; finds /run/mnt/data mountpoint; finds it major:minor; finds it's dm name; checks the slaves of said dm; to find underlying device; to find the parent of that device; to find major:minor of it; and map it back to it's name.
Doing this should reliably map "mountpoint -> parent device name" based on kernel information.