It seems that gpg-agent is not the only thing that prevents encrypted directory from being unmounted. I suspect that systemd having PID 1 (init) kills systemd --user while it is preparing to unmount the home directory.
Some observations. At first I disabled gpg-agent in ~/.gnupg/gpg.conf file. It did not help. I tried to log in from tty to avoid complications with display manager and session.d files. I faced quite strange behavior, the ecryptfs directory became unmounted every second logout. Every odd login mount count in /dev/shm is 2, every event login there is no file in /dev/shm and user keyring is empty (keyctl list @u). Than I rebuild ecryptfs-utils package with more syslog calls added to src/pam_ecryptfs/pam_ecryptfs.c:private_dir(). I am not completely sure but it looks like systemd --user is got killed while running pam modules. I see log messages that private_dir() is invoked but it is not finished. Log messages are lost, the point when it happens is random (e.g. before or after fork). The next message in the logs is systemd[1]: Stopped User Manager for UID 1007. umount.ecryptfs_private is not executed for systemd --user, however it decreases mount count while launched on shutdown of the login process. It seems that systemd --user process is not a problem per se since the mount counter in /dev/shm works. I am unsure if the keys are cleared at the proper moment since it leads to funny umount cycle. The challenge is to properly stop gpg-agent and let pam to complete his close session hooks when it is invoked from user's systemd process. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1470030 Title: "gpg-agent --daemon" stays after login, causing ecryptfs to not get unmounted To manage notifications about this bug go to: https://bugs.launchpad.net/ecryptfs/+bug/1470030/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
