Systemd Shutdown – Why Do Computers Take a Long Time to Shut Down?

arch linuxgnome3systemd

I have been using Arch Linux + GNOME 3 on both my computers (notebook and desktop) for over a year now. And all the time, computers were shutting down quickly (in 3 seconds). After a recent update of all packages on both computers via Pamac, the computers now take a long time to shut down (it takes about 2 minutes to wait before shutting down). I usually shutting down the computer through the GNOME 3 graphical interface.

What have I tried to do?

  1. Recently updated all packages again, but it didn't help.
  2. Used the command sudo systemctl --force --force poweroff, it helps and computers turn off quickly.
  3. Used the command sudo systemctl --force poweroff, in this case, the computer turns off in 1.5 minutes, and displays a message on the screen: systemd-shutdown[1]: Waiting for process: gnome-session-b, Xwayland, gsb-media-keys, dbus-daemon, pulseaudio, gsd-power, gnome-shell, systemd, gsd-wacom, gsd-xsettings, gsd-color.

UPD: When I ran the command sudo journalctl -b -1 -e --no-pager, I found the following time gap in the log:

Dec 24 18:05:28 archlinux systemd[497]: evolution-source-registry.service: Succeeded.
Dec 24 18:05:28 archlinux systemd[497]: evolution-calendar-factory.service: Succeeded.
Dec 24 18:05:28 archlinux systemd[497]: evolution-addressbook-factory.service: Succeeded.
Dec 24 18:07:28 archlinux systemd[1]: user@1000.service: State 'stop-sigterm' timed out. Killing.
Dec 24 18:07:28 archlinux systemd[1]: user@1000.service: Killing process 497 (systemd) with signal SIGKILL.
Dec 24 18:07:28 archlinux systemd[1]: user@1000.service: Killing process 1329 (dbus-daemon) with signal SIGKILL.
Dec 24 18:07:28 archlinux systemd[1]: user@1000.service: Main process exited, code=killed, status=9/KILL
Dec 24 18:07:28 archlinux systemd[1]: user@1000.service: Failed with result 'timeout'.
Dec 24 18:07:28 archlinux systemd[1]: Stopped User Manager for UID 1000.

UPD 2: I do not know if this is the right solution, but the solution given on this web page helped me:
bbs.archlinux.org/viewtopic.php?id=261530

Run command: systemctl edit --user gnome-session-restart-dbus.service
and add the following lines above ### Lines below this comment will be discarded:

[Service]
Slice=-.slice

Best Answer

Slow shutdown after an update can be caused by orphaned packages that are no longer used or required for anything following a software update. If so, searching for orphaned packages and uninstalling them will solve the problem.

List orphaned packages:

pacman -Qtdq

If the above command finds any orphaned packages you can uninstall them with pacman. Uninstalling orphaned packages one at a time is preferable to uninstalling all of them with a single command, because some packages that are reported as orphaned packages may still be required by another package if that package was manually downloaded and installed, not installed with pacman from your currently enabled software repositories.

Related Question