spanezz / nodm

Automatic display manager
GNU General Public License v2.0
141 stars 21 forks source link

When systemd tries to kill nodm, nodm restarts itself instead #5

Open mkaito opened 7 years ago

mkaito commented 7 years ago

I suppose systemd is trying to kill the wrong PID. Eventually, the kill operation times out and systemd hard-kills the process. This happens, for example, when trying to reboot or halt the computer.

Arch Linux, everything up to date. Nodm version 0.12

Here's the systemd service file:

[Unit]
Description=nodm display manager

[Service]
EnvironmentFile=/etc/nodm.conf
ExecStart=/usr/bin/nodm

[Install]
WantedBy=multi-user.target
ndchugn commented 7 years ago

same with me, sometime i have to press on power button to turnoff the laptop

sunweaver commented 7 years ago

This should be solved by https://github.com/spanezz/nodm/commit/ede6a3ff5249932963fdce5d337c3cfbdf0ef01a.

Feel free to reopen, if not.

eugene2k commented 7 years ago

Doesn't look like it is.

PatrickNowak commented 7 years ago

Not fixed for me either with version 0.13-1.3.

mkaito commented 7 years ago

As far as I can tell, not fixed.

r-darwish commented 7 years ago

@sunweaver can you please reopen the issue? It seems that it is still relevant

sunweaver commented 7 years ago

@r-darwish: Ack. Reopened. Patches are welcome!

needs commented 7 years ago

Could this line be what cause this issue? It seems like once the session lasted longer than NODM_MIN_SESSION_TIME, it shouldn't be restarted if it ends. Changing it to something like return E_SUCCESS; should do the trick.

Also, I tried and failed to get my build of nodm working on my computer to test this change. I don't want to submit a completely untested pull request.

MikeMitterer commented 7 years ago

I just found this old bug report: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=531869 You think it's somehow related?

felixsanz commented 6 years ago

This is very annoying. Any idea whats going on? Anyone working on it? I think nodm is ignoring system run levels. It shouldn't restart itself when system is moving into restart/shutdown levels

mkaito commented 6 years ago

Actually, it's probably systemd killing the wrong PID.

Quoting Félix Sanz (2017-08-02 22:22:30)

This is very annoying. Any idea whats going on? Anyone working on it? I think nodm is ignoring system run levels. It shouldn't restart itself when system is moving into restart/shutdown levels

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/spanezz/nodm/issues/5#issuecomment-319802619

rtandy commented 6 years ago

This sounds pretty similar to my Debian bug report: https://bugs.debian.org/785592

mkaito commented 6 years ago

It's probably the same problem. I reported this here because the Arch maintainer told me to.

On Fri, Aug 04, 2017 at 05:31:23PM +0000, Ryan Tandy wrote:

This sounds pretty similar to my Debian bug report: https://bugs.debian.org/785592

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/spanezz/nodm/issues/5#issuecomment-320307792

-- Michishige Kaito

BOFH excuse #106:

The electrician didn't know what the yellow cable was so he yanked the ethernet out.

barnacs commented 6 years ago

I'm also experiencing this issue, though it doesn't seem to be deterministic, sometimes it shuts down cleanly. My guess based on the logs and a look at the code:

Is there a reason the signal is not acted on immediately by exiting in the handler?

slashblog commented 6 years ago

This fixes for me.

sunweaver commented 6 years ago

Hi,

On So 27 Aug 2017 07:55:53 CEST, slashblog wrote:

This fixes for
me.

Please file a PR, add proper "Fixes " statement to the commit
message of the above commit.

Thanks! Mike --

DAS-NETZWERKTEAM mike gabriel, herweg 7, 24357 fleckeby mobile: +49 (1520) 1976 148 landline: +49 (4354) 8390 139

GnuPG Fingerprint: 9BFB AEE8 6C0A A5FF BF22 0782 9AF4 6B30 2577 1B31 mail: mike.gabriel@das-netzwerkteam.de, http://das-netzwerkteam.de

slashblog commented 6 years ago

I have created the following pull request: it works for me. The following describes the issue:

The issue is that _shutdown_quitnotification blocks signals. In _nodm_display_managerwait function there is waitpid call. This returns -1 if signal was received before session (dm->session.pid) was closed by systemctl. This is the happy scenario.

However, if session gets closed before signal was sent to the process. The waitpid returns dm->session.pid and the call to _shutdown_quitnotification blocks SIGTERM. Due to this, _catchsignals is never called and nodm proceeds to restarting display manager.

I have removed function _shutdown_quitnotification altogether, as I don't see any need for it, since IMO there is no need to block these signals.

barnacs commented 6 years ago

I wonder if there's any need for the custom signal handling at all in the parent process. My solution was to remove it all and let the kernel exit/clean up. It works for my use case but I'm probably missing something.

aario commented 5 years ago

This bug is open since years ago! Almost two years! Seriously? I have to develop it myself?!

felixsanz commented 5 years ago

@aario you just better spend time with math subtracting. 2018 - 2016 = 2

eugene2k commented 5 years ago

@aario dgw's pull request fixes the bug, so you don't actually have to develop anything yourself. Just merge the pull request into your repo. Nodm seems unmaintained though.

daid commented 5 years ago

See #8, seems it needs a new maintainer, or it will "die".

aario commented 5 years ago

@aario you just better spend time with math subtracting. 2018 - 2016 = 2

Fixed my comment. (That was midnight! ;-) )

aario commented 5 years ago

@aario dgw's pull request fixes the bug, so you don't actually have to develop anything yourself. Just merge the pull request into your repo. Nodm seems unmaintained though.

Thanks for pointing me to right direction.

geolaw commented 5 years ago

I'm using nodm on a mac mini without a keyboard/mouse. Nodm logs me in, .xinitrc startx i3 and synergy It maybe dead but it does the job in my case.

This may not the best way to handle this but it works for me I've added this to /usr/lib/systemd/system/nodm.service

ExecStop=killall -9 nodm

shuts down every time

sagb commented 3 years ago

The bug is still here in Debian testing (bullseye)

luigifab commented 3 years ago

For me, ExecStop=killall -9 nodm in /lib/systemd/system/nodm.service fix the bug in Debian testing. Nodm doesn't restart my session when .xinitrc run systemctl poweroff.

Howewer, when I service nodm stop, the display doesn't back to "tty1".