Question about forced log out command for Plasma Login Manager

Have a small question, I use a command to force logout by quickly closing GUI session

sudo systemctl restart sddm

Since Plasma Login Manager will be available upcoming Stable update, is this command gonna change or remain same if I use PLM? Since PLM still uses systemd in backend…

Also If anyone knows why this command should be normally avoided, and loginctl should be used, please reply, that’d be nice to know.

I only use this supposedly nuclear option very rarely when nothing important is running and system is starting to freeze to something like accidentally opening/starting heavy process and I know hard power off would be only option to recover due to HDD swap slowness.

In the case of plasma-login-manager, the command would be… :backhand_index_pointing_down:

sudo systemctl stop plasmalogin

It’s a brute-force shutdown of your GUI session, and therefore not recommended unless you’ve already logged out.

3 Likes

No, try qdbus org.kde.Shutdown /Shutdown logout instead. Force crashing everything is really not a good idea. You’ll mess things at some point.

2 Likes

Thanks!

1 Like

Instead of signing off you can use systemctl soft-reboot which will ensure services are gracefully reset.

3 Likes

For a clean and tidy logout, I find the best command is:
qdbus6 org.kde.Shutdown /Shutdown logout
Though personally I like to tidily close all the open windows (as much as possible) before my logout script issues that command.

Restarting SDDM (with auto-login enabled) is, however, a great way to automate logging in in the first place when the computer’s sitting at the login screen. My home automation system uses that to bring up my desktop when I’ve been out and come back into the house (as well as first thing in the morning).

1 Like

Some pre-prepared instructions for correctly exiting a Plasma session:


This first group of commands will exit a Plasma session the correct and fastest way:

To log out of Plasma & return to the login screen:

qdbus org.kde.Shutdown /Shutdown logout

To log out of Plasma & reboot:

qdbus org.kde.Shutdown /Shutdown logoutAndReboot

To log out of Plasma and shutdown the system:

qdbus org.kde.Shutdown /Shutdown logoutAndShutdown

To display the shutdown options page with the countdown timer first, any of these:

qdbus org.kde.LogoutPrompt /LogoutPrompt promptLogout

qdbus org.kde.LogoutPrompt /LogoutPrompt promptReboot

qdbus org.kde.LogoutPrompt /LogoutPrompt promptShutDown

You can also put your machine to sleep without logging out of Plasma:

systemctl suspend

Or, hibernate it:

systemctl hibernate

Please note that the following commands are not the correct way to exit a Plasma session. Logout scripts won’t be run, and open applications may not be closed correctly. Unsaved data may be lost.

To shutdown a systemd-based system (such as Manjaro) the same way as shutdown now:

systemctl poweroff

Or, to reboot it:

systemctl reboot
3 Likes

Out of curiosity, are there any advantages to using these over the simpler poweroff or reboot?

Probably no difference, as the poweroff & reboot commands are just links to systemctl anyway:

ls -la /usr/bin/reboot* && ls -la /usr/bin/poweroff*

lrwxrwxrwx 1 root root 9 Feb  8 02:23 /usr/bin/reboot -> systemctl
lrwxrwxrwx 1 root root 9 Feb  8 02:23 /usr/bin/poweroff -> systemctl
1 Like

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