/boot UUID change problem

I am trying to change the UUID of my /boot and every time I try it seems to “half work”.

lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 238.5G 0 disk
├─sda1 8:1 0 600M 0 part /boot/efi
├─sda2 8:2 0 1G 0 part /boot
├─sda3 8:3 0 70G 0 part /
└─sda4 8:4 0 3.8G 0 part [SWAP]

blkid
/dev/sda4: UUID=“c2edb7a0-b339-4ad0-ad2a-4cd110449222” TYPE=“swap” PARTUUID=“5459d8cd-501f-483f-9fce-84509385d47f”
/dev/sda2: UUID=“3e445f53-6186-4dba-a167-d0c5cf236e96” TYPE=“xfs” PARTUUID=“f61b4812-996d-499e-8ebd-871a7792a35f”
/dev/sda3: UUID=“1ce82368-cfa6-4ee8-8ee7-d52a110e0725” TYPE=“ext4” PARTUUID=“0f57cf2c-00bf-45f1-a532-a7a956510b4a”
/dev/sda1: UUID=“8C45-C00A” TYPE=“vfat” PARTLABEL=“EFI System Partition” PARTUUID=“cf9fcbac-56fa-4295-b2c4-476a7551f93e”

My steps for changing it are:

  1. xfs_admin -U new-uuid /dev/sda2
  2. edit the /etc/fstab
  3. edit the /etc/default/grub

The way I edit the grub is by adding the below line:

GRUB_CMDLINE_LINUX=“root=UUID=new-uuid”
then running
sudo grub2-mkconfig -o /boot/grub2/grub.cfg

I did also try sudo grubby --update-kernel=ALL --agrs, with a similar argument.

So far nothing works every time it boots it keeps referencing the previous UUID even thought it looks to have updated the grub cfg file.

Anyone have an idea what I am doing wrong?

Thanks

What about ?
cat /boot/loader/entries/*conf

The stub “grub.cfg” in /boot/efi/EFI/rocky/ points to “boots” UUID so you need to change that.

Is this Rocky 8 or 9? I was assuming 9.
The commandline argument root=UUID= wants to point to your root partition sda3 and not boot on either r8 or r9.
Why are you using the xfs file system for boot which is usually a 1 or 2 gig partition of relatively small files?

That [XFS] is the installer default. You could ask Red Hat why. You can ask users why they accept proposed defaults, but they could ask how they could know better.


Indeed. Only the el9 has mere stub in /boot/efi/EFI/rocky/

That stub (if it exists), the real grub.cfg (always /boot/grub2/grub.cfg in el9), and the /etc/fstab
do refer to the /boot by UUID.

The initramfs for each kernel, do they have a copy of /etc/fstab in them for early mounts?
Probably not – the /boot is not “essential”.


Out of curiosity, why?

I thought you only changed the default grub file?

Its Rocky 9.5. The UUID is changed on sda2 for me which is ./boot, so is “root=” wrong?

1 Like

Why? It is not my idea it has to do with the project I am on.

Why xfs? When I first set it up, xfs was the default, should I changed it? I am new to this OS set up sort of thing.

No, you don’t need to change it. That’s irrelevant at this point. Some will say use a non-journaling filesystem like ext2 for /boot because it’s not necessarily needed to have journaling enabled for that particular mountpoint.

Assuming that was the old UUID of /boot, do run:

sudo grep -r 3e445f53-6186-4dba-a167-d0c5cf236e96 /boot
sudo grep -r 3e445f53-6186-4dba-a167-d0c5cf236e96 /etc

These should list files that still have that text.

Whether that is boots new or old UUID the only places it should appear is in fstab for boots mount point and in the stub grub.cfg on /boot/efi/EFI/rocky/ .
Both locations require opening in a text editor to correct. To restore the kernel command line reference to your root partition you need to run grubby again thus:

sudo grubby --update-kernel=ALL --agrs=root=UUID=1ce82368-cfa6-4ee8-8ee7-d52a110e0725

Running grubby per above should correct the entries in /boot/loader/entries/ and in /etc/kernel/cmdline .
You should remove any reference to “root=” in /etc/default/grub , do this first. The only commandline arguments there should be those that were there before.

Then as a belt and suspenders type of action you can rebuild grub

sudo grub2-mkconfig -o /boot/grub2/grub.cfg  --update-bls-cmdline

So the question now is can you boot into your system now to effect these corrections? Can you get to a grub menu from the firmware boot menu “F12” at the logo on my machine? If you can then at your chosen entry hit “e” to edit and then go to the linux line and replace the root= argument with root=/dev/sda3
then enter cntrl+x to boot that entry.
If you can’t boot into your system that way then you’ll have to use a rescue disk and chroot mount your system. Then mount boot to “/boot” and boot/efi to “/boot/efi”

1 Like

Thanks everyone, I have gotten it to work. I did grep around as most suggested and found every reference to the old UUID, it appears this file was hanging on: /boot/efi/EFI/Rocky/grub.cfg and I had to hand edit it and my /etc/default/grub was incorrect, I needed to do nothing there but regen it. It was also suggested I run sudo dracut --force, thanks everyone!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.