Unable to shutdown after a dab at systemd service unit files

Hi all. I was recently experimenting with automating commands when shutting down the system. In the process, I made a file push.service in /usr/lib/systemd/system-shutdown/ that was:

[Unit]
Description=Run mycommand at shutdown
Requires=network.target
DefaultDependencies=no
Before=shutdown.target reboot.target

[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/bin/true
ExecStop=<some git commands I entered for auto-pushing of stuff>

[Install]
WantedBy=multi-user.target

based on: this article (and of course I did something that I wasn’t supposed to, and the mistake I made while trying to test it led me here to the forums :P).
After I do this and save the changes, shutting down keeps me stuck while showing me various process and green coloured OKs for them. I then tried removing that file and upon one instance of rebooting and trying to shutdown (this is after removing the file), it showed watchdog0: watchdog has not stopped! (paraphrasing from memory). I did the fix mentioned in this forum post’s reply and the watchdog message stopped appearing, but the situation of it not shutting down still remains. As for the logs I have to mention here, I am a total newbie, so please point me to what I need to do. Thanks

Hi,

I think the watchdog did not stop behavior is somewhat normal so I’m guessing it’s not related to the initial problem of system not shutting down.

A few questions/clarifications:

  • You did remove the push.service file in /usr/lib/systemd/system-shutdown/ before trying to reboot again?
  • Did you ever end up enabling the push service?
  • When you attempt to shutdown, what is the behavior seen? Are you given any errors or similar?
  • How many times have you tried to shut down since removing the push.service file?
  • How long do you wait for the system to shutdown before giving up and forcing it off?
  • Did the system successfully shutdown after giving the watchdog error before?

If systemctl just didn’t reload the files for some reason after you deleted push.service, then running systemctl daemon-reload might work.

And welcome to the forums!

You did remove the push.service file in /usr/lib/systemd/system-shutdown/ before trying to reboot again?

Yes, I did remove push.service before attempting to reboot after one unsuccessful attempt at the test. I had also re-checked whether that is the case and it did seem so, and tried rebooting but the problem persisted.

Did you ever end up enabling the push service?

Wait, I didn’t catch you there, how does that work? I just made the file with my changes and continued to test it with doing nothing other than that.

When you attempt to shutdown, what is the behavior seen? Are you given any errors or similar?

I doesn’t show any errors as far as I can see, everything’s green and OK. At the end it shows the message of “Reach target…” (from memory, I’ll check this once again and let you know)

How long do you wait for the system to shutdown before giving up and forcing it off?

I remember waiting for around 5-7 minutes in the past. I tried waiting for 10-11 minutes once and it still didn’t so I had to kick the bucket for it manually.

How many times have you tried to shut down since removing the push.service file?

2-4

Did the system successfully shutdown after giving the watchdog error before?

I waited for a few minutes, not much, but during the time I did pause waiting, it didn’t shutdown.

If systemctl just didn’t reload the files for some reason after you deleted push.service, then running systemctl daemon-reload might work.

I tried this as you said, entered my password and rebooted, didn’t seem to work unfortunately.

And welcome to the forums!

Thank you!

Thanks for answering the questions. This behavior is odd.

Did you revert your blacklist after editing it in an attempt to get rid of the “watchdog did not stop” error on shutdown?

I doesn’t show any errors as far as I can see, everything’s green and OK. At the end it shows the message of “Reach target…” (from memory, I’ll check this once again and let you know)

This might be important helpful to know. Let me know when you get the chance.

What method do you use to shutdown?

Is there any difference when you try running poweroff -f?

You may want to take a look at this page to further narrow down where to look for the issue:
https://freedesktop.org/wiki/Software/systemd/Debugging/#index2h1

This is the screen where my PC gets stuck at: https://app.skiff.com/docs/d45063e7-a03b-4a2d-9162-061c5c693140#w%2Bc%2Bu0%2BiyGPhiMI3ZJo8TEG8NTKZ75H2z4ToX2SOJUw%3D

What method do you use to shutdown?

Poweroff button as usual on GNOME.

Is there any difference when you try running poweroff -f?

Yes there is, it shuts down as I expect it to.

Did you revert your blacklist after editing it in an attempt to get rid of the “watchdog did not stop” error on shutdown?

No, I have not. I’ll try and let you know in a moment.
Edit: I reverted the blacklist and the error isn’t showing up after an “attempt” at a shutdown.

I’ll read the webpage you have linked to tomorrow as it is getting a bit late; I’ll come back to this tomorrow ASAP. :+1:

Tell me if the systemd troubleshooting article helps.

The fact that poweroff -f works but the Gnome’s poweroff button doesn’t points to either systemctl or Gnome being the issue. Does systemctl poweroff work?

I find the logs to be useful perhaps, so attaching them here. I has not got much time this week unfortunately, thus the delay in replies and testing. I will do so more in this weekend.

journalctf -b: https://pastebin.com/29KRP9Tp
systemd-analyze dump > systemd-dump.txt: https://gist.github.com/src4026/b1b362ed04e099c463c498ff92383b6b
/usr/lib/systemd/systemd --test --system --log-level=debug > systemd-test.txt 2>&1: https://gist.github.com/src4026/eb71280f722693647bab92b9d574b524

Are those logs from after trying systemctl poweroff?

If gnome poweroff was working fine before then it shouldn’t be the problem.
I guess he just messed up something with systemd, so that should be fixed.

If you had disabled or stopped a service, then it means it won’t be executed unless or until you have done some other changes with the shutdown process which might have been not limited to the service file that you created.

Have you done any such changes?

Yes, before this log I did try it

I don’t remember doing any changes like that.

Hello, I got caught up in the moment and am now finding that the issue is now resolved and it shutdowns as normal :thinking:

Glad to hear that. Sorry I didn’t know what was going wrong before. If you ever figure out what the problem was, it would be good to know here for future reference.