This is useful for folks like me who use auto-login in gnome and don't want unlock gnome-keyring every time during login.
Prerequisites
- LUKS password and gnome-keyring passwords are same.
- Ubuntu 24.04 (Could work in other versions, but I did not test it)
FYI : It will store first password you type. If you make mistake and type password 2nd time it wont work.
- Install required packages ( package keyutils contain command keyctl)
sudo apt install keyutils
- Edit
/etc/crypttab, adding the optionkeyscript=decrypt_keyctl:
sudo vi /etc/crypttab
Example -->
dm_crypt-0 UUID=a19571ac-b032-4073-9ad9-a0a72189ca1b none luks,keyscript=decrypt_keyctl
- Edit
/etc/pam.d/common-password, adding the optionuse_authtokto the GNOME keyring line
Example -->
password optional pam_gnome_keyring.so use_authtok
- Rebuild initramfs and reboot :
sudo update-initramfs -k all -c
sudo reboot now
After reboot
journalctl -b0 |grep gkrApr 10 18:18:03 dell-laptop gdm-autologin][1432]: gkr-pam: stashed password to try later in open session
Apr 10 18:18:04 dell-laptop gdm-autologin][1432]: gkr-pam: unlocked login keyring
Thank you!
I Confirmed that this solution still works on Debian 13 (Trixie).
I also confirmed that neither Debian 13 nor Fedora 43 exhibit the desired behavior out of the box, without these changes. I read that Fedora had this functionality "baked in" but it didn't work in my test case, so maybe it was removed/changed in a recent version.
EDIT:
In further testing I confirmed that you can skip step 3 (at least on Debian 13). The first time you access the keyring it will ask you for the password and there is a checkbox to automatically unlock the keyring when you log in. All you need to do is check the box and it will work as expected on all subsequent logins. This should fix the issue if you mistype your password the first time unlocking LUKS and I believe it will also let you use a separate password for the keyring, but I haven't tested it.
I baked it into Ansible tasks, if it's helpful to anyone: