13

I found two working versions to properly suspend my notebook to RAM.

$ dbus-send --system --print-reply \
   --dest=org.freedesktop.login1 /org/freedesktop/login1 \
   "org.freedesktop.login1.Manager.Suspend" boolean:true

and

$ systemctl suspend

Which of the above is the one to use and what is the difference between those?

cytopia
  • 243

3 Answers3

10

AFAIK the correct command is systemctl suspend or hibernate as this command uses Systemd and is preferred since 16.04

Link to prior similar question. In the comments/answers section they say the old dbus method (which is your first example command) supposedly was deprecated

FrostedCookies
  • 446
  • 3
  • 10
1

In systems before 15.04 you use dbus approach only. On Ubuntu 15.04 and newer you use both, because Ubuntu started systemd init system. Both are proper, they just use different programs to achieve same result.

Difference is that systemd is an init system, which controls starting other processes at boot. dbus is an interprocess communication (IPC) system (also used by systemd).

Sergiy Kolodyazhnyy
  • 105,154
  • 20
  • 279
  • 497
  • Thanks for your answer. Although you were the fastest answering it correctly, the other answer provided a useful link for me. – cytopia Feb 22 '17 at 11:19
0

You could use qdbus, if available. This command may be useful whenever the Kickstart/menu button in KDE doesn't work (you click on the menu button or hit Alt + F1 but the menu won't open), which means you're unable to log out or hibernate.

The following commands should work with KDE 5 (Plasma).

Hibernate via command line:

qdbus org.kde.Solid.PowerManagement /org/freedesktop/PowerManagement CanHibernate && qdbus org.kde.Solid.PowerManagement /org/freedesktop/PowerManagement Hibernate

Suspend via command line:

qdbus org.kde.Solid.PowerManagement /org/freedesktop/PowerManagement CanSuspend && qdbus org.kde.Solid.PowerManagement /org/freedesktop/PowerManagement Suspend

Show logout screen via command line:

qdbus org.kde.ksmserver /KSMServer logout 1 3 3
basic6
  • 146
  • 4