You are not logged in.

#1 2018-12-30 17:26:12

probackup-nl
Member
From: Delft
Registered: 2017-11-15
Posts: 93
Website

[SOLVED] Root mountpoint points to wrong disk, bug in mount/lsblk?

I was trying to duplicate the GPT nvme boot disk to a SATA disk on the EFIstub booted machine (4.19.12-arch1-1-ARCH), and noticed that somewhere after creating the btrfs root partition on the target disk, lsblk showed root "/" mountpoint at the destination drive instead of the source drive. First I thought I was unlucky because of an earlier dd from source to target disk or from /etc/fstab having the root specified by its label.

Later on I found that renaming the btrfs FS label using btrfs filesystem label / root updates the label at the source disk instead of the target disk (which is where root should be mounted according to mount and /etc/mtab).

Regression: even after specifying /etc/fstab root by PARTUUID or /dev/nvme0n1p2 and updating initramfs and a reboot. lsblk still shows `-sda2        8:2    1  28.7G  0 part / instead of `-nvme0n1p2 259:2    0  28.7G  0 part /.

Have I found a bug in mount/lsblk or in btrfs/blkid or why is /etc/mtab not updated to display the correct device where root is mounted?

PS1 I don't even need to reboot, as soon as that SATA drive is plugged, root gets remounted from the NVMe to the SATA drive.

---
System CSM: UEFI only

# efibootmgr -v
BootCurrent: 0003
Timeout: 1 seconds
BootOrder: 0003,0008,0007
Boot0003* Arch Linux speedboot	HD(1,GPT,9e2fda47-c319-4475-aa71-aaf359ae563c,0x2000,0x200000)/File(\vmlinuz-linux)r.o.o.t.=.P.A.R.T.U.U.I.D.=.c.2.d.8.1.7.a.e.-.8.6.8.2.-.4.e.3.7.-.a.b.7.d.-.5.1.8.6.e.1.b.7.3.c.1.3. .r.w. .n.o.m.o.d.e.s.e.t. .f.b.c.o.n.=.s.c.r.o.l.l.b.a.c.k.:.1.2.8.k. .i.n.i.t.r.d.=./.i.n.t.e.l.-.u.c.o.d.e...i.m.g. .i.n.i.t.r.d.=./.i.n.i.t.r.a.m.f.s.-.l.i.n.u.x.-.t.i.n.y...i.m.g.
Boot0007* UEFI: Built-in EFI Shell 	VenMedia(5023b95c-db26-429b-a648-bd47664c8012)..BO
Boot0008* UEFI: PNY USB Flash Drive 1100	PciRoot(0x0)/Pci(0x16,0x0)/USB(1,0)/USB(2,0)/HD(1,MBR,0xf8bc94a,0xa4,0x20000)..BO

Boot: EFISTUB
Default EFI boot loader menu entry:

# cat /boot/loader/entries/arch-tiny.conf
title Arch Linux speedboot
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux-tiny.img
options root=PARTUUID=c2d817ae-8682-4e37-ab7d-5186e1b73c13 rw fbcon=scrollback:128k iomem=relaxed

Incorrect lsblk:

# lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    1 117.4G  0 disk
|-sda1        8:1    1     1G  0 part
`-sda2        8:2    1  28.7G  0 part /
nvme0n1     259:0    0 238.5G  0 disk
|-nvme0n1p1 259:1    0     1G  0 part /boot
`-nvme0n1p2 259:2    0  28.7G  0 part

Blkid output:

/dev/nvme0n1p1: SEC_TYPE="msdos" UUID="B02E-CE77" TYPE="vfat" PARTLABEL="EFIboot" PARTUUID="9e2fda47-c319-4475-aa71-aaf359ae563c"
/dev/nvme0n1p2: LABEL="root" UUID="b81e9d42-c0a2-4a1e-8197-f6775419f654" UUID_SUB="bbcdac25-f519-4810-a0ca-60f7d8e44029" TYPE="btrfs" PARTLABEL="root" PARTUUID="c2d817ae-8682-4e37-ab7d-5186e1b73c13"
/dev/sda1: SEC_TYPE="msdos" LABEL_FATBOOT="boot" LABEL="boot" UUID="3BE3-AC8A" TYPE="vfat" PARTLABEL="EFIboot" PARTUUID="c9fb83f6-115e-4d29-adfa-2798e0047230"
/dev/sda2: LABEL="root" UUID="b81e9d42-c0a2-4a1e-8197-f6775419f654" UUID_SUB="bbcdac25-f519-4810-a0ca-60f7d8e44029" TYPE="btrfs" PARTLABEL="root" PARTUUID="f478312c-5f46-417f-86db-f71178d7aaf5"
/dev/nvme0n1: PTUUID="e84fcc5f-5048-494a-bfea-086e0b358f8b" PTTYPE="gpt"

Incorrect mount output:

# mount | grep -e /dev/sda -e /dev/nvm
/dev/sda2 on / type btrfs (rw,noatime,nodiratime,ssd,space_cache,subvolid=5,subvol=/)
/dev/nvme0n1p1 on /boot type vfat (rw,noatime,nodiratime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)

/etc/fstab content:

/dev/nvme0n1p2          	/         	btrfs      	rw,noatime,nodiratime,ssd,acl	0 0
UUID=B02E-CE77         	/boot     	vfat      	rw,noatime,nodiratime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro	0 0
Test case
# blkid | grep  -e /dev/sda -e /dev/nvm
/dev/nvme0n1p1: SEC_TYPE="msdos" UUID="B02E-CE77" TYPE="vfat" PARTLABEL="EFIboot" PARTUUID="9e2fda47-c319-4475-aa71-aaf359ae563c"
/dev/nvme0n1p2: LABEL="root" UUID="b81e9d42-c0a2-4a1e-8197-f6775419f654" UUID_SUB="bbcdac25-f519-4810-a0ca-60f7d8e44029" TYPE="btrfs" PARTLABEL="root" PARTUUID="c2d817ae-8682-4e37-ab7d-5186e1b73c13"
/dev/sda1: SEC_TYPE="msdos" LABEL_FATBOOT="boot" LABEL="boot" UUID="3BE3-AC8A" TYPE="vfat" PARTLABEL="EFIboot" PARTUUID="c9fb83f6-115e-4d29-adfa-2798e0047230"
/dev/sda2: LABEL="root" UUID="b81e9d42-c0a2-4a1e-8197-f6775419f654" UUID_SUB="bbcdac25-f519-4810-a0ca-60f7d8e44029" TYPE="btrfs" PARTLABEL="root" PARTUUID="f478312c-5f46-417f-86db-f71178d7aaf5"
/dev/nvme0n1: PTUUID="e84fcc5f-5048-494a-bfea-086e0b358f8b" PTTYPE="gpt"
# btrfs filesystem label / root2
# blkid | grep  -e /dev/sda -e /dev/nvm
/dev/nvme0n1p1: SEC_TYPE="msdos" UUID="B02E-CE77" TYPE="vfat" PARTLABEL="EFIboot" PARTUUID="9e2fda47-c319-4475-aa71-aaf359ae563c"
/dev/nvme0n1p2: LABEL="root2" UUID="b81e9d42-c0a2-4a1e-8197-f6775419f654" UUID_SUB="bbcdac25-f519-4810-a0ca-60f7d8e44029" TYPE="btrfs" PARTLABEL="root" PARTUUID="c2d817ae-8682-4e37-ab7d-5186e1b73c13"
/dev/sda1: SEC_TYPE="msdos" LABEL_FATBOOT="boot" LABEL="boot" UUID="3BE3-AC8A" TYPE="vfat" PARTLABEL="EFIboot" PARTUUID="c9fb83f6-115e-4d29-adfa-2798e0047230"
/dev/sda2: LABEL="root" UUID="b81e9d42-c0a2-4a1e-8197-f6775419f654" UUID_SUB="bbcdac25-f519-4810-a0ca-60f7d8e44029" TYPE="btrfs" PARTLABEL="root" PARTUUID="f478312c-5f46-417f-86db-f71178d7aaf5"
/dev/nvme0n1: PTUUID="e84fcc5f-5048-494a-bfea-086e0b358f8b" PTTYPE="gpt"
# lsblk | grep  -e sda -e nvm
sda           8:0    1 117.4G  0 disk
|-sda1        8:1    1     1G  0 part
`-sda2        8:2    1  28.7G  0 part /
nvme0n1     259:0    0 238.5G  0 disk
|-nvme0n1p1 259:1    0     1G  0 part /boot
`-nvme0n1p2 259:2    0  28.7G  0 part
# cat /proc/mounts | grep -e /sda -e /nvm
/dev/sda2 / btrfs rw,noatime,nodiratime,ssd,space_cache,subvolid=5,subvol=/ 0 0
/dev/nvme0n1p1 /boot vfat rw,noatime,nodiratime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0

Last edited by probackup-nl (2018-12-30 20:14:01)

Offline

#2 2018-12-30 18:43:15

Condor
Member
Registered: 2017-12-01
Posts: 54

Re: [SOLVED] Root mountpoint points to wrong disk, bug in mount/lsblk?

probackup-nl wrote:

Blkid output:

/dev/nvme0n1p2: LABEL="root" UUID="b81e9d42-c0a2-4a1e-8197-f6775419f654" UUID_SUB="bbcdac25-f519-4810-a0ca-60f7d8e44029" TYPE="btrfs" PARTLABEL="root" PARTUUID="c2d817ae-8682-4e37-ab7d-5186e1b73c13"
/dev/sda2: LABEL="root" UUID="b81e9d42-c0a2-4a1e-8197-f6775419f654" UUID_SUB="bbcdac25-f519-4810-a0ca-60f7d8e44029" TYPE="btrfs" PARTLABEL="root" PARTUUID="f478312c-5f46-417f-86db-f71178d7aaf5"

Both BTRFS file systems share the same UUID and UUID_SUB. They are supposed to be unique. This calls for confusion (aside of the same label, which you indicate to have changed). Even though your /etc/fstab references the disk by its device, I'd hazard a guess there is confusion over the UUID.

Consult man btrfstune how to generate a new UUID for one disk.

Offline

#3 2018-12-30 20:16:32

probackup-nl
Member
From: Delft
Registered: 2017-11-15
Posts: 93
Website

Re: [SOLVED] Root mountpoint points to wrong disk, bug in mount/lsblk?

Condor wrote:

... I'd hazard a guess there is confusion over the UUID.

I can confirm. After changing the FS UUID no more undesired auto mounting. Apparently internally the used identifier is the FS UUID.

Offline

Board footer

Powered by FluxBB