Slow Shutdown/Long time to Enter i3 when External Monitor is Plugged In

Hi,
My boot and sleep has suddenly slowed on my XPS 13 9310. My boot time has slowed significantly, and it takes 3+ minutes to go from logging in on the splash screen to entering i3. This long time to enter the DE persists when using Plasma. Time to sleep has also increased significantly (systemctl suspend took 2:40). Oddly enough, this only happens when my external monitor is plugged in.
systemd-analyze gives me nothing:

Startup finished in 6.847s (firmware) + 2.714s (loader) + 894ms (kernel) + 2.753s (userspace) = 13.210s 

nor does systemd-analyze blame

1.790s tlp.service
1.514s systemd-random-seed.service
 902ms dev-loop7.device
 861ms dev-loop6.device
 857ms dev-loop4.device
 856ms dev-loop5.device
 856ms dev-loop0.device
 856ms dev-loop1.device
 852ms dev-loop2.device
 851ms dev-loop3.device
 551ms var-lib-snapd-snap-core18-2128.mount
 549ms var-lib-snapd-snap-spotify-53.mount
 548ms var-lib-snapd-snap-gtk\x2dcommon\x2dthemes-1519.mount
 544ms var-lib-snapd-snap-bare-5.mount
 544ms var-lib-snapd-snap-gnome\x2d3\x2d28\x2d1804-161.mount
 544ms var-lib-snapd-snap-snapd-13640.mount
 542ms var-lib-snapd-snap-todoist-14.mount
 540ms var-lib-snapd-snap-snapd-13270.mount
 530ms dev-nvme0n1p7.device
 193ms apparmor.service
 168ms snapd.service
 124ms systemd-backlight@backlight:intel_backlight.service
  77ms user@1000.service
  74ms udisks2.service
  73ms systemd-modules-load.service
  67ms systemd-backlight@leds:dell::kbd_backlight.service
  59ms systemd-udev-trigger.service
  56ms upower.service
  44ms systemd-logind.service
  38ms polkit.service
  37ms modprobe@drm.service
  36ms boot-efi.mount
  36ms systemd-udevd.service
  34ms systemd-journald.service
  29ms mnt-OS.mount
  26ms avahi-daemon.service
  23ms NetworkManager.service
  21ms cups.service
  20ms snapd.apparmor.service
  18ms bluetooth.service
  18ms systemd-fsck@dev-disk-by\x2duuid-FE71\x2dE7E0.service
  16ms systemd-tmpfiles-setup.service
  15ms systemd-tmpfiles-setup-dev.service
  10ms modprobe@fuse.service
  10ms systemd-rfkill.service
   9ms alsa-restore.service
   7ms wpa_supplicant.service
   7ms dev-hugepages.mount
   7ms systemd-binfmt.service
   7ms dev-mqueue.mount
   6ms sys-kernel-debug.mount
   6ms sys-kernel-tracing.mount
   6ms systemd-sysctl.service
   5ms tmp.mount
   4ms kmod-static-nodes.service
   4ms systemd-journal-flush.service
   4ms modprobe@configfs.service
   4ms linux-module-cleanup.service
   4ms systemd-remount-fs.service
   3ms user-runtime-dir@1000.service
   3ms systemd-update-utmp.service
   2ms systemd-user-sessions.service
   1ms rtkit-daemon.service
   1ms proc-sys-fs-binfmt_misc.mount

inxi -Fzy

System:
  Kernel: 5.13.19-2-MANJARO x86_64 bits: 64 Desktop: i3 4.19.1
  Distro: Manjaro Linux
Machine:
  Type: Laptop System: Dell product: XPS 13 9310 v: N/A serial: <filter>
  Mobo: Dell model: 0DMPXV v: A00 serial: <filter> UEFI: Dell v: 3.0.4
  date: 07/16/2021
Battery:
  ID-1: BAT0 charge: 51.0 Wh (100.0%) condition: 51.0/51.0 Wh (100.0%)
CPU:
  Info: Quad Core model: 11th Gen Intel Core i7-1185G7 bits: 64 type: MT MCP
  cache: L2: 12 MiB
  Speed: 1037 MHz min/max: 400/4800 MHz Core speeds (MHz): 1: 1037 2: 1427
  3: 1332 4: 1133 5: 998 6: 1101 7: 1105 8: 1203
Graphics:
  Device-1: Intel TigerLake-LP GT2 [Iris Xe Graphics] driver: i915 v: kernel
  Device-2: Microdia Integrated_Webcam_HD type: USB driver: uvcvideo
  Display: x11 server: X.Org 1.20.13 driver: loaded: modesetting resolution:
  1: 1920x1200~60Hz 2: 1920x1080
  OpenGL: renderer: Mesa Intel Xe Graphics (TGL GT2) v: 4.6 Mesa 21.2.3
Audio:
  Device-1: Intel Tiger Lake-LP Smart Sound Audio
  driver: sof-audio-pci-intel-tgl
  Sound Server-1: ALSA v: k5.13.19-2-MANJARO running: yes
  Sound Server-2: PipeWire v: 0.3.38 running: yes
Network:
  Device-1: Qualcomm QCA6390 Wireless Network Adapter [AX500-DBS ]
  driver: ath11k_pci
  IF: wlp114s0 state: up mac: <filter>
Drives:
  Local Storage: total: 953.87 GiB used: 104.02 GiB (10.9%)
  ID-1: /dev/nvme0n1 vendor: Western Digital model: PC SN730 NVMe WDC 1024GB
  size: 953.87 GiB
Partition:
  ID-1: / size: 383.43 GiB used: 22.14 GiB (5.8%) fs: ext4 dev: /dev/nvme0n1p7
  ID-2: /boot/efi size: 186 MiB used: 105.4 MiB (56.7%) fs: vfat
  dev: /dev/nvme0n1p1
Swap:
  Alert: No swap data was found.
Sensors:
  System Temperatures: cpu: N/A mobo: N/A
  Fan Speeds (RPM): cpu: 0 fan-2: 0
Info:
  Processes: 238 Uptime: 15m Memory: 31.08 GiB used: 2.43 GiB (7.8%)
  Shell: Zsh inxi: 3.3.08

Also tried installing haveged and enabling its service to no avail. Any other ideas/information that would be helpful? Thanks.

Thats because those measure other things. If your desktop login is relatively quick those commands are useful for looking at actual boot speed (like kernel modules and mounting, etc).

But in your case its the login or the starting graphics … or I dont know, because you omitted the a from your command, so I dont know if/which display manager you are using, which would be a good start.
(inxi -Fazy would be better)

1 Like

I just timed again - 45 seconds from exiting GRUB to the login screen (still much slower than i’d like, but systemd-analyze tells me nothing)

Startup finished in 6.823s (firmware) + 3.447s (loader) + 882ms (kernel) + 1.813s (userspace) = 12.967s 
graphical.target reached after 854ms in userspace

And 3 minutes again from login to i3 starting.
Here’s inxi-fazy

System:
  Kernel: 5.13.19-2-MANJARO x86_64 bits: 64 compiler: gcc v: 11.1.0
  parameters: BOOT_IMAGE=/boot/vmlinuz-5.13-x86_64
  root=UUID=73f64c48-669c-441a-a105-5fdb4b98758c rw quiet apparmor=1
  security=apparmor udev.log_priority=3
  Desktop: i3 4.19.1 info: i3bar vt: 1 dm: SDDM Distro: Manjaro Linux
  base: Arch Linux
Machine:
  Type: Laptop System: Dell product: XPS 13 9310 v: N/A serial: <filter>
  Chassis: type: 10 serial: <filter>
  Mobo: Dell model: 0DMPXV v: A00 serial: <filter> UEFI: Dell v: 3.0.4
  date: 07/16/2021
Battery:
  ID-1: BAT0 charge: 51.0 Wh (100.0%) condition: 51.0/51.0 Wh (100.0%)
  volts: 8.7 min: 7.6 model: BYD DELL FP86V0A type: Li-poly serial: <filter>
  status: Full
CPU:
  Info: Quad Core model: 11th Gen Intel Core i7-1185G7 bits: 64 type: MT MCP
  arch: Tiger Lake family: 6 model-id: 8C (140) stepping: 1 microcode: 88
  cache: L2: 12 MiB
  flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  bogomips: 47936
  Speed: 908 MHz min/max: 400/4800 MHz Core speeds (MHz): 1: 908 2: 2808
  3: 619 4: 569 5: 805 6: 867 7: 663 8: 727
  Vulnerabilities: Type: itlb_multihit status: Not affected
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: spec_store_bypass
  mitigation: Speculative Store Bypass disabled via prctl and seccomp
  Type: spectre_v1
  mitigation: usercopy/swapgs barriers and __user pointer sanitization
  Type: spectre_v2 mitigation: Enhanced IBRS, IBPB: conditional, RSB filling
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: Intel TigerLake-LP GT2 [Iris Xe Graphics] vendor: Dell
  driver: i915 v: kernel bus-ID: 00:02.0 chip-ID: 8086:9a49 class-ID: 0300
  Device-2: Microdia Integrated_Webcam_HD type: USB driver: uvcvideo
  bus-ID: 3-6:3 chip-ID: 0c45:672a class-ID: 0e02
  Display: x11 server: X.Org 1.20.13 driver: loaded: modesetting
  alternate: fbdev,vesa display-ID: :0 screens: 1
  Screen-1: 0 s-res: 3840x1200 s-dpi: 96 s-size: 1014x317mm (39.9x12.5")
  s-diag: 1062mm (41.8")
  Monitor-1: eDP-1 res: 1920x1200 hz: 60 dpi: 169 size: 288x180mm (11.3x7.1")
  diag: 340mm (13.4")
  Monitor-2: DP-1-3 res: 1920x1080 dpi: 92 size: 531x299mm (20.9x11.8")
  diag: 609mm (24")
  OpenGL: renderer: Mesa Intel Xe Graphics (TGL GT2) v: 4.6 Mesa 21.2.3
  direct render: Yes
Audio:
  Device-1: Intel Tiger Lake-LP Smart Sound Audio vendor: Dell
  driver: sof-audio-pci-intel-tgl
  alternate: snd_hda_intel,snd_sof_pci_intel_tgl bus-ID: 00:1f.3
  chip-ID: 8086:a0c8 class-ID: 0401
  Sound Server-1: ALSA v: k5.13.19-2-MANJARO running: yes
  Sound Server-2: JACK v: 1.9.19 running: no
  Sound Server-3: PulseAudio v: 15.0 running: no
  Sound Server-4: PipeWire v: 0.3.38 running: yes
Network:
  Device-1: Qualcomm QCA6390 Wireless Network Adapter [AX500-DBS ]
  vendor: Rivet Networks driver: ath11k_pci v: kernel bus-ID: 72:00.0
  chip-ID: 17cb:1101 class-ID: 0280
  IF: wlp114s0 state: up mac: <filter>
Drives:
  Local Storage: total: 953.87 GiB used: 104.03 GiB (10.9%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Western Digital
  model: PC SN730 NVMe WDC 1024GB size: 953.87 GiB block-size: physical: 512 B
  logical: 512 B speed: 31.6 Gb/s lanes: 4 type: SSD serial: <filter>
  rev: 11150012 temp: 42.9 C scheme: GPT
Partition:
  ID-1: / raw-size: 390.62 GiB size: 383.43 GiB (98.16%)
  used: 22.15 GiB (5.8%) fs: ext4 dev: /dev/nvme0n1p7 maj-min: 259:7
  ID-2: /boot/efi raw-size: 190 MiB size: 186 MiB (97.89%)
  used: 105.4 MiB (56.7%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
Swap:
  Alert: No swap data was found.
Sensors:
  System Temperatures: cpu: N/A mobo: N/A
  Fan Speeds (RPM): cpu: 0 fan-2: 0
Info:
  Processes: 259 Uptime: 4m wakeups: 5 Memory: 31.08 GiB used: 1.75 GiB (5.6%)
  Init: systemd v: 249 tool: systemctl Compilers: gcc: 11.1.0 Packages: 1335
  pacman: 1327 lib: 392 flatpak: 0 snap: 8 Shell: Zsh v: 5.8 default: Bash
  v: 5.1.8 running-in: konsole inxi: 3.3.08

Thanks for the quick response - let me know if anything else would be helpful!

edit: just tried systemctl suspend - it took 2:40 so idk if that’s related to anything lol

edit 2: ok for some reason everything works fine when my dongle with my external monitor/keyboard/mouse/graphics tablet aren’t plugged in - no clue wtf is going on

Mk… quick thing.
Try removing Xauthority:

rm ~/.Xauthority

Then log out -do not reboot- and log in again.
Check that and a subsequent reboot.