6

After days trying to fix suspend issues in my laptop. I would like to get rid of the Ubuntu suspend system and completely replace it with "S2RAM".

So basically when I press the Power button, the Sleep button, Close the lid: I just want my laptop to call "S2RAM" application, nothing more.

S2RAM is the only thing that works well in my laptop. If I type sudo S2RAM when I'm playing a video, my laptop goes off in less than 1 second, the Power led and keyboard go off instantly, then I wait some minutes, I press the power button and everything resumes perfectly.

So far I tried this without success:

sudo systemctl edit systemd-suspend.service

And add the following:

[Service]
Type=oneshot
ExecStart=/usr/sbin/s2ram

I also tried the following alternative (changing the path sometimes):

[Service]
ExecStart=
ExecStartPre=-/usr/bin/run-parts -v -a pre /usr/lib/systemd/system-sleep
ExecStart=/usr/sbin/s2ram
ExecStartPost=-/usr/bin/run-parts -v --reverse -a post /usr/sbin/s2ramlib/systemd/system-sleep

Followed by

systemctl daemon-reload

None of these options seem to work. Because if I type systemctl suspend:

  1. It is not instant like when running sudo S2RAM
  2. Sometimes hangs the system (just like always do)
  3. Sometimes turns off the screens and doesn't come back

So to me, S2RAM is not taking over at all the Ubuntu "suspend" approach.

Is there any other way to achieve this? I think it will be the only solution to make my Dell laptop sleep in Ubuntu. I tried more than 30 solutions, none worked except S2RAM application. I just need to know how to make it default

muru
  • 197,895
  • 55
  • 485
  • 740
sebastianer
  • 121
  • 1
  • 6
  • systemctl status systemd-suspend.service please. – nobody Dec 05 '20 at 09:35
  • 1
    Please post output of cat /etc/systemd/sleep.conf as well as systemctl list-dependencies systemd-suspend.service PS all s2ram does is echo mem | sudo tee /sys/power/state (I just checked https://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-utils.git/tree/) ;-) – Dagelf Dec 07 '20 at 21:44

2 Answers2

0

From your Desktop screen, press F1, then Ctrl + L and type man:systemd-suspend.service.8.
Repeat for man:systemd-sleep.conf.5.

You have more experience in this matter than me as evident in question, but I'm sure this might help.

0

I had the same situation on Ubuntu 20.04 with same symptoms on choosing "Suspend" button in Gnome as OP.

systemctl suspend was not working, but echo mem | sudo tee /sys/power/state did (which is what S2RAM is also doing). According to the manpage of "systemd-suspend.service" it's the same, what systemctl suspend is doing. So what are the differences?

Systemd is handling additional dependencies, that must return success before doing the "echo mem". So I checked the dependencies in the directory /etc/systemd/system/systemd-suspend.service.requires and found 2 links pointing to nvidia-driver-suspend stuff. I disabled them by renaming the directory as shown - may be there a better ways to do this.

cd /etc/systemd/system
sudo mv systemd-suspend.service.requires unused-systemd-supend.service.requires
sudo systemctl daemon-reload

systemctl suspend is now working and so Suspend works globally again also from Gnome Suspend button - which was my original problem.

mica
  • 1
  • 1