UUID does not change after grub reinstall

Hey

Recently I copied manjaro installation from a 256gb ssd to 1TB one using DD

Because I used manjaro encryption it used 2 encryption partitions instead of ‘crypt on lvm’ as ubuntu does.

I deleted the cryptswap to enlarge my main partition and then recreated the swap.

I found all the UID-s using:

grep -r 'UID-HERE' /etc

And replace the UIDs to my new UID.

Then I ran

update-grub
grub-install --target=x86_64-efi --efi-directory=/boot/efi/

During boot it still tries to use the old UUID for the LUKS encrypted swap. What should I do?

Hello,
Check your /etc/fstab and modify it accordingly.

The thing is I have changed it.

As I said, I grepped the old UID from all of /etc folder.

I have changed

/etc/fstab
/etc/crypttab
/etc/openswap.conf
/etc/default/grub

If is a different HDD or SSD it will have a different UUID. You can’t use “the old one”.
https://wiki.archlinux.org/title/persistent_block_device_naming

Yes you can use the old one.

As I said, I am using the same UUID for EFI partition and ROOT partition, but my swap has a new UUID that I have implemented in the configuration, but during boot it still tries to look for the old UUID, as if some files during grub updating/install are not overwritten.

So you assigned the old one via tune2fs and you made sure you also got the correct UUID of your swap, changed the files and you run
sudo update-grub
Rebooted and … ?
You only have to grub-install once, before grub-update

The old UUID-s are for 1. ESP partition 2. root partition

The swap partition has a new UUID.

After creating the new encrypted swap partition I changed all the old swap UUID-s to the new one and ran update-grub.

During booting, it says that it can’t find a disk with UUID of the old one, but the resume defined in /etc/default/grub has the new UUID. Somewhere there is something that stores the old UUID of the swap partition and it tries to use that.

  1. Decrypt the drive
  2. Choose boot option
  3. It tries to find the old UUID

Similar to this.

I also ran

mkinitpcio -P
update-grub

After this I rebooted and now it shows that there is no key associated.

Did rebuild the initrd as well?

sudo mkinitcpio -P

Have you checked with the system root - if I recall correct - some keyfile info is stored there

I got inspiration from this.

Turns out the encrypted swap i made defaulted to luks2.

The following solution helped

# overwrite old cryptsetp
cryptsetup luksFormat --type=1 /dev/nvme0n1p3
# add same password as before etc.
#using gparted I made the underlying partition a linux-swap
# modify all the necessary files in /etc/* folder as per my previous comment in this thread
# mount the filesystem
cryptsetup luksOpen /dev/nvme0n1p2 cryptroot
mount /dev/mapper/cryptroot /mnt
# mount all volatile things as per usual chroot
mount /dev/nvme0n1p1 /mnt/boot/efi
cryptsetup luksAddKey /dev/nvme0n1p3 /mnt/crypto_keyfile.bin
cryptsetup luksOpen /dev/nvme0n1p3 cryptswap
chroot /mnt
swapon /dev/mapper/cryptswap
mkinitcpio -P
grub-install
update-grub

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