site  contact  subhomenews

Conflicting UUIDs in frugal installation

January 03, 2020 — BarryK

I received an email from John. He ran Easy Buster 2.2 from a USB-stick, and all was well. He then wrote the image file, 'easy-2.2-amd64.img.gz', to the hard drive of the computer, using easydd:

# easydd easy-2.2-amd64.img.gz

There is a write-up on this easy way to install EasyOS to a hard drive:

https://easyos.org/install/how-to-install-easyos-on-a-new-ssd.html

And the hard drive installation worked fine.

Later on, John booted the USB-stick on that same computer, but the internal installation started up instead. What is wrong?

There is a "gotcha" with this method. The 'initrd' file in the boot-partition has a file inside it name 'BOOT_SPECS', which has the UUIDs of the boot-partition and the working-partition. The boot script, 'init', searches for these UUIDs.

Normally, the Linux kernel will discover the internal drives first, and assign device labels to them, sda1, sda2, etc. So the 'init' script will find these first and will find the UUIDs that it wants.

Coz, the UUIDs on the hard drive are identical to those on the USB-stick, as they were both written from the same .img.gz file.

The problem can be avoided, just don't boot from that USB-stick. Other releases of EasyOS will be OK, as when I create the .img.gz file for a new release, it is assigned new random UUIDs.

However, I replied to John's email and advised that if he wants, he can fix it. He could change the UUIDs on either the USB-stick or the hard drive. For example, say that the boot-partition is /dev/sda1 and the working-partition is /dev/sda2 (both partitions must be unmounted):

# blkid /dev/sda1
/dev/sda1: LABEL="INTERN1P1" UUID="E346-3A85" TYPE="vfat"
# mlabel -n -i /dev/sda1 ::
# blkid /dev/sda1
/dev/sda1: UUID="75DA-3871" TYPE="vfat"

...that has assigned a random UUID to the sda1 vfat partition. Now for sda2 ext4 partition:

# blkid /dev/sda2
/dev/sda2: LABEL="intern1p2" UUID="2d4e93e9-963d-4d10-b68b-e216e2f26162" TYPE="ext4"
# tune2fs -U time /dev/sda2
tune2fs 1.44.5 (15-Dec-2018)
# fsck.ext4 -p /dev/sda2
intern1p2: clean, 11/4136960 files, 338437/16531200 blocks
# blkid /dev/sda2
/dev/sda2: LABEL="intern1p2" UUID="ed238396-2dbb-11ea-bfde-c025e90feb00" TYPE="ext4"

Now, the 'BOOT_SPECS' file needs to be fixed. Mount /dev/sda1 and click on the 'initrd' file, and it should offer to automatically fix 'BOOT_SPECS'. That's it, you are good to go! 

Tags: easy