Generating a replicable UID without using the system files interface

Currently working on a digital signage system in a locked down environment where Ubuntu Core / snaps are perfect. Thing is, I need to generate a replicable UID for each Raspberry Pi kiosk in the system.

Until now it was enough to get the CPU serial number of the RPI with cat /proc/cpuinfo|grep "Serial.*: "|awk '{print $3}' – but its not as simple as that using snaps.

To keep using this solution the snap would need access to the system files interface, which is not auto-connecting and super privileged.

I was hoping someone here might have some experience with this sort of thing when working with snaps.

In short, the snap needs to be able to generate a unique replicable ID string.

The only idea I have at the moment is possibly noting the start and end times down to the nano second of each step during install (ex. the install and config hooks) and hashing it. Or alternatively rolling uuidgen into the snap. Then putting the ID in a content snap that moves it from a writable to a read-only share, so it stays and cannot be edited, even if the kiosk snap using it has to be re-installed.

This isn’t replicable though as it relies on a non-replicable process and the ID will be lost should the SD card die.

This is covered by hardware-observe, you don’t need system-files.

1 Like

Thank you very much. Guess I’ve gone a bit interface blind. :smile:

1 Like