<div dir="ltr"><div dir="ltr">On Thu, Jul 25, 2019 at 12:49 PM Frank Steiner <<a href="mailto:fsteiner-mail1@bio.ifi.lmu.de">fsteiner-mail1@bio.ifi.lmu.de</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
I'm currently discussing a problem with the SuSE support about failing<br>
unmounts during reboot. Tyring to debug this I realized that systemd<br>
is not killing processes left over by some init.d script. E.g. use<br>
the following script in /etc/init.d/<br>
<br>
#!/bin/sh<br>
#<br>
### BEGIN INIT INFO<br>
# Provides: bla<br>
# Required-Start: $network $remote_fs sshd<br>
# Required-Stop: $network $remote_fs sshd<br>
# Default-Start: 2 3 5<br>
# Description: test<br>
### END INIT INFO<br>
case "$1" in<br>
start) cd /test; /usr/bin/sleep 99d & ;;<br>
stop) true;;<br>
esac<br>
<br>
<br>
On shutdown, unmounting /test will fail because the sleep process is<br>
not killed. Shouldn't there be a mechanism in system to kill processes<br>
spawned by LSB script when shutting these down?<br></blockquote><div><br></div><div>I think that's a deliberate decision made in the systemd-sysv-generator. Note how the generated .service files have "KillMode=process" (and even "RemainAfterExit=yes"). The default for native services is to kill the entire cgroup, and IIRC that even was one of the main reasons for using cgroups.</div><div><br></div><div>Most likely it's there to retain compatibility with some of the weirder init.d scripts – those which don't start any daemons; those which start several; and so on and so on.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
And moreover, wouldn't it make sense to have a mechanism to at least<br>
try to kill all processes using a filesystem before unmounting it?<br>
We often see failing unmounts of several local or iscsi fs during<br>
reboot, and in the support case we are currently working on with SuSE<br>
failing iscsi fs even cause xfs I/O errors. So it might be a good idea<br>
to have sth. like a lsof + kill before unmounting a filesystem, maybe<br>
configurable with a flag to enable or disable it. Even if lsof or kill<br>
failed, it wouldn't be worse than now.<br></blockquote><div><br></div><div>IIRC the idea is that user sessions are killed during shutdown before unmounting anything anyway, and services have implicit After=local-fs.target so they get stopped before local filesystems? The shutdown process is one area that I still know very little about.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
As far as I see there is no way to write a drop-in for a mount unit<br>
that allows to execute commands before the unmount happens, is that<br>
right? Sth. like "ExecPreUmount=" would help here, especially if there<br>
was sth. like a umount@.service that would be called for every umount<br>
with e.g. the mounpoint accessable with a variable.<br></blockquote><div><br></div><div>No, there isn't.</div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">Mantas Mikulėnas</div></div></div>