Timed Shutdown/Hibernate during SSH Session

Hi all! I’d run into an oddity, have seen some partially related topics, USB-Ethernet Udev TLP Upowerd, but nothing really included disabling this behavior.

Thought I’d share my progress, if someone runs into something similar:

I run a Manjaro Gnome minimal installation as a workstation for software development. Most of the time I use a lightweight laptop as a thin-client and connect to the workstation via SSH and use NeoVim on my workstation/server. This allows me to work with substantial performance everywhere I go, without having noticeable latency.
The Motherboard that I’m Using for the machine is an Gigabyte Aorus B550m Pro-P rev1. Since there are lots of issues with Gigabyte regarding the RLTK 2.5 gbit Lan controller, I was forced to use an 1gbit USB-Ethernet adapter.

The issue:
When I’m connected to the machine via SSH, at some point the PSU toggles off/on (takes 1 sec). This happens after a certain interval. After that the SSH session still (kinda) lives, the thing you’ll notice is that the terminal freezes on the client machine. It will take approx 2 to 5 minutes to continue what you where doing.
The behavior doesn’t care if there are user processes running. Even during compiling, or other heavy workloads. So it can be a bit annoying :face_with_raised_eyebrow:

The reason I removed TLP: After finding the error message below and reading the TLP documentation, I don’t necessarily need this type of power management on this machine.

/usr/lib/systemd/system-sleep/tlp failed with exit status 1.

This, I thought, disabled the behavior. And didn’t occur for a couple of days. But as I’m writing this, sitting in the room next of the machine, I hear the power supply toggle.

So, I was wondering what triggered this:

journalctl -n 200 --no-pager

mei 17 20:30:51 HVSR gnome-shell[744]: pushModal: invocation of begin_modal failed
mei 17 20:30:51 HVSR gnome-shell[744]: pushModal: invocation of begin_modal failed
mei 17 20:30:51 HVSR gnome-shell[744]: error: Unable to lock: Lock was blocked by an application

// 15 min timed trigger

mei 17 20:45:51 HVSR NetworkManager[573]: <info>   manager: sleep: sleep requested (sleeping: no  enabled: yes)
mei 17 20:45:51 HVSR NetworkManager[573]: <info> device (wlp4s0): state change: unavailable -> unmanaged (reason 'sleeping', sys-iface-state: 'managed')
mei 17 20:45:51 HVSR ModemManager[565]: <info>  system is about to suspend
mei 17 20:45:51 HVSR NetworkManager[573]: <info> device (wlp4s0): set-hw-addr: reset MAC address to xxxx (unmanage)
mei 17 20:45:51 HVSR NetworkManager[573]: <info>  manager: NetworkManager state is now ASLEEP
mei 17 20:45:51 HVSR gnome-shell[744]: pushModal: invocation of begin_modal failed
mei 17 20:45:51 HVSR gnome-shell[744]: pushModal: invocation of begin_modal failed
mei 17 20:45:51 HVSR gnome-shell[744]: error: Unable to lock: Lock was blocked by an application
mei 17 20:45:56 HVSR systemd-logind[531]: Delay lock is active (UID 120/gdm, PID 744/gnome-shell) but inhibitor timeout is reached.

// reached target

mei 17 20:45:56 HVSR systemd[1]: Reached target Sleep.
mei 17 20:45:56 HVSR systemd[1]: Starting Suspend...
mei 17 20:45:56 HVSR systemd-sleep[1442]: Suspending system...
mei 17 20:45:56 HVSR kernel: PM: suspend entry (deep)
mei 17 20:45:56 HVSR kernel: Filesystems sync: 0.005 seconds
// etc

Check status of

systemctl status sleep.target
● sleep.target - Sleep
 Loaded: loaded (/usr/lib/systemd/system/sleep.target; static)
 Active: inactive (dead)
   Docs: man:systemd.special(7)

mei 17 20:25:47 HVSR systemd[1]: Reached target Sleep.
mei 17 20:25:51 HVSR systemd[1]: Stopped target Sleep.
mei 17 20:45:56 HVSR systemd[1]: Reached target Sleep.
mei 17 20:46:01 HVSR systemd[1]: Stopped target Sleep.
mei 17 21:06:06 HVSR systemd[1]: Reached target Sleep.
mei 17 21:06:11 HVSR systemd[1]: Stopped target Sleep.
mei 17 21:26:16 HVSR systemd[1]: Reached target Sleep.
mei 17 21:26:21 HVSR systemd[1]: Stopped target Sleep.

Eventually masking systemd.sleep* disables this behavior

sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
systemctl status sleep.target
● sleep.target
 Loaded: masked (Reason: Unit sleep.target is masked.)
 Active: inactive (dead)

Still
I’m not sure of if USB Net device registration @ udev causes a kind of innactivity flag to the system. And would it solve the problem if a PCI device is used (or symlink as).
Also, not sure if its a Gnome related, I haven’t tested it on KDE & XFCE.


TLDR, steps how I disabled this behavior:

--super user do
pacman -R tlp   --remove tlp 
mkinitcpio -p   --to be certain
update-grub     --ref new images 
reboot

--symlink targets to null
systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target 

--bob is your uncle

Feel free to correct me!


inxi:

 System:
   Kernel: 5.11.18-1-MANJARO x86_64 bits: 64 compiler: gcc v: 10.2.0 
   parameters: BOOT_IMAGE=/boot/vmlinuz-5.11-x86_64 
   root=UUID=XXXX rw udev.log_priority=2 
   Console: tty pts/0 DM: GDM 40.0 Distro: Manjaro Linux base: Arch Linux 
 Machine:
   Type: Desktop Mobo: Gigabyte model: B550M AORUS PRO-P v: x.x 
   serial: <filter> UEFI: American Megatrends LLC. v: F13c date: 02/17/2021 
 Memory:
   RAM: total: 31.36 GiB used: 1015.1 MiB (3.2%) 
   RAM Report: permissions: Unable to run dmidecode. Root privileges required. 
 CPU:
   Info: 8-Core model: AMD Ryzen 7 5800X bits: 64 type: MT MCP arch: Zen 3 
   family: 19 (25) model-id: 21 (33) stepping: 0 microcode: A201009 cache: 
   L2: 4 MiB bogomips: 121432 
   Speed: 2871 MHz min/max: 2200/3800 MHz boost: enabled Core speeds (MHz): 
   1: 2871 2: 3589 3: 2868 4: 2870 5: 2864 6: 2871 7: 2922 8: 2866 9: 2876 
   10: 2870 11: 2871 12: 2867 13: 2870 14: 2868 15: 3274 16: 3588 
   Flags: 3dnowprefetch abm adx aes aperfmperf apic arat avic avx avx2 bmi1 
   bmi2 bpext cat_l3 cdp_l3 clflush clflushopt clwb clzero cmov cmp_legacy 
   constant_tsc cpb cpuid cqm cqm_llc cqm_mbm_local cqm_mbm_total cqm_occup_llc 
   cr8_legacy cx16 cx8 de decodeassists erms extapic extd_apicid f16c 
   flushbyasid fma fpu fsgsbase fsrm fxsr fxsr_opt ht hw_pstate ibpb ibrs ibs 
   invpcid irperf lahf_lm lbrv lm mba mca mce misalignsse mmx mmxext monitor 
   movbe msr mtrr mwaitx nonstop_tsc nopl npt nrip_save nx ospke osvw 
   overflow_recov pae pat pausefilter pclmulqdq pdpe1gb perfctr_core 
   perfctr_llc perfctr_nb pfthreshold pge pku pni popcnt pse pse36 rdpid rdpru 
   rdrand rdseed rdt_a rdtscp rep_good sep sha_ni skinit smap smca smep ssbd 
   sse sse2 sse4_1 sse4_2 sse4a ssse3 stibp succor svm svm_lock syscall tce 
   topoext tsc tsc_scale umip v_vmsave_vmload vaes vgif vmcb_clean vme vmmcall 
   vpclmulqdq wbnoinvd wdt xgetbv1 xsave xsavec xsaveerptr xsaveopt xsaves 
   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: Full AMD retpoline, IBPB: conditional, IBRS_FW, 
   STIBP: always-on, RSB filling 
   Type: srbds status: Not affected 
   Type: tsx_async_abort status: Not affected 
 Graphics:
   Device-1: NVIDIA GP102 [GeForce GTX 1080 Ti] driver: nvidia v: 460.73.01 
   alternate: nouveau,nvidia_drm bus-ID: 06:00.0 chip-ID: 10de:1b06 
   class-ID: 0300 
   Display: server: X.org 1.20.11 compositor: gnome-shell driver: 
   loaded: nvidia tty: 237x58 
   Message: Advanced graphics data unavailable in console. Try -G --display 
 Audio:
   Device-1: NVIDIA GP102 HDMI Audio driver: snd_hda_intel v: kernel 
   bus-ID: 06:00.1 chip-ID: 10de:10ef class-ID: 0403 
   Device-2: AMD Starship/Matisse HD Audio vendor: Gigabyte 
   driver: snd_hda_intel v: kernel bus-ID: 08:00.4 chip-ID: 1022:1487 
   class-ID: 0403 
   Sound Server-1: ALSA v: k5.11.18-1-MANJARO running: yes 
   Sound Server-2: JACK v: 0.125.0 running: no 
   Sound Server-3: PulseAudio v: 14.2 running: yes 
   Sound Server-4: PipeWire v: 0.3.26 running: no 
 Network:
   Device-1: Intel Wi-Fi 6 AX200 driver: iwlwifi v: kernel bus-ID: 04:00.0 
   chip-ID: 8086:2723 class-ID: 0280 
   IF: wlp4s0 state: down mac: <filter> 
   Device-2: TP-Link UE300 10/100/1000 LAN (ethernet mode) [Realtek RTL8153] 
   type: USB driver: r8152 bus-ID: 4-3:2 chip-ID: 2357:0601 class-ID: 0000 
   serial: <filter> 
   IF: enp8s0f3u3 state: up speed: 1000 Mbps duplex: full mac: <filter> 
   IP v4: <filter> type: dynamic noprefixroute scope: global 
   broadcast: <filter> 
   IP v6: <filter> type: dynamic noprefixroute scope: global 
   IP v6: <filter> type: noprefixroute scope: link 
   IF-ID-1: virbr0 state: down mac: <filter> 
   IP v4: <filter> scope: global broadcast: <filter> 
   WAN IP: <filter> 
 USB:
   Hub-1: 1-0:1 info: Full speed (or root) Hub ports: 10 rev: 2.0 
   speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900 
   Device-1: 1-9:2 info: Integrated Express ITE Device type: HID 
   driver: hid-generic,usbhid interfaces: 1 rev: 2.0 speed: 12 Mb/s 
   power: 100mA chip-ID: 048d:5702 class-ID: 0300 
   Hub-2: 1-10:3 info: Genesys Logic Hub ports: 4 rev: 2.0 speed: 480 Mb/s 
   power: 100mA chip-ID: 05e3:0608 class-ID: 0900 
   Hub-3: 2-0:1 info: Full speed (or root) Hub ports: 4 rev: 3.1 speed: 10 Gb/s 
   chip-ID: 1d6b:0003 class-ID: 0900 
   Hub-4: 3-0:1 info: Full speed (or root) Hub ports: 4 rev: 2.0 
   speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900 
   Hub-5: 4-0:1 info: Full speed (or root) Hub ports: 4 rev: 3.1 speed: 10 Gb/s 
   chip-ID: 1d6b:0003 class-ID: 0900 
   Device-1: 4-3:2 
   info: TP-Link UE300 10/100/1000 LAN (ethernet mode) [Realtek RTL8153] 
   type: Network driver: r8152 interfaces: 1 rev: 3.0 speed: 5 Gb/s 
   power: 256mA chip-ID: 2357:0601 class-ID: 0000 serial: <filter> 
 Sensors:
   System Temperatures: cpu: 33.4 C mobo: 16.8 C 
   Fan Speeds (RPM): N/A 
 Info:
   Processes: 307 Uptime: 45m wakeups: 0 Init: systemd v: 247 tool: systemctl 
   Compilers: gcc: 10.2.0 Packages: pacman: 1100 lib: 307 Shell: Zsh v: 5.8 
   running-in: tty pts/0 (SSH) inxi: 3.3.04 

Cheers

1 Like

I’t works, but does it count as an actual solution?

--super user do
pacman -R tlp   --remove tlp 
mkinitcpio -p   --to be certain
update-grub     --ref new images 
reboot

--symlink targets to null
systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target 

--bob is your uncle
1 Like

Did you check the energy settings of the desktop environment?
It’s probably configured/deciding to go to sleep after a certain amount of time due to not seeing activity on any (local) input devices.

Thanks for your reply, I did check it indeed. The funny thing is though: if I use the host directly and log in to a Gnome desktop session, lock the desktop and SSH into it via my laptop. I don’t get the timed shutdown behavior.

Power settings:
  no screen dimming
  no auto blank screen
  no auto suspend
  no WiFi + BT override
  -during inactive

Hmm, so this might be a default somewhere which gets overriden by your locked local session but not when only logged in via ssh remotely?

Yes exactly! What I suspect is the USB Ethernet device, which is handled differently by UDev than PCI. Probably its flagged by the kernel as !inactive.

An I340-T4 PCI-E network adapter is in the mail. I will do some testing and report my findings.

Cheers!

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.