Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Software] Sudo + Xfce = no shutdown or reboot (Debain 11/12)

Graphical Environments, Managers, Multimedia & Desktop questions.
Post Reply
Message
Author
Gorg
Posts: 23
Joined: 2019-10-24 09:30

[Software] Sudo + Xfce = no shutdown or reboot (Debain 11/12)

#1 Post by Gorg »

Hi all,

I've run into an issue with Xfce on Debian 11 and 12 (Testing). When installed without root (sudo), the power manager options for shutdown and reboot are disabled. It's not possible to shut down the system via the power menu, instead `sudo systemctl poweroff` needs to be entered into the terminal (or any other shutdown command, for that matter).

Although systemctl is probably no userspace command, I don't think this is supposed to be intended behavior.

I've also briefly tried KDE and its power menu seems to work, although I also wasn't able to shut down without sudo from the terminal.

Any way to fix this or is this a known issue?

How to replicate: Install current Debian with sudo and Xfce and try a shutdown.

CwF
Global Moderator
Global Moderator
Posts: 2638
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 192 times

Re: [Software] Sudo + Xfce = no shutdown or reboot (Debain 11/12)

#2 Post by CwF »

Gorg wrote: 2023-03-09 23:55 Any way to fix this or is this a known issue?
Seems so.
I'm not inclined to test rootless installs...

viewtopic.php?t=154191
Instead of a forced edit. a better way to add a user to a group if package adduser is installed, and a root terminal of sorts available. Try group 'adm'

Code: Select all

# adduser User group
viewtopic.php?t=154204
this may give some ideas, the polkit rules should work without a root account I'd assume. And note the polkit change I referenced, Debian 11 and 12 are different.

User avatar
None1975
df -h | participant
df -h | participant
Posts: 1388
Joined: 2015-11-29 18:23
Location: Russia, Kaliningrad
Has thanked: 45 times
Been thanked: 65 times

Re: [Software] Sudo + Xfce = no shutdown or reboot (Debain 11/12)

#3 Post by None1975 »

Gorg wrote: 2023-03-09 23:55 Any way to fix this or is this a known issue?
Hello. Once logged in as a user, you can verify whether or not the user belongs to group=sudo using either the id or groups commands. E.g., a user with id=foo should see output from

Code: Select all

$ groups
like

Code: Select all

foo sudo
If sudo is not present in the output, the user does not belong to that group.

To add an existing user with

Code: Select all

id=foo
to group=sudo:

First get root (e.g., sudo su -) and then run the command

Code: Select all

# adduser foo sudo
Then reboot.
OS: Debian 12.4 Bookworm / DE: Enlightenment
Debian Wiki | DontBreakDebian, My config files on github

Gorg
Posts: 23
Joined: 2019-10-24 09:30

Re: [Software] Sudo + Xfce = no shutdown or reboot (Debain 11/12)

#4 Post by Gorg »

Hi,
CwF wrote: 2023-03-10 17:53 Try group 'adm'

Code: Select all

# adduser User group
That by itself changed nothing, I'm not sure at this point if there was an "adm" group defined to begin with, but adding the user didn't solve the issue.

I've also read somewhere that the user should be added to certain power* groups in Xfce, however there are no predefined groups with any such name.

None1975 wrote: 2023-03-11 12:01 Hello. Once logged in as a user, you can verify whether or not the user belongs to group=sudo using either the id or groups commands. E.g., a user with id=foo should see output from

Code: Select all

$ groups
like

Code: Select all

foo sudo
The user account was successfully added to the sudo group by the installer from the beginning. I was also able to use sudo without any issue, just not reboot, shutdown, suspend without root credentials from the GUI.

Since I considered this kind of a botched installation, I just tried installing other DEs on top to see if they would work. After installing the MATE desktop, the power menu options suddenly became available for the user in Xfce as well.

I assume there is some package missing from the Xfce install, but I don't know which one. I had installed pm-utils beforehand, because I read that would solve the issue, but that also wasn't the culprit, probably because it has been replaced by systemd at some point.

I still don't really consider this solved, because a standard Xfce DE as offered by the installer should work out of the box imho, but not sure how to find out what exactly is missing.

CwF
Global Moderator
Global Moderator
Posts: 2638
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 192 times

Re: [Software] Sudo + Xfce = no shutdown or reboot (Debain 11/12)

#5 Post by CwF »

Gorg wrote: 2023-03-14 20:20 I still don't really consider this solved, because a standard Xfce DE as offered by the installer should work out of the box imho,
Certainly if you installed from the xfce meta package it should work. I can't figure what's missing.

My simple ~800 package minimal xfce with only the one user group and no sudo authority can still shut down from the menu. Install with a root account and one user, I see no reason to do it otherwise especially with xfce. Sudo tuns out to be a style preference and not at all required. Another DE installation over the top fixing something in xfce is pure coincidence.

Gorg
Posts: 23
Joined: 2019-10-24 09:30

Re: [Software] Sudo + Xfce = no shutdown or reboot (Debain 11/12)

#6 Post by Gorg »

CwF wrote: 2023-03-15 04:43 Certainly if you installed from the xfce meta package it should work.
Which package do you mean? xfce4?

That was already installed by the Debian Installer, apt said newest version, so no changes. I have set up a new system just to confirm it wasn't a bad installation and I still couldn't access the power menu options. I also installed xfce4*, just to be sure, but that didn't change anything.

I did not install Xfce via console, I selected it from the DE menu of the text-based netinstall.

CwF wrote: 2023-03-15 04:43 My simple ~800 package minimal xfce with only the one user group and no sudo authority can still shut down from the menu. Install with a root account and one user, I see no reason to do it otherwise especially with xfce. Sudo tuns out to be a style preference and not at all required.
Yes, it is a workflow preference, but sudo is not some random, obscure software and it's offered by the installer, so any user would expect it to work.

The solution to this issue can't be to "just use a root account" plus that has other drawbacks and potential complications as well, depending on usage.

CwF wrote: 2023-03-15 04:43Another DE installation over the top fixing something in xfce is pure coincidence.
It's not a coincidence in this case, I was able to reproduce it in the current installation by just installing mate-calc, pluma and caja with a few extensions (not the full MATE metapackage). I had used those programs previously, so I was going to install them anyway, but Xfce should work without having half of MATE on board, from my understanding there should be some gnome package that needs to be shipped with Xfce by default.

User avatar
Hallvor
Global Moderator
Global Moderator
Posts: 2029
Joined: 2009-04-16 18:35
Location: Kristiansand, Norway
Has thanked: 139 times
Been thanked: 206 times

Re: [Software] Sudo + Xfce = no shutdown or reboot (Debain 11/12)

#7 Post by Hallvor »

You have the package xfce4-power-manager installed, right?
[HowTo] Install and configure Debian bookworm
Debian 12 | KDE Plasma | ThinkPad T440s | 4 × Intel® Core™ i7-4600U CPU @ 2.10GHz | 12 GiB RAM | Mesa Intel® HD Graphics 4400 | 1 TB SSD

CwF
Global Moderator
Global Moderator
Posts: 2638
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 192 times

Re: [Software] Sudo + Xfce = no shutdown or reboot (Debain 11/12)

#8 Post by CwF »

Hallvor wrote: 2023-03-15 21:50 You have the package xfce4-power-manager installed, right?
Thank you, that is a suggested package and not a hard dependency. However my mini xfce install does not have that package, and session-logout works without a password, without sudo, without a polkit rule.

Code: Select all

$ xfce4-session-logout
this should bring up the session dialog, or ask for a password. If it ask for a password, then yes I've heard of the issue and never duplicated it.

CwF
Global Moderator
Global Moderator
Posts: 2638
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 192 times

Re: [Software] Sudo + Xfce = no shutdown or reboot (Debain 11/12)

#9 Post by CwF »

above I typed with a password, corrected to without!
Gorg wrote: 2023-03-15 19:47 Which package do you mean? xfce4?
Yes, my bad.

dlu2021
Posts: 198
Joined: 2021-08-13 19:55
Location: Minnesota
Has thanked: 7 times
Been thanked: 37 times

Re: [Software] Sudo + Xfce = no shutdown or reboot (Debain 11/12)

#10 Post by dlu2021 »

When you did the installs, did you opt to not install the recommended packages?

User avatar
sunrat
Administrator
Administrator
Posts: 6412
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 116 times
Been thanked: 462 times

Re: [Software] Sudo + Xfce = no shutdown or reboot (Debain 11/12)

#11 Post by sunrat »

dlu2021 wrote: 2023-03-16 01:52 When you did the installs, did you opt to not install the recommended packages?
Debian normally installs recommended packages as default, but not suggested packages.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

dlu2021
Posts: 198
Joined: 2021-08-13 19:55
Location: Minnesota
Has thanked: 7 times
Been thanked: 37 times

Re: [Software] Sudo + Xfce = no shutdown or reboot (Debain 11/12)

#12 Post by dlu2021 »

sunrat wrote: 2023-03-16 03:44 Debian normally installs recommended packages as default, but not suggested packages.
Yes, I thought the Expert mode of the installer had an option for that, but after double checking it doesn't. It looks like you can do it via preseeding, but that is even far less likely to have happened.

CynicalDebian
Posts: 263
Joined: 2023-03-02 05:26
Location: USA
Has thanked: 50 times
Been thanked: 60 times
Contact:

Re: [Software] Sudo + Xfce = no shutdown or reboot (Debain 11/12)

#13 Post by CynicalDebian »

When installed without root (sudo)
This is irrelevant, there is a root user, it just does not have a password. It is inaccurate to call it "without root".
instead `sudo systemctl poweroff` needs to be entered into the terminal (or any other shutdown command, for that matter).

By default, systemctl uses policy kit to give unprivileged users access to shutdown.

Using, (you should NOT need to use sudo)

Code: Select all

$systemctl poweroff
Post the error this command gives and we should be able to help you.

As an unprivileged user should cause one of three things to happen:
1. Shut down the system
2. Demand a password to set a wall message
3. Fail entirely with an error message
I've also briefly tried KDE and its power menu seems to work, although I also wasn't able to shut down without sudo from the terminal.
Is much more telling, this has nothing to do with XFCE. Your policykit configuration is for some reason borked.

This is strange as the way policykit is configured, if you are in an active session, ALL users should have access to poweroff.

Are you remoting into your machine in some way? That will significantly change things.

https://wiki.debian.org/Xfce
Be seeing you...

Gorg
Posts: 23
Joined: 2019-10-24 09:30

Re: [Software] Sudo + Xfce = no shutdown or reboot (Debain 11/12)

#14 Post by Gorg »

Hi, sorry for the late reply, I had to use the device for a while and couldn't analyze this further.
CynicalDebian wrote: 2023-03-17 01:03 Are you remoting into your machine in some way? That will significantly change things.


No, this is just a normal desktop (or laptop, in this case) installation used locally.

I have reinstalled once again now and what I can absoutely say is that:

a) I can reproduce this.
b) xfce4-power-manager is preinstalled.
c) Installing xfce4-dev-tools enables the power options (reboot/shutdown/suspend).
d) Installing "mate" will also result in accessible power options, installing mate-desktop alone does not.

I have installed all missing Xfce packages one-by-one (including such things as the panel eyes) and only after installing the dev tools, the power menu was "unlocked". Also, I previously thought this would happen by just installing pluma, calc and caja from the MATE-DE, but that wasn't the case.

CynicalDebian
Posts: 263
Joined: 2023-03-02 05:26
Location: USA
Has thanked: 50 times
Been thanked: 60 times
Contact:

Re: [Software] Sudo + Xfce = no shutdown or reboot (Debain 11/12)

#15 Post by CynicalDebian »

I have reinstalled once again now and what I can absoutely say is that:
I don't know if I didn't make this clear, but the fact that

Code: Select all

$systemctl poweroff
Does NOT work points to this being a deeper problem, NOT an issue with Xfce.

The way it works is

systemctl calls '/usr/share/polkit-1/actions/org.freedesktop.login1.policy'

'org.freedesktop.login1.policy'

Code: Select all

        <action id="org.freedesktop.login1.power-off">
                <description gettext-domain="systemd">Power off the system</description>
                <message gettext-domain="systemd">Authentication is required to power off the system.</message>
                <defaults>
                        <allow_any>auth_admin_keep</allow_any>
                        <allow_inactive>auth_admin_keep</allow_inactive>
                        <allow_active>yes</allow_active>

This is very confusing, but basically <allow_active>yes</allow_active> being set to 'yes' means that ANY user should be able to call to poweroff as long as they are an 'active' session, basically meaning not remote.

Code: Select all

$sudo systemctl poweroff
Should NOT be necessary and is unrelated to XFCE. The way that XFCE calls shutdown is through these freedesktop actions, it is supposed to be standardized that way.

Which is why if you want help figuring out the issue please post the error that

Code: Select all

$systemctl poweroff
produces.
Be seeing you...

Post Reply