Writing

Feed Software, technology, sysadmin war stories, and more.

Tuesday, March 1, 2022

Universally unique identifier? Sometimes...

This is a short one since it's somewhere between a random bit of "grab some popcorn" amusement and a "huh, that might be a problem some day". In short, it looks like every Raspberry Pi filesystem installed from any given release image probably ends up with the same UUID.

When is a universally unique identifier not universally unique? When it gets stamped into a filesystem that is then cloned onto a bunch of storage devices and used as-is.

For instance, if you downloaded the "lite" version of Raspbian between roughly November 8th and January 28th, you probably got a file called 2021-10-30-raspios-bullseye-armhf-lite.zip. Inside, there's an image, and the idea is that you dump that straight to your SD card, cram it in the Pi, and off you go. The second partition on that image is an ext4 filesystem which was created on some build machine somewhere. The UUID on it never gets "evolved" to something else after the install.

So, you now know that every single install from that image, no matter where it is, now has the same UUID value for that filesystem unless someone or something has come along to change it after the fact, and that UUID is 568caafd-bab1-46cb-921b-cd257b61f505. It even shows up in a few places on the web, and that'd normally be a neat trick for such a thing.

You can see it inside the image itself here:

# losetup /dev/loop0 2021-10-30-raspios-bullseye-armhf-lite.img
# partx -a /dev/loop0
# tune2fs -l /dev/loop0p2 | grep UUID
Filesystem UUID:          568caafd-bab1-46cb-921b-cd257b61f505
# 

Or, if you actually installed a few of these things like I did over the past couple of months, you can just 'tune2fs -l /dev/mmcblk0p2' and see the same value in there.

What does this mean? For most people, probably nothing, hence my initial description. However, if you are the sort who likes to track filesystems in terms of their UUIDs instead of a device name (sda, sdb, ...) or anything else that tends to be brittle, weird and jumpy in this wacky modern world, this might trip you up some day!

Don't end up with a pile of SD cards on your desk and think "I know, I'll use the filesystem UUIDs to track which one goes where", in other words.

The good news is that tune2fs will happily make up a new value and will replace it for you if you so choose. The bad news is that anything you did which references that filesystem by the old "568c..." value will break when you do that. So, be sure of how your mounting stuff works before you go messing with such things!

If it's not breaking anything for you, it's probably best to just let it be. Untangling a boot mess on these weird little boxes is anything but fun.

Note: if you're actually on a recent Raspberry Pi, odds are good that your /etc/fstab will be using *partition* UUIDs (PARTUUID=...) and not those of the filesystem. If in doubt, use blkid to see what's what.