# Encrypted Disk and automatic setting of the password

**URL:** <https://forums.rockylinux.org/t/encrypted-disk-and-automatic-setting-of-the-password/9246>\
**Category:** Rocky Linux Help & Support\
**Created:** [March 17, 2023, 3:47pm UTC](https://forums.rockylinux.org/t/encrypted-disk-and-automatic-setting-of-the-password/9246 "2023-03-17T15:47:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![thmsbu](https://avatars.discourse-cdn.com/v4/letter/t/5daacb/32.png) [@thmsbu](https://forums.rockylinux.org/u/thmsbu)\
**Post date:** [March 17, 2023, 3:47pm UTC](https://forums.rockylinux.org/t/encrypted-disk-and-automatic-setting-of-the-password/9246/1 "2023-03-17T15:47:43Z")

</div>

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:

 ![logfile-10](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/2X/9/970deb15d70b625e38de4dbd4f9f41e2d093a22c.jpeg)  
 ![logfile-11](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/2X/f/fa41b06d37aacd36093ffe2f7119b32ea8e71cc0.jpeg)  
 ![logfile-12](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/2X/7/7607c11d8d2f0d9dc4b108312e580ac6f32afce2.jpeg)  
 ![logfile-13](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/2X/7/7a3967cc5fbb6ecfd0e4a75035d7499698c857ff.jpeg)  
 ![logfile-14](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/2X/7/737c07a54da3aa693f3be12ba0b3aaaa960b42f0.jpeg)  
 ![logfile-15](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/2X/3/326146f95d84e88e31dec660d4bd85d04c7e6feb.jpeg)  
 ![logfile-16](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/2X/d/d7883427ded7587f694a37d96f6aaf8abf83ea7a.jpeg)

---

<div class="post-metadata">

**Author:** ![Ritov](https://avatars.discourse-cdn.com/v4/letter/r/3ec8ea/32.png) [@Ritov](https://forums.rockylinux.org/u/Ritov)\
**Post date:** [March 17, 2023, 7:48pm UTC](https://forums.rockylinux.org/t/encrypted-disk-and-automatic-setting-of-the-password/9246/2 "2023-03-17T19:48:52Z")

</div>

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 …

---

<div class="post-metadata">

**Author:** ![thmsbu](https://avatars.discourse-cdn.com/v4/letter/t/5daacb/32.png) [@thmsbu](https://forums.rockylinux.org/u/thmsbu)\
**Post date:** [March 20, 2023, 9:08am UTC](https://forums.rockylinux.org/t/encrypted-disk-and-automatic-setting-of-the-password/9246/3 "2023-03-20T09:08:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![brian](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/brian/32/5777_2.png) [@brian](https://forums.rockylinux.org/u/brian)\
**Post date:** [August 25, 2023, 3:21am UTC](https://forums.rockylinux.org/t/encrypted-disk-and-automatic-setting-of-the-password/9246/4 "2023-08-25T03:21:10Z")

</div>


