Skip to main content
Topic: Shutdown unmount hangs indefinitely with pam_mount'd encrypted partitions (Read 515 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Shutdown unmount hangs indefinitely with pam_mount'd encrypted partitions

The "Unmounting filesystems" shutdown process hangs indefinitely when an encrypted partition mounted by pam_mount is active.

What I have found:
- This can be fixed by unmounting any such partitions at any point before this process.
- This problem does not happen on any other Artix-supported init systems.

What I have NOT found:
- Whether or not this also occurs with normal partitions mounted by pam_mount.
- A way to fix this that's not just making a script that explicitly unmounts the problematic partitions.

I did a surface-level comparison with Runit's base services to see if anything stood out to no avail, but I am now pretty positive that this is specifically an issue with Artix's services and not an issue with dinit itself, hence why I have reported it here. However it is worth noting I have barely any idea on how udev, dinit, etc. works, so maybe someone with more knowledge can take a look at it.

I also did some looking into system logs (with syslog-ng enabled) and saw nothing of note.

Re: Shutdown unmount hangs indefinitely with pam_mount'd encrypted partitions

Reply #1
Apologies for the late reply.

What's your dinit-rc version?
now only the dinit guy in artix

Re: Shutdown unmount hangs indefinitely with pam_mount'd encrypted partitions

Reply #2
Note that Chimera uses a shutdown hook script which I think prevents this issue. (The root cause seems to be a bug in the util-linux umount command, though I've not had a chance to investigate properly).

https://github.com/chimera-linux/dinit-chimera/blob/master/shutdown-hook

Re: Shutdown unmount hangs indefinitely with pam_mount'd encrypted partitions

Reply #3
Note that Chimera uses a shutdown hook script which I think prevents this issue. (The root cause seems to be a bug in the util-linux umount command, though I've not had a chance to investigate properly).

https://github.com/chimera-linux/dinit-chimera/blob/master/shutdown-hook

We copied some of it here: https://gitea.artixlinux.org/artix/dinit-rc/src/branch/master/misc/shutdown-hook

My hypothesis is less about the umount command by itself but it has something to do with udev (which is why we enable DM_DISABLE_UDEV since I did encounter this issue when Artix moved from eudev to udev).

When closing a crypt partition on shutdown with --debug enabled (but not exporting the DM_DISABLE_UDEV var), the command stuck on this:
Code: [Select]
# Udev cookie 0xd4d949a (semid 32768) decremented to 1
# Udev cookie 0xd4d949a (semid 32768) waiting for zero
now only the dinit guy in artix


Re: Shutdown unmount hangs indefinitely with pam_mount'd encrypted partitions

Reply #5
My hypothesis is less about the umount command by itself but it has something to do with udev (which is why we enable DM_DISABLE_UDEV since I did encounter this issue when Artix moved from eudev to udev).

Did some more testing with it and I'm not so sure udev is to blame. From throwing together a stop-command for the udevd service it appears that the umount hang occurs before udev is killed. I'm thinking the issue may lie with elogind, rather, as that's the only other service I can think of that may have a hand in this, and hooking a umount before it is killed (granted, with its shutdown-hook system rather than dinit's stop-command) works perfectly fine. If that's not it, at least I have a reliable band-aid solution now :D