PartUUID vs UUID? NOT THE SAME THING.

This forum is for supported devices using an ARMv7 Freescale SoC.

PartUUID vs UUID? NOT THE SAME THING.

Postby Lestrad » Wed May 27, 2020 12:31 pm

Hello. I made a clone of my Wandboard's system card (using dd) and when I insert it and reboot the Wandboard starts to boot from it, but then throws me into Emergency mode with the message "Can't find PartUUID xxxxxxxx" Looking at the cloned card with blkid it looks identical, except that the cloned card has no PartUUID whereas the original card does. They both have the same UUID.

My question is, if I edit /boot/boot.txt to read

$this->bbcode_second_pass_code('', 'setenv bootargs console=${console} root=UUID=${uuid} rw rootwait')

instead of

$this->bbcode_second_pass_code('', 'setenv bootargs console=${console} root=PARTUUID=${uuid} rw rootwait')

as it now reads, and then run mkscr to make a new boot.scr, will the new card then boot?

I'm afraid to try it because (full disclosure) I don't know how to get in and change it back if I end up in emergency mode. :?

Hoping for help, cheers to all
Les
Lestrad
 
Posts: 41
Joined: Sun Oct 27, 2019 8:02 pm

Re: PartUUID vs UUID? NOT THE SAME THING.

Postby summers » Thu May 28, 2020 10:55 am

Think it depends on how the kernel is compiled. In the past the arch arm kernel used to be compiled so it understood root=PARTUUID=xxx, but didn't understand UUID.

So historically had to use PARTUUID as what was passed to the kernel.

I still do this, not had any reason to change. I don't know what the current kernel has compiled in. It certainly understands PARTUUID, but don't know about UUID ...
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

Re: PartUUID vs UUID? NOT THE SAME THING.

Postby ufo6000 » Thu May 28, 2020 3:06 pm

All Filesystems have an UUID, run lsblk -f to list them.
On GPT partitions you have also PARTLABEL, PARTUUID.
Please read the note on PARTUUID when using MBR, $this->bbcode_second_pass_quote('', 'U')nlike a regular PARTUUID of a GPT partition, MBR's pseudo PARTUUID can change if the partition number changes.
https://wiki.archlinux.org/index.php/Pe ... y-partuuid
ufo6000
 
Posts: 117
Joined: Fri Jan 22, 2016 7:54 pm

Re: PartUUID vs UUID? NOT THE SAME THING.

Postby Lestrad » Thu Jun 04, 2020 12:25 pm

Hello! I'm sorry I haven't replied yet. I thought I was subscribed to this thread but I wasn't . What I finally did was to go into /boot/boot.txt and replace
$this->bbcode_second_pass_code('', '
setenv bootargs console=${console} root=PARTUUID=${uuid} rw rootwait')

with

$this->bbcode_second_pass_code('', 'setenv bootargs console=${console} root=PARTUUID="6209f7cb-1397-4572-83b7-9f39xxxxxxxx"')

where "6209f7cb-1397-4572-83b7-9f39xxxxxxxx" is the UUID of the card (since it was a clone made with dd, the UUID is identical to that of the original SD card).

It worked - the card booted up fine.

However, now when I go back into the /boot directory, I see that boot.txt has reverted back to what it was. Also, the clone now has a PARTUUID, and it's different from the one on the original card. Yet the Wandbard can boot from the original card too.

Anyway now I know that when I clone a system SD Card I'll need to follow these instructions https://unix.stackexchange.com/questions/474258/add-partuuid-to-dos-mbr and make sure that the cloned card has a PARTUUID.

Thanks to everyone!
Lestrad
 
Posts: 41
Joined: Sun Oct 27, 2019 8:02 pm

Re: PartUUID vs UUID? NOT THE SAME THING.

Postby summers » Sun Jun 07, 2020 10:33 am

you could write a script based on $this->bbcode_second_pass_code('', 'blkid') that would extract the PARTUUID of the root file system, which I presume you know what it is ...
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

Re: PartUUID vs UUID? NOT THE SAME THING.

Postby Lestrad » Sun Jun 07, 2020 7:08 pm

"that would extract the PARTUUID of the root file system, which I presume you know what it is ..."

Sure. But any help with that script would be appreciated! $this->bbcode_second_pass_code('', 'blkid ')was just reading a UUID but no PARTUUID for the cloned card.

TIA

Les
Lestrad
 
Posts: 41
Joined: Sun Oct 27, 2019 8:02 pm

Re: PartUUID vs UUID? NOT THE SAME THING.

Postby ufo6000 » Mon Jun 08, 2020 9:13 am

My 1st post has a link, which shows 3 ways to display the required info.
ufo6000
 
Posts: 117
Joined: Fri Jan 22, 2016 7:54 pm

Re: PartUUID vs UUID? NOT THE SAME THING.

Postby summers » Mon Jun 08, 2020 10:13 am

lets see.
$this->bbcode_second_pass_code('', 'blkid /dev/sdb6 | sed 's/.*\(PARTUUID="[^"]*"\)/\1/'')
Gives the PARTUUID of sdb6. Let see if I can do one that finds root by default. Try
$this->bbcode_second_pass_code('', 'blkid `mount | sed -n 's/\([^ ]*\) on \/ .*/\1/p'` | sed 's/.*\(PARTUUID="[^"]*"\)/\1/'')
Bit cryptic, but extracts the root device from mount, and then uses blkid to get the PARTUUID of that device.
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

Re: PartUUID vs UUID? NOT THE SAME THING.

Postby Lestrad » Mon Jun 08, 2020 12:50 pm

Thanks to everyone. The problem I was having is that the system card of my Wandboard, which has an MBR and one ext4 "partition", was cloned by dd with no PARTUUID (and a UUID identical to the original card). This was the output of blkid:

$this->bbcode_second_pass_code('', '/dev/mmcblk2p1: UUID="6209f7cb-1397-4572-83b7-9f3915ba2bab" BLOCK_SIZE="4096" TYPE="ext4"')

and the error message on boot:

$this->bbcode_second_pass_code('', 'mount: /new_root: can't find PARTUUID=17b88b48-01
You are now being dropped into an emergency shell.')

Was it looking for that specific PARTUUID, or would it have accepted any one? Your scripts work fine, but the PARTUUID they find seems to have been created when I booted the card after changing the boot.scr file.

$this->bbcode_second_pass_code('', '[alarm@alarm ~]$ blkid `mount | sed -n 's/\([^ ]*\) on \/ .*/\1/p'` | sed 's/.*\ (PARTUUID="[^"]*"\)/\1/'
PARTUUID="44863d86-01"')

If I'd run the scripts on the card as cloned, I assume they would have found nothing. The PARTUUID I now have must have been created as described in ufo6000's first link. Is there a way for blkid to create a PARTUUID? Or do I need to use fdisk as per the link I posted? Or when I clone the new card, will I have to use the same workaround I bumbled into?

Thanks again
Les
Lestrad
 
Posts: 41
Joined: Sun Oct 27, 2019 8:02 pm

Re: PartUUID vs UUID? NOT THE SAME THING.

Postby summers » Tue Jun 09, 2020 3:50 pm

Note that the linux kernel does not understand UUID:

https://github.com/torvalds/linux/blob/f49aa1de98363b6c5fba4637678d6b0ba3d18065/init/do_mounts.c#L191-L219

Hence why PARTUUID is used. $this->bbcode_second_pass_code('', 'blkid') I think just prints the data it finds. When the there is an MBR, it just uses a scheme which the kernel understand for generating a PARTUUID.

Only disk I know where PARTUUID is shown by blkid is one which just has a raw btrfs partition on the disk, and no partitioning at all. There blkid gives a UUID, but doesn't give a PARTUUID ... oh yes, not that the UUID is there is shared with another partition, because both are in the same btrfs file system.
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm


Return to Freescale

Who is online

Users browsing this forum: No registered users and 1 guest