Stefan Monnier <[email protected]> wrote: > > I find that when I do a reboot or poweroff (from command line) > > running processes are not being sent SIGTERM. The one that really > > annoys me is a text editor not receiving it and thus me losing work. > > > > The systemd documentation says that it should be sent; good old init > > used to do this. > > > > Is the documentation wrong or do I need to tweak some config > > somewhere ? > > > > I am running Debian 13 with the mate desktop. MATE Terminal > > provides the terminal emulation. The editor is my own version of > > microemacs (which does handle SIGTERM correctly). > > > > The GUI (mate, etc) is actually irrelevant - the same thing happens > > to the editor being run on a console. > > I have no idea what's really going on, but I think there are two > possible explanations: > > - Your editor process is sent *another* signal (e.g. because of the > disappearance of some other endpoint of one of its file descriptors) > that makes it die without saving-work, before systemd gets a chance > to send it a SIGTERM. [ If that's the case, the problem is in your > editor which should handle that other signal better. ] > > - Maybe same as above but systemd wouldn't send a SIGTERM anyway. > > - Your process is not sent any signal. I think that would qualify as > a bug in systemd. > > - The filesystem is read-only when your process gets SIGTERM so it > can't save your work?
I think that would be a bug in systemd as well, if it makes a filesystem RO before processes using the filesystem have terminated? Really, I wouldn't expect systemd to disappear any filesystems before it had terminated all processes that could be using them.

