1

I'm having some trouble understanding which drive identifiers are available at different stages of system boot.

I'm running a Pi 2B with a btrfs root mounted on an external USB SSD. I'd like to address the root fs by PARTUUID rather than kernel name descriptor in case USB storage plug order ever changes but I'm having a hard time getting bootup working.

I've built an initrd.img containing neccessary btrfs modules; bootup is fine using /dev/XdXn but PARTUUID naming fails every time and dumps me out into busybox. initrd.img is setup in config.txt using "initramfs initrd.img-4.9.24-v7+ followkernel".

Note: / is mounted on a subvolume of the btrfs volume named ROOT.

This boots:

root@Tree-Eater:/etc# cat /boot/cmdline.txt
dwc_otg.lpm_enable=0 console=tty1 root=/dev/sda2 rootfstype=btrfs rootflags=subvol=ROOT elevator=deadline rootwait rootdelay=5 quiet splash plymouth.ignore-serial-consoles

This fails:

root@Tree-Eater:/etc# cat /boot/cmdline.uuid
dwc_otg.lpm_enable=0 console=tty1 root=PARTUUID=be046359-02 rootfstype=btrfs rootflags=subvol=ROOT elevator=deadline rootwait rootdelay=5 quiet splash plymouth.ignore-serial-consoles

Relevant fs & block device info below, any thoughts?

root@Tree-Eater:/etc# cat /etc/fstab
proc                    /proc           proc    defaults          0       0
/dev/mmcblk0p1          /boot           vfat    defaults          0       2

LABEL=external_btrfs    /               btrfs   defaults,space_cache,ssd,noatime,nodiratime,subvol=ROOT         0 0
LABEL=swappy            /swap           ext4    defaults,noatime,nodiratime                                     0 2

# btrfs fs root for snapshots
LABEL=external_btrfs    /mnt/btrfs      btrfs   defaults,noauto,space_cache,ssd,noatime,nodiratime              0 0
/dev/mmcblk0p2          /mnt/sdroot     ext4    defaults,noatime,nodiratime,noauto                              0 0


root@Tree-Eater:/etc# lsblk -f
NAME        FSTYPE LABEL          UUID                                 MOUNTPOINT
sda
├─sda2      btrfs  external_btrfs b21e0b28-05d1-4518-a4c9-77cacdf83d08 /mnt/btrfs
└─sda1      ext4   swappy         74ac5717-c894-4d16-97e2-78a07bb219e3 /swap
mmcblk0
├─mmcblk0p2 ext4                  2f840c69-cecb-4b10-87e4-01b9d28c231c /mnt/sdroot
└─mmcblk0p1 vfat   boot           2D2D-CD16                            /boot


root@Tree-Eater:/etc# blkid -o export
DEVNAME=/dev/mmcblk0p1
SEC_TYPE=msdos
LABEL=boot
UUID=2D2D-CD16
TYPE=vfat
PARTUUID=d660c869-01

DEVNAME=/dev/mmcblk0p2
UUID=2f840c69-cecb-4b10-87e4-01b9d28c231c
TYPE=ext4
PARTUUID=d660c869-02

DEVNAME=/dev/sda1
LABEL=swappy
UUID=74ac5717-c894-4d16-97e2-78a07bb219e3
TYPE=ext4
PARTUUID=be046359-01

DEVNAME=/dev/sda2
LABEL=external_btrfs
UUID=b21e0b28-05d1-4518-a4c9-77cacdf83d08
UUID_SUB=d2439418-1cc2-47d4-9e36-3598de7fb75b
TYPE=btrfs
PARTUUID=be046359-02

DEVNAME=/dev/mmcblk0
PTUUID=d660c869
PTTYPE=dos


root@Tree-Eater:/etc# btrfs subvolume show /
/
        Name:                   ROOT
        UUID:                   db80ba63-dc08-bc42-8f65-ce0caee0cae1
        Parent UUID:            -
        Received UUID:          -
        Creation time:          2017-05-22 00:09:26 -0700
        Subvolume ID:           257
        Generation:             4829
        Gen at creation:        6
        Parent ID:              5
        Top level ID:           5
        Flags:                  -
        Snapshot(s):
                                ROOT-2017-05-23_08:15
5
  • Try putting the PARTUUID in UPPER CASE
    – Milliways
    Commented May 25, 2017 at 2:23
  • @Milliways it already is, check out the pasted line from cmdline.uuid above. 2nd code box under "This fails:" Commented May 25, 2017 at 2:26
  • No you have be046359-02
    – Milliways
    Commented May 25, 2017 at 2:36
  • @Milliways ah, the actual UUID string. Yeah, I'll give that a shot when I get home. Commented May 25, 2017 at 3:13
  • @Milliways Still a no-go. The really odd thing here is that when I'm dumped into initrd's busybox shell the drive is there and blkid -o export shows all of the proper ids and labels for everything. Commented May 25, 2017 at 4:53

2 Answers 2

2

Booting with root=PARTUUID= doesn't appear to work at this time with the current kernel/boot image:

root@Tree-Eater:/# uname -a
Linux Tree-Eater 4.9.24-v7+ #993 SMP Wed Apr 26 18:01:23 BST 2017 armv7l GNU/Linux
root@Tree-Eater:/# date
Thu May 25 14:17:02 PDT 2017

However, using root=UUID= does. So I'm up and running with

root@Tree-Eater:/# cat /boot/cmdline.txt
dwc_otg.lpm_enable=0 console=tty1 root=UUID=b21e0b28-05d1-4518-a4c9-77cacdf83d08 rootfstype=btrfs rootflags=subvol=ROOT elevator=deadline rootwait quiet splash plymouth.ignore-serial-consoles

And program_usb_timeout=1 in /boot/config.txt

Apparently root=PARTUUID= did work with 3.x version kernels as seen here, while root=UUID= failed.

Hopefully this helps someone else!

1
  • Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year.
    – Ingo
    Commented Jan 28, 2020 at 23:02
1

It works (at least in 2019)

But there are two ID on a partition, the UUID and the PARTUUID wich are different.

You can find them with the blkid command.

On my system, this gives :

$ blkid /dev/sdb1
/dev/sdb2: LABEL="root" UUID="ba0d4dc4-18e9-42ff-81e6-077510abdb79" 
TYPE="ext4" PARTLABEL="primary" PARTUUID="3c8e2158-0bec-445b-9fa0-0d
b302c2384c"
$

The relevant options in comdline.txt are then

root=PARTUUID=3c8e2158-0bec-445b-9fa0-0db302c2384c rootfstype=ext4

Good luck !

1
  • Thanks, this turned out to be a bug in the initramfs-tools package that was shipping with raspbian jessie at the time. I actually backported the fix and submitted a PR to the raspbian team but it was ignored. Who knows if it works on jessie these days 🤷‍♂️ (buster should be fine though.) Commented Jan 31, 2020 at 23:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.