12

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?

3 Answers 3

9

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

0
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).

1
  • Thanks for your answer. Although you were the fastest answering it correctly, the other answer provided a useful link for me.
    – cytopia
    Feb 22, 2017 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

You must log in to answer this question.

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