Saturday, May 7, 2016

Workaround: A stop job is running for Avahi mDNS/DNS-SD stack

The error message appears when shutting down or rebooting the computer:
A stop job is running for Avahi mDNS/DNS-SD stack (seemingly forever/1 minute 55 seconds)

My temporary workaround:
systemctl stop avahi-daemon.service

# reboot
systemctl reboot


# shutdown
systemctl poweroff



Make this workaround above automatic:

Create a file:
nano /home/user_name/systemd_workaround.sh

The contents of the file:
#!/bin/bash
# systemd_workaround.sh


# explicitly stop this service:

/bin/systemctl --force stop avahi-daemon.service


Save:
Ctrl+x


Create another file:
nano  /lib/systemd/system/workaround.service



[Unit]
Description=cannot shut down or reboot properly
DefaultDependencies=no
Before=shutdown.target reboot.target halt.target kexec.target


[Service]
ExecStart=/home/user_name/systemd_workaround.sh
Type=oneshot


Save:
Ctrl+x


Run this command:

chmod 755 /home/user_name/systemd_workaround.sh

Then, run this command:
systemctl daemon-reload

Now, shut down or reboot.
Instead of shutdown -r now, I entered
/bin/systemctl reboot


Instead of shutdown -h now, I entered
/bin/systemctl poweroff

Wow! Shut down and reboot properly. (I will observe and see if this is the best workaround.)


Update:

Latest workaround:

Another workaround.


---
Previously, I did...

If it was unfortunate, I would go back to sysvinit.



 I used:
/bin/systemctl poweroff

/bin/systemctl reboot

to test if it works. This method appeared to work. More testing continues. "A stop job is running" problem still exists. It occurs once every two or few weeks (already less frequently).


I had used:
/bin/systemctl --force stop avahi-daemon.service
to test if it works. Sorry, this reduced the frequency of the problem. This is still not the best workaround.

/bin/systemctl stop avahi-daemon.service
does not work as I expected.

2 comments:

Kyaw Thu Soe said...

This exact bug is still there in systemd 230 Jessie backport.

mmapp said...

Hello, Kyaw Thu Soe,

The "A stop job is running for ..." issue is present.

This is August 2016. The systemd developers claimed that systemd was first developed in ___. Such a long history, I thought. However, the quality is not as high as expected, sparking a lot of criticism.

RSS