@Lee  Thanks for tracking down the util-linux bug.

Since this is broken in 2.34 (eoan/focal); I'm thinking we should use
sysfs to find the parent via device name walking;

Given a kname (nvme0n1p1) of the target partition

# look up sysfs path from kname
% realpath /sys/class/block/nvme0n1p1
/sys/devices/pci0000:00/0000:00:02.0/0000:05:00.0/nvme/nvme0/nvme0n1/nvme0n1p1

# check if it's a partition
% ls -al 
/sys/devices/pci0000:00/0000:00:02.0/0000:05:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/partition
-r--r--r-- 1 root root 4096 Feb 12 08:08 
/sys/devices/pci0000:00/0000:00:02.0/0000:05:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/partition

# extract parent device path
% dirname 
/sys/devices/pci0000:00/0000:00:02.0/0000:05:00.0/nvme/nvme0/nvme0n1/nvme0n1p1
/sys/devices/pci0000:00/0000:00:02.0/0000:05:00.0/nvme/nvme0/nvme0n1

# extract parent device major/minor
% cat /sys/devices/pci0000:00/0000:00:02.0/0000:05:00.0/nvme/nvme0/nvme0n1/dev
259:0

# udev symlinks/dev/block/$MAJOR:$MINOR
% ls -al /dev/block/259:0 
lrwxrwxrwx 1 root root 10 Jan 18 00:16 /dev/block/259:0 -> ../nvme0n1
% realpath /dev/block/259:0
/dev/nvme0n1

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1862846

Title:
  Crash and failure installing focal

To manage notifications about this bug go to:
https://bugs.launchpad.net/subiquity/+bug/1862846/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to