Slow shutdowns on occasion

Usually my shutdowns are 2 to 3 seconds. Sometimes it takes 30 to 45 seconds. Any way to find the reason?

I use shutdown -h now.

Would poweroff be quicker?

I fought with some shutdown problems in VMs and used this post on how to get systemd shutdown logging. I don’t know if it applies in 18.04.

@marfig was an excellent resource for many systemd issues and is greatly missed. He left with health problems last summer but I haven’t heard. Anyone?

Thanks. I am using 16.04.

I notice the delayed shut downs after installing and/or removing USB drives after the initial boot.

I fought with some shutdown problems in VMs and used this post on how to get systemd shutdown logging. I don’t know if it applies in 18.04.

I ran

   journalctl -rb -1

and got this.

    Specifying boot ID has no effect, no persistent journal was found

Same problem I had. Check the next posts in that thread, you need the directory:

sudo mkdir /var/log/journal

My guess is that before shutdown the system, apart from stopping the running services, checks for update and applies them. I found out that if I disconnect my Ethernet cable or just disconnect using the NM from within the system, shutdown is almost always consistently faster.

That rings true. If it is slow to shutdown and I press Esc to see where it is up to, it’s invariably some network issue - at least so far. Obviously it could just be my network even thought it is a simple set up.

Heathrobinson.

Made the directory /var/log/journal.

Will post the results of

   journalctl -rb -1

the next time a slow shutdown occurs.

Here are results after a long shutdown.

https://www.dropbox.com/s/7bva2e9cttr6j4f/shutdown.txt?dl=0

I have 18.04 running on a dual core and have noticed the same problem.
Here is the prime offender:

After that times out, it takes about 5 seconds for the system to drop.
I have also seen that message repeat 7 or 8 times before it times out and then shuts down.

I have not had the problem in over a month.

Maybe some self-healing occured.

?

shutdown from the Indicator Applet button takes almost a minute for me. my fix for this is calling "shutdown -h now" from a keyboard shortcut. so far so good.

sorry for reviving the topic, new to linux (from windows 7)