Encrypted Disk and automatic setting of the password

I am currently trying to auto set the password during the start/boot process to automatically decrypt the encrypted drive to continue the boot process (until login).

VM: Oracle VirtualBox
OS: rocky 9.1

I have done the following configurations in the installation process:

  1. set the storage configuration to automatic during installation
  2. selected encryption and set a password

After that I updated the following entry in the file /etc/crypttab (I did not change the name or uuid of the drive and kept the automatically generated name/uuid).

  1. entry none to /etc/luks-keys/passwort or /boot/luks-keys/passwort
  2. luks,discard
  3. after that i updated the initramfs with sudo dracut -f
  4. give rights for root to read from the file (-rw------- root root)

What I have tried so far:

  • other combinations (only discard) and other locations of the password file
  • checked the paths for spelling mistakes
  • the password does not contain special- and space characters
  • password entry with quotes and without quotes
  • the service under systemctl status systemd-cryptsetup@luks\…{uuid} is also running

After the system boots it also asks me for the password and the password works fine. I can log in successfully after that.
When I look at the logs from journalctl it also gives an error: failed to activate, key file ‘/boot/luks-keys/password’ missing.

Do I need to update another configuration for the grub bootloader in the file /etc/defualt/grub in the line for GRUB_CMDLINE_LINUX=“…”?

I am aware that the password is plain in the file and it is not encrypted yet. I am aware that the password is plain in the file and it is not encrypted yet. It concerns me primarily to be able to illustrate the functionality.

I’m a little out of ideas at the moment on what this can be. Does anyone have a tip /suggestion? Or can even guide me a bit how I can implement this?

I wish you all a good start to the weekend

PS: Here is a snippet of the log:

Please, do not upload pictures to show plain text. Use the pre-formatted text option here in the editor for it.

About your issue: did you have taken into account that /boot is a mount point? I haven’ t test it, but how does dracuts initrd look into this directory ( /luks-keys/passwort) ? May be choose a different location …

It worked! Thanks for the hint with the file location and if dracut or the initramfs contains/is visible the file at all.
I have now carried out the following steps:

  1. create own .conf file to assign the password file
    nano /etc/dracut.conf.d/luks-keys.conf
  2. entry of the path to the password file
    install_items+=" /etc/luks-keys/passwort "
  3. update the initramf
    sudo dracut -f
  4. check if the file appears in initrmfs
    sudo lsinitrd | less

For completion here the entry in /etc/crypttab:
<name> <uuid> /etc/luks-keys/passwort discard

@Ritov thanks for the hint with the pictures.