Changing the name of an encrypted partition

I recently installed EndeavourOS on a VM and went with the option to have the hard drive encrypted. The name of the encrypted root file system is luks-56578603-4615-4200-a22c-30de9ec59f65 which I would like to change to something shorter like luks-root. To do this, I tried the following steps:

  1. Change the name with dmsetup:
$ sudo dmsetup rename luks-56578603-4615-4200-a22c-30de9ec59f65 luks-root
$ sudo dmsetup ls
luks-root       (254:0)
  1. Edit /etc/crypttab:
# <name>               <device>                         <password> <options>
# luks-56578603-4615-4200-a22c-30de9ec59f65 UUID=56578603-4615-4200-a22c-30de9ec59f65     /crypto_keyfile.bin luks
luks-root UUID=56578603-4615-4200-a22c-30de9ec59f65     /crypto_keyfile.bin luks
  1. Edit /etc/fstab:
# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=AA72-9D24                            /efi           vfat    fmask=0137,dmask=0027 0 2
# /dev/mapper/luks-56578603-4615-4200-a22c-30de9ec59f65 /              ext4    noatime    0 1
/dev/mapper/luks-root /              ext4    noatime    0 1
  1. Edit /efi/loader/entries/d343a988e712405fbf7cc69ca1481bdd-6.7.1-arch1-1.conf:
# Boot Loader Specification type#1 entry
# File created by /etc/kernel/install.d/90-loaderentry.install (systemd 254.1-1-arch)
title      EndeavourOS
version    6.7.1-arch1-1
machine-id d343a988e712405fbf7cc69ca1481bdd
sort-key   endeavouros-6.7.1-arch1-1
# options    nvme_load=YES nowatchdog rw rd.luks.uuid=56578603-4615-4200-a22c-30de9ec59f65 root=/dev/mapper/luks-56578603-4615-4200-a22c-30de9ec59f65 systemd.machine_id=d343a988e712405fbf7cc69ca1481bdd
options    nvme_load=YES nowatchdog rw rd.luks.name=56578603-4615-4200-a22c-30de9ec59f65=luks-root root=/dev/mapper/luks-root systemd.machine_id=d343a988e712405fbf7cc69ca1481bdd
linux      /d343a988e712405fbf7cc69ca1481bdd/6.7.1-arch1-1/linux
initrd     /d343a988e712405fbf7cc69ca1481bdd/6.7.1-arch1-1/initrd

On boot, however, the system still uses the old name:


(After entering the passphrase, the boot process simply won’t continue at some point because there is no file system with that name.)
It looks like this is related to cryptsetup. Before making the above changes, I indeed found a cryptsetup unit containing the name of the partition:

$ systemctl --list-units --type=service
UNIT                                                                                LOAD   ACTIVE SUB     DESCRIPTION                                    
⋮
systemd-cryptsetup@luks\x2d56578603\x2d4615\x2d4200\x2da22c\x2d30de9ec59f65.service loaded active exited  Cryptography Setup for luks-56578603-4615-4200-a22c-30de9ec59f65
⋮

If I’m not mistaken, systemd-cryptsetup units are usually generated by systemd-cryptsetup-generator which in turn reads /etc/crypttab to find the names. I edited /etc/crypttab in step 2 but, as you can see in the screenshot, that didn’t help, so I really don’t know what to do at this point.

I just did this a while ago on my laptop. I only needed to change the name in /etc/crypttab. Thats it.

dmsetup rename changes the UUID of the device. This is not what you want. The UUID is important also for the boot process with grub and need to be reflected in /etc/default/grub.

I suggest you revert the change of the UUID back to the original value. (with dmsetup rename) and the only edit /etc/cryptab

EDIT:
I guess I misunderstood the whole topic. Ignore my post. I will leave it in the thread as evidence of my ignorance :wink: