1

I am running Archlinux with kernel 5.7.0-arch1-1 (linux@archlinux), from the 5.4ish kernels, systemd takes ~10 seconds to suspend my laptop. Here are the problems with systemctl suspend:

  1. Turns networkmanager off immediately.
  2. Doesn't do anything for 10 seconds or so.

Then it suspends, but when it wakes up:

  1. Network manager takes a long time to scan and connect to the wifi network.

Solution:

If I do # echo mem > /sys/power/state, it suspends immediately, no networkmanager problem whatsoever. It just works very quickly.


But I am unsure why systemctl suspend takes so long time but echo mem > /sys/power/state takes no time at all.

I have read this but still unsure of the effects of using the echo command directly instead of systemd, to be honest, I am a bit afraid of losing my data (if systemctl suspend flushes any unwritten data to the IO devices) if I do the later.


System Details

cat /proc/version

Linux version 5.7.0-arch1-1 (linux@archlinux) (gcc version 10.1.0 (GCC), GNU ld (GNU Binutils) 2.34.0) #1 SMP PREEMPT Mon, 01 Jun 2020 22:54:03 +0000

free -h

              total        used        free      shared  buff/cache   available
Mem:          3.7Gi       1.4Gi       1.4Gi       274Mi       910Mi       1.8Gi
Swap:         4.0Gi          0B       4.0Gi

cat /proc/swaps

Filename                Type        Size    Used    Priority
/dev/zram0              partition   4194300 0       -2

Is frequently running the echo command to suspend the system a good choice?

1 Answer 1

2

I assume the main concern is losing data. If you run sync first, the disks should perform any remaining IO operations and data loss should not be an issue. There might be applications that are confused or systemd services that are notified that the computer is put to sleep, but I can't envision any serious issues with running sync and then modify /sys/power/state. As long as your machine is not a server, and you don't mind restarting it if it should have unusual behavior, I think it should be fine. I would always run sync first, though.

1
  • I also run a Puma server for Ruby on rails in development mode, and I tend to suspend my system often when I leave my room, and I faced no problem so far... But it just takes a long time to suspend, no matter 10s of apps are open or even no programs are opened at all!
    – 15 Volts
    Commented Jun 8, 2020 at 9:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .