[systemd-devel] systemd kills mdmon if it was started manually by user

Christian Parpart trapni at gentoo.org
Sat Dec 4 01:12:23 PST 2010


On Saturday, December 04, 2010 09:41:26 am Andrey Borzenkov wrote:
> If user starts array manually (mdadm -A -s as example) from within
> user session and array needs mdmon, mdmon becomes part of user session
> control group:
> 
> ├ user
> │ └ root
> │   └ 1
> │     ├ 1916 login -- root
> │     ├ 1930 -bash
> │     ├ 1964 gpg-agent --keep-display --daemon --write-env-file
> /root/.gnup... │     └ 2062 mdmon md127
> 
> 
> It is then killed by systemd during shutdown as part of user session.
> It results in dirty array on next boot.
> 
> Is there any magic that allows daemon to be exempted from killing?

While your raid should absolutely not be corrupted on next reboot 
when mdmon receives a SIGTERM, I suspect you're using pam_systemd.so 
(/etc/pam.d/system-auth), which automatically creates cgroups by login 
session, which in turn gets killed when the user has "completely logged out".
That is why your mdadm gets terminated, too.
You can avoid that by adding create-session=0 to it, like:

# grep pam_systemd /etc/pam.d/systemd-auth
session     optional    pam_systemd.so create-session=0

Which is the recommented way if you want processes (created by the "user") to 
live on even when this user has fully logged out.

Regards,
Christian Parpart.

p.s.: see pam_systemd(8)


More information about the systemd-devel mailing list