on my old/other Gentoo setup I was using pam_mount successfully for decrypting my Home directory on login.
Now I've an RAID1 via lvm2 and encryted with luks. Opening via cryptsetup is working well:
Code: Select all
cryptsetup open /dev/raid0vg0/raid0lv0 homeThe corresponding and from the old/other setup adapted line in /etc/security/pam_mount.conf.xml is:Feb 13 18:42:30 lux login[1936]: (pam_mount.c:522): mount of /dev/raid0vg0/raid0lv0 failed
Feb 13 18:44:59 lux login[1935]: (mount.c:68): Messages from underlying mount program:
Feb 13 18:44:59 lux login[1935]: (mount.c:72): ehd_load: Inappropriate ioctl for device
Searching for "ehd_load: Inappropriate ioctl for device" shows no result. Nowhere.<volume group="wheel" fstype="crypt" path="/dev/raid0vg0/raid0lv0" mountpoint="/home/" />
Switching to UUID doesn't help. But enable debugging was helpful:
So, it looks like pam_mount is mainly exec mount here. Trying to exec with verbose mode by handFeb 13 20:13:08 lux login[1937]: (mount.c:675): Password will be sent to helper as-is.
Feb 13 20:13:08 lux login[1937]: command: 'mount' '-t' 'crypt' '/dev/disk/by-uuid/*************' '/home'
results in an error, too:
Code: Select all
mount.crypt -v /dev/disk/by-uuid/************* /homeThanks to https://www.reddit.com/r/linuxquestions ... t_logical/Password:
(mtcrypt.c:561): keysize=0 trunc_keysize=xy
ehd_load: Invalid argument
I'm able to use pam_mount as wanted. It's not a bug, but a use case with special needs and maybe what the Gentoo Wiki meaning with "other kind of encrypted file systems".
/etc/security/pam_mount.conf.xml now contains:
Code: Select all
<volume group="wheel" fstype="crypt" path="/dev/disk/by-uuid/aaaaaaaaaaaa mountpoint="/home/" />
<!-- cryptmount>cryptsetup open %(VOLUME) %(MNTPT)</cryptmount><cryptumount>cryptsetup close %(MNTPT)</cryptumount -->
<cryptmount>cryptsetup open %(VOLUME) home</cryptmount><cryptumount>cryptsetup close home</cryptumount>
<volume group="wheel" fstype="auto" path="/dev/disk/by-uuid/bbbbbbbbbbbb" mountpoint="/home/" />
Debugging now shows:
Because I do have still some open questions. Thats why this topic is not in 'Documentation, Tips & Tricks'.lux login: lux
(pam_mount.c:365): pam_mount 2.20: entering auth stage
pam_mount password:
Last login: Sat Feb 14 16:00:33 CET 2026 on tty2
(pam_mount.c:568): pam_mount 2.20: entering session stage
(mount.c:261): Mount info: globalconf, user=lux <volume fstype="crypt" server="(null)" path="/dev/disk/by-uuid/aaaaaaaaaaaaaaaaaaa" mountpoint="/home" cipher="(null)" fskeypath="(null)" fskeycipher="(null)" fskeyhash="(null)" header="(null)" options="" /> fstab=0 ssh=0
(mount.c:675): Password will be sent to helper as-is.
command: 'cryptsetup' 'open' '/dev/disk/by-uuid/aaaaaaaaaaaaaaaaaaa' 'home'
...
(mount.c:261): Mount info: globalconf, user=lux <volume fstype="auto" server="(null)" path="/dev/disk/by-uuid/bbbbbbbbbbbbbbbbbbb" mountpoint="/home" cipher="(null)" fskeypath="(null)" fskeycipher="(null)" fskeyhash="(null)" header="(null)" options="" /> fstab=0 ssh=0
(mount.c:675): Password will be sent to helper as-is.
command: 'mount' '-tauto' '/dev/disk/by-uuid/bbbbbbbbbbbbbbbbbbbbbb' '/home'
...
(mount.c:564): 33 18 253:5 / /home rw,relatime - xfs /dev/mapper/home rw,attr2,inode64,logbufs=8,logbsize=32k,noquota
command: 'pmvarrun' '-u' 'lux' '-o' '1'
(pmvarrun.c:261): parsed count value 0
(pam_mount.c:441): pmvarrun says login count is 1
(pam_mount.c:660): done opening session (ret=0)
You have new mail in folder /var/mail/lux.
(pam_mount.c:116): Clean global config (**********)
(pam_mount.c:133): clean system authtok=0x... (*********)
Q1: Why doesn't /dev/raid0vg0/raid0lv0 working directly and pam_mount need this interim stage instead for the combination lvm2, RAId and LUKS?
Q2: %(MNTPT) is /home here. But that's not working withing cryptsetup, because cryptsetup needs a name, not a path/dir. So, is it possible to keep the config dynamicly?
Thanks in advance, rogge.


