Recently every time I shut down or reboot my laptop, it is slow to shut down, and shows the following message:

A stop job is running for Session c1 of User gdm
I tried several similar questions that mention installing watchdog
or reconfiguring dgm3
, but they don't seem to work in my case.
Some answers suggest setting DefaultTimeoutStopSec
but this doesn't seem to solve the root of the problem, in the sense that the service should be able to stop in timely manner.
My questions is how to determine why the stop job is failing to stop the service, and how can I correct it sow the computer can shut down quickly as it used to?
With the help of @steeldriver I was able to get a log of the shutdown procedure, but I am still not able to figure out how to fix it.
[ 308.828908] audit: type=1400 audit(1678991943.886:84): apparmor="DENIED" operation="open" class="file" profile="snap-update-ns.firefox" name="/var/lib/" pid=7631 comm="5" requested_mask="r" denied_mask="r" f>
[ 308.829327] audit: type=1400 audit(1678991943.886:85): apparmor="DENIED" operation="open" class="file" profile="snap-update-ns.firefox" name="/var/lib/" pid=7631 comm="5" requested_mask="r" denied_mask="r" f>
[ 309.222571] audit: type=1400 audit(1678991944.278:86): apparmor="DENIED" operation="open" class="file" profile="snap.firefox.firefox" name="/etc/igfx_user_feature.txt" pid=7706 comm="firefox" requested_mask=>
[ 309.223009] audit: type=1400 audit(1678991944.278:87): apparmor="DENIED" operation="open" class="file" profile="snap.firefox.firefox" name="/etc/igfx_user_feature.txt" pid=7706 comm="firefox" requested_mask=>
[ 309.223924] audit: type=1400 audit(1678991944.278:88): apparmor="DENIED" operation="open" class="file" profile="snap.firefox.firefox" name="/etc/igfx_user_feature.txt" pid=7706 comm="firefox" requested_mask=>
[ 309.224330] audit: type=1400 audit(1678991944.282:89): apparmor="DENIED" operation="open" class="file" profile="snap.firefox.firefox" name="/etc/igfx_user_feature.txt" pid=7706 comm="firefox" requested_mask=>
[ 309.224340] audit: type=1400 audit(1678991944.282:90): apparmor="DENIED" operation="open" class="file" profile="snap.firefox.firefox" name="/etc/igfx_user_feature.txt" pid=7706 comm="firefox" requested_mask=>
[ 309.224347] audit: type=1400 audit(1678991944.282:91): apparmor="DENIED" operation="open" class="file" profile="snap.firefox.firefox" name="/etc/igfx_user_feature.txt" pid=7706 comm="firefox" requested_mask=>
[ 309.224360] audit: type=1400 audit(1678991944.282:92): apparmor="DENIED" operation="open" class="file" profile="snap.firefox.firefox" name="/etc/igfx_user_feature.txt" pid=7706 comm="firefox" requested_mask=>
[ 309.224389] audit: type=1400 audit(1678991944.282:93): apparmor="DENIED" operation="open" class="file" profile="snap.firefox.firefox" name="/etc/igfx_user_feature.txt" pid=7706 comm="firefox" requested_mask=>
[ 335.174797] kauditd_printk_skb: 5 callbacks suppressed
[ 335.174800] audit: type=1107 audit(1678991970.224:99): pid=1311 uid=102 auid=4294967295 ses=4294967295 subj=unconfined msg='apparmor="DENIED" operation="dbus_method_call" bus="system" path="/org/freedesktop>
exe="/usr/bin/dbus-daemon" sauid=102 hostname=? addr=? terminal=?'
[ 388.635030] rfkill: input handler enabled
[ 389.810597] ACPI BIOS Error (bug): Could not resolve symbol [\_TZ.ETMD], AE_NOT_FOUND (20220331/psargs-330)
[ 389.810631] No Local Variables are initialized for Method [_OSC]
[ 389.810636] Initialized Arguments for Method [_OSC]: (4 arguments defined for method invocation)
[ 389.810639] Arg0: 00000000773fb10f <Obj> Buffer(16) 5D A8 3B B2 B7 C8 42 35
[ 389.810662] Arg1: 0000000038c2bc32 <Obj> Integer 0000000000000001
[ 389.810673] Arg2: 000000005d327c75 <Obj> Integer 0000000000000002
[ 389.810681] Arg3: 00000000f7ca0178 <Obj> Buffer(8) 00 00 00 00 00 00 00 00
[ 389.810704] ACPI Error: Aborting method \_SB.IETM._OSC due to previous error (AE_NOT_FOUND) (20220331/psparse-529)
[ 479.161836] r8169 0000:39:00.0 enp57s0: Link is Down
[ 479.206104] wlp0s20f3: deauthenticating from 60:ce:86:8f:5c:3b by local choice (Reason: 3=DEAUTH_LEAVING)
[ 479.570797] EXT4-fs (nvme0n1p2): unmounting filesystem.
[ 479.845965] systemd-shutdown[1]: Syncing filesystems and block devices.
[ 479.862264] systemd-shutdown[1]: Sending SIGTERM to remaining processes...
[ 479.864884] systemd-journald[820]: Received SIGTERM from PID 1 (systemd-shutdow).
[ 479.895325] systemd-shutdown[1]: Sending SIGKILL to remaining processes...
[ 479.899820] systemd-shutdown[1]: Unmounting file systems.
[ 479.900966] [8762]: Remounting '/' read-only in with options 'errors=remount-ro,stripe=32'.
[ 480.202152] EXT4-fs (dm-1): re-mounted. Quota mode: none.
[ 480.300538] systemd-shutdown[1]: All filesystems unmounted.
[ 480.300543] systemd-shutdown[1]: Deactivating swaps.
[ 480.300594] systemd-shutdown[1]: All swaps deactivated.
[ 480.300596] systemd-shutdown[1]: Detaching loop devices.
[ 480.302311] systemd-shutdown[1]: All loop devices detached.
[ 480.302313] systemd-shutdown[1]: Stopping MD devices.
[ 480.302379] systemd-shutdown[1]: All MD devices stopped.
[ 480.302381] systemd-shutdown[1]: Detaching DM devices.
[ 480.302661] systemd-shutdown[1]: Detaching DM /dev/dm-2 (253:2).
[ 480.345817] systemd-shutdown[1]: Detaching DM /dev/dm-0 (253:0).
[ 480.346518] systemd-shutdown[1]: Could not detach DM /dev/dm-0: Device or resource busy
[ 480.346524] systemd-shutdown[1]: Not all DM devices detached, 2 left.
[ 480.346777] systemd-shutdown[1]: Detaching DM devices.
[ 480.347377] systemd-shutdown[1]: Detaching DM /dev/dm-0 (253:0).
[ 480.347912] systemd-shutdown[1]: Could not detach DM /dev/dm-0: Device or resource busy
[ 480.347917] systemd-shutdown[1]: Not all DM devices detached, 2 left.
[ 480.347922] systemd-shutdown[1]: Cannot finalize remaining DM devices, continuing.
[ 480.360045] EXT4-fs (dm-1): re-mounted. Quota mode: none.
With the help of @RobertRiedl I think I was able to track down the problematic service to session-c1.scope
. Here is the relevant output:
Μαρ 22 21:44:07 idefix systemd[1]: Stopping Session c1 of User gdm...
Μαρ 22 21:45:37 idefix systemd[1]: session-c1.scope: Stopping timed out. Killing.
Μαρ 22 21:45:37 idefix systemd[1]: session-c1.scope: Killing process 2431 (speech-dispatch) with signal SIGKILL.
Μαρ 22 21:45:37 idefix systemd[1]: session-c1.scope: Killing process 2440 (threaded-ml) with signal SIGKILL.
Μαρ 22 21:45:37 idefix systemd[1]: session-c1.scope: Failed with result 'timeout'.
Μαρ 22 21:45:37 idefix systemd[1]: Stopped Session c1 of User gdm.
Μαρ 22 21:45:37 idefix systemd[1]: session-c1.scope: Consumed 5.879s CPU time.