RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1940607 - lsblk sometimes returns block devices in wrong order with --pairs
Summary: lsblk sometimes returns block devices in wrong order with --pairs
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: util-linux
Version: 8.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Karel Zak
QA Contact: Vojtech Eichler
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-03-18 17:34 UTC by Jonathan Lebon
Modified: 2021-11-10 10:15 UTC (History)
3 users (show)

Fixed In Version: util-linux-2.32.1-28.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-09 20:02:21 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2021:4490 0 None None None 2021-11-09 20:02:28 UTC

Description Jonathan Lebon 2021-03-18 17:34:42 UTC
Description of problem:

In some cases, e.g. LUKS on an NVMe partition, the order in which lsblk returns entries changes when using --pairs:

$ lsblk /dev/nvme0n1
NAME        MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
nvme0n1     259:0    0   20G  0 disk
|-nvme0n1p1 259:1    0    1M  0 part
|-nvme0n1p2 259:2    0  127M  0 part
|-nvme0n1p3 259:3    0  384M  0 part  /boot
`-nvme0n1p4 259:4    0 19.5G  0 part
  `-root    253:0    0 19.5G  0 crypt /sysroot

$ lsblk --pairs /dev/nvme0n1
NAME="root" MAJ:MIN="253:0" RM="0" SIZE="19.5G" RO="0" TYPE="crypt" MOUNTPOINT="/sysroot"
NAME="nvme0n1" MAJ:MIN="259:0" RM="0" SIZE="20G" RO="0" TYPE="disk" MOUNTPOINT=""
NAME="nvme0n1p1" MAJ:MIN="259:1" RM="0" SIZE="1M" RO="0" TYPE="part" MOUNTPOINT=""
NAME="nvme0n1p2" MAJ:MIN="259:2" RM="0" SIZE="127M" RO="0" TYPE="part" MOUNTPOINT=""
NAME="nvme0n1p3" MAJ:MIN="259:3" RM="0" SIZE="384M" RO="0" TYPE="part" MOUNTPOINT="/boot"
NAME="nvme0n1p4" MAJ:MIN="259:4" RM="0" SIZE="19.5G" RO="0" TYPE="part" MOUNTPOINT=""

Notice how the root LUKS device is listed first. This makes it unusable for scripts that want to go down the hierarchy starting from the bottom of the stack.

Version-Release number of selected component (if applicable):

util-linux-2.32.1-24.el8.x86_64

How reproducible:

100%

Steps to Reproduce:
1. Set up LUKS on NVMe.
2. Run `lsblk --pairs`

Actual results:

The "leaf" LUKS container is listed before the partition it's sitting on.

Expected results:

The "leaf" LUKS container is listed after the partition it's sitting on.

Additional info:

We've hit this multiple times in RHCOS and have had to work around it:
https://github.com/coreos/coreos-installer/pull/453
https://bugzilla.redhat.com/show_bug.cgi?id=1934174#c4

Comment 1 Karel Zak 2021-03-24 12:04:03 UTC
Should be fixed by upstream commit https://github.com/karelzak/util-linux/commit/529b51706ef06611a8165023f14e6593e06901de.

Comment 5 Jonathan Lebon 2021-06-08 20:39:53 UTC
Yes, confirmed working with the same setup as in comment 0:

```
[root@cosa-devsh ~]# lsblk /dev/nvme0n1 --pairs
NAME="root" MAJ:MIN="253:0" RM="0" SIZE="15.5G" RO="0" TYPE="crypt" MOUNTPOINT="/sysroot"
NAME="nvme0n1" MAJ:MIN="259:0" RM="0" SIZE="16G" RO="0" TYPE="disk" MOUNTPOINT=""
NAME="nvme0n1p1" MAJ:MIN="259:1" RM="0" SIZE="1M" RO="0" TYPE="part" MOUNTPOINT=""
NAME="nvme0n1p2" MAJ:MIN="259:2" RM="0" SIZE="127M" RO="0" TYPE="part" MOUNTPOINT=""
NAME="nvme0n1p3" MAJ:MIN="259:3" RM="0" SIZE="384M" RO="0" TYPE="part" MOUNTPOINT="/boot"
NAME="nvme0n1p4" MAJ:MIN="259:4" RM="0" SIZE="15.5G" RO="0" TYPE="part" MOUNTPOINT=""
[root@cosa-devsh ~]# rpm -Uvh *.rpm
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:libuuid-2.32.1-28.el8            ################################# [  8%]
   2:libblkid-2.32.1-28.el8           ################################# [ 17%]
   3:libfdisk-2.32.1-28.el8           ################################# [ 25%]
   4:libmount-2.32.1-28.el8           ################################# [ 33%]
   5:libsmartcols-2.32.1-28.el8       ################################# [ 42%]
   6:util-linux-2.32.1-28.el8         ################################# [ 50%]
Cleaning up / removing...
   7:util-linux-2.32.1-27.el8         ################################# [ 58%]
   8:libfdisk-2.32.1-27.el8           ################################# [ 67%]
   9:libmount-2.32.1-27.el8           ################################# [ 75%]
  10:libblkid-2.32.1-27.el8           ################################# [ 83%]
  11:libuuid-2.32.1-27.el8            ################################# [ 92%]
  12:libsmartcols-2.32.1-27.el8       ################################# [100%]
[root@cosa-devsh ~]# lsblk /dev/nvme0n1 --pairs
NAME="nvme0n1" MAJ:MIN="259:0" RM="0" SIZE="16G" RO="0" TYPE="disk" MOUNTPOINT=""
NAME="nvme0n1p1" MAJ:MIN="259:1" RM="0" SIZE="1M" RO="0" TYPE="part" MOUNTPOINT=""
NAME="nvme0n1p2" MAJ:MIN="259:2" RM="0" SIZE="127M" RO="0" TYPE="part" MOUNTPOINT=""
NAME="nvme0n1p3" MAJ:MIN="259:3" RM="0" SIZE="384M" RO="0" TYPE="part" MOUNTPOINT="/boot"
NAME="nvme0n1p4" MAJ:MIN="259:4" RM="0" SIZE="15.5G" RO="0" TYPE="part" MOUNTPOINT=""
NAME="root" MAJ:MIN="253:0" RM="0" SIZE="15.5G" RO="0" TYPE="crypt" MOUNTPOINT="/sysroot"
```

Thanks a lot Karel!

Comment 11 errata-xmlrpc 2021-11-09 20:02:21 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (util-linux bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:4490


Note You need to log in before you can comment on or make changes to this bug.