[Letux-kernel] Subtle issue with U-Boot and kernel and SD card UUIDs

H. Nikolaus Schaller hns at goldelico.com
Tue May 23 16:17:02 CEST 2017

Hi Matthijs,

> Am 23.05.2017 um 15:07 schrieb Matthijs van Duin <matthijsvanduin at gmail.com>:
> Now how can they have the same UUID? It should be unique, shouldn't it?
> When a pc-style partition table is used, PARTUUIDs don't really exist and $DISKID-$N is used as substitute, where the disk id is extracted from the partition table and N is the partition number.
> As for why the disk id is zero for your cards I dunno. You should be able to reset them to a random number by generating a new partition table using fdisk.

Trying fdisk was a very good hint (sdb is a Pyra SD card on an external SD card reader):

> root at letux:~# fdisk /dev/sdb
> Welcome to fdisk (util-linux 2.25.2).
> Changes will remain in memory only, until you decide to write them.
> Be careful before using the write command.
> Command (m for help): p
> Disk /dev/sdb: 29.7 GiB, 31914983424 bytes, 62333952 sectors
> Units: sectors of 1 * 512 = 512 bytes
> Sector size (logical/physical): 512 bytes / 512 bytes
> I/O size (minimum/optimal): 512 bytes / 512 bytes
> Disklabel type: dos
> Disk identifier: 0x00000000

^^^ oops

> Device     Boot   Start      End  Sectors  Size Id Type
> /dev/sdb1  *        128  3116818  3116691  1.5G  c W95 FAT32 (LBA)
> /dev/sdb2       3116819 62333951 59217133 28.2G 83 Linux
> Command (m for help): 

The disk identifier is indeed not randomized but 0. Maybe sfdisk isn't setting it by default.
Ah, I also dd in=/dev/null out=/dev/sdb so that I wipe out the MBR completely.
This means that a fresh pre-formatted SD card looses any randomized disk identifier.

So all this shows:
* U-Boot and default scripts seem to be basically fine
* kernel does what it should and does not necessarily need the mmc alias patch (although it would be nice to have)
* I have to look into the makesd partitioning step to solve the subject issue by providing really unique disk labels

Something like: https://johnkastler.net/2012/02/05/changing-disk-identifier-using-fdisk/

BR and thanks,

More information about the Letux-kernel mailing list