Slow shutdown or reboot Ubuntu using systemd

You can find out what causing slow shutdown or reboot by enabling journal:

# mkdir /var/log/journal
# reboot

then:
# reboot

then see previous log:
# journalctl -b -1

I found cups-browsed causing slow shutdown on my system, use this script to kill it before shutdown:

Create  /etc/systemd/system/beforeshutdown.service

[Unit]
Description=Script before shutdown

[Service]
ExecStart=/bin/true
ExecStop=/usr/bin/killall -9 -r cups
Type=oneshot
RemainAfterExit=true

[Install]
WantedBy=multi-user.target


Enable and start it:
# systemctl enable beforeshutdown
# systemctl start beforeshutdown

Try to shutdown:
# halt

Comments

Popular posts from this blog

Ports to allow for whatsapp call

Manually clean up zimbra zmcat/zmcpustat exploit

Keychron K2 in Linux