Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Plasma 6: getting root privileges anymore
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
guerro
Guru
Guru


Joined: 21 Jun 2004
Posts: 416
Location: Brescia

PostPosted: Thu Sep 05, 2024 8:19 am    Post subject: [SOLVED] Plasma 6: getting root privileges anymore Reply with quote

Hi all,
after upgraded to plasma 6, I'm not be able to get root privileges like before, for example when in SYSTEM SETTINGS I want to change, install new SDDM theme (where root privileges are required), application don't ask me password to elevate my privileges ( I upgraded with kdesu USE flag).

Another example is: when I run partitionmanager, which advise me that I must have root privileges to get devices's info by clicking "update devices"; when I click it, nothing heppend instead of ask me password for root privileges like in plasma 5.

I don't know how to fix, if this is a bug or whatelse....

Can someone help me?
_________________
(.(*. .*).)
.. G u e r r o ..
(.(.* *.).)


Last edited by guerro on Fri Sep 06, 2024 6:40 am; edited 1 time in total
Back to top
View user's profile Send private message
rab0171610
Guru
Guru


Joined: 24 Dec 2022
Posts: 419

PostPosted: Thu Sep 05, 2024 9:46 am    Post subject: Reply with quote

Kdesu is used to run graphical programs as root under X. The authentication dialog you are likely referring to is provided by kde-plasma/polkit-kde-agent, which uses polkit to authenticate (PolKit agent module for KDE Plasma.) Make sure that package is installed. As well it would not hurt to verify that you have these files on your system:
/etc/xdg/autostart/polkit-kde-authentication-agent-1.desktop
/usr/libexec/polkit-kde-authentication-agent-1

What happens when you try to run a graphical program that requires elevated privileges using:
pkexec <command> ?
You can try it with programs that do not require elevated privileges to see if the authentication dialog pops up or not:
Code:
pkexec gwenview

or:
Code:
pkexec systemsettings


Code:
kde-plasma/polkit-kde-agent-6.1.4 pulled in by:
    kde-frameworks/kauth-5.116.0 requires kde-plasma/polkit-kde-agent:*
    kde-frameworks/kauth-6.5.0 requires kde-plasma/polkit-kde-agent:*
    kde-plasma/plasma-meta-6.1.4-r1 requires >=kde-plasma/polkit-kde-agent-6.1.4:*
    sys-auth/polkit-124-r1 requires kde-plasma/polkit-kde-agent
Back to top
View user's profile Send private message
guerro
Guru
Guru


Joined: 21 Jun 2004
Posts: 416
Location: Brescia

PostPosted: Thu Sep 05, 2024 10:35 am    Post subject: Reply with quote

Package is installed (as dependency like you wrote), files are present.
When I back home I'll try the command and I give you the feedback/output

Meanwhile thank you for support :)
_________________
(.(*. .*).)
.. G u e r r o ..
(.(.* *.).)
Back to top
View user's profile Send private message
guerro
Guru
Guru


Joined: 21 Jun 2004
Posts: 416
Location: Brescia

PostPosted: Thu Sep 05, 2024 3:28 pm    Post subject: Reply with quote

executed command
Code:
pkexec systemsettings
from Konsole of my user and this is the output:
Code:

==== AUTHENTICATING FOR org.freedesktop.policykit.exec ====
Authentication is needed to run `/usr/bin/systemsettings' as the super user
Authenticating as: root
Password:
polkit-agent-helper-1: error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie
==== AUTHENTICATION FAILED ====
Error executing command as another user: Not authorized

This incident has been reported.

_________________
(.(*. .*).)
.. G u e r r o ..
(.(.* *.).)
Back to top
View user's profile Send private message
rab0171610
Guru
Guru


Joined: 24 Dec 2022
Posts: 419

PostPosted: Thu Sep 05, 2024 8:51 pm    Post subject: Reply with quote

The dialog box should be popping up. I am wondering it the authentication agent service is running at startup.

First, you can manually run the KDE authentication agent to see if it works.
Open Konsole and use two different tabs or windows (two terminals.)
In the first one you will run the KDE authentication agent:
Code:
/usr/libexec/polkit-kde-authentication-agent-1

You will see something like:
Code:
New PolkitAgentListener  0x556c69fcc750
Adding new listener  PolkitQt1::Agent::Listener(0x556c69fcc0b0) for  0x556c69fcc750
Listener online
Authentication agent result: true

Leave that terminal window with the KDE authentication agent running. In the second graphical terminal, you will run pkexec <sometask>.
For example:
Code:
pkexec systemsettings

Does the gui authentication dialog box pop up as it used to?

Second, you can next check to see if the basic polkit terminal agent works.
You can reboot before this step to make sure that any tokens for KDE authentication agent you ran previously do not interfere. To see if the polkit authentication is working:
In the first terminal, enter:
Code:
echo $$

This will return a PID, such as:
Code:
12886

Use can use that PID to run pkttyagent. Using this PID as an example, in the second terminal you would enter:
Code:
pkttyagent --process 12886

Leave it running.
Go back to the first terminal. Now run pkexec <sometask>:
Code:
pkexec systemsettings

Go back to the second terminal (where the pkttyagent is running). You should see something like this to indicate that polkit authentication is working:
Code:
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ====
Authentication is needed to run `/usr/bin/systemsettings' as the super user
Authenticating as: System user; root (root)
Password:

If after entering your password and all is working correctly, you should see:
Code:
 ==== AUTHENTICATION COMPLETE ====

System Settings will not graphically run as the root user. So when you try, expect to generally see output like the following:
Code:
pkexec systemsettings
qt.qpa.xcb: could not connect to display
qt.qpa.plugin: From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin.
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: linuxfb, minimal, offscreen, vkkhrdisplay, vnc, wayland, wayland-egl, xcb.

Aborted (core dumped)

So you can safely ignore that and do not expect System Settings to open as root. You are simply verifying that the polkit authentication agent works.

Also, if you recently updated to KDE Plasma 6, make sure you did a depclean afterwards:
Code:
emerge -av --depclean
Back to top
View user's profile Send private message
guerro
Guru
Guru


Joined: 21 Jun 2004
Posts: 416
Location: Brescia

PostPosted: Thu Sep 05, 2024 10:05 pm    Post subject: Reply with quote

@rab0171610:
I did both tests and everything worked as expected.

It seems that the agent is not starting when it is requested, so the pop-up is not showing up.

The question is: WHY DOESN'T IT START WHEN I LOG IN TO KDE?
_________________
(.(*. .*).)
.. G u e r r o ..
(.(.* *.).)
Back to top
View user's profile Send private message
rab0171610
Guru
Guru


Joined: 24 Dec 2022
Posts: 419

PostPosted: Fri Sep 06, 2024 1:33 am    Post subject: Reply with quote

If you have XDG autostart running, it should be finding the file /etc/xdg/autostart/polkit-kde-authentication-agent-1.desktop at startup or login. You said the file is present. I am assuming that it is intact and not corrupt.
The last several lines should read:
Code:
Exec=/usr/libexec/polkit-kde-authentication-agent-1
Icon=dialog-password
Terminal=false
Type=Application
OnlyShowIn=KDE;
X-KDE-StartupNotify=false
X-KDE-autostart-phase=0
NoDisplay=true
X-DBUS-StartupType=Unique
X-systemd-skip=true

Regardless, I am assuming you are using openrc? I am using systemd so I cannot provide much help there.
You could try one of two workarounds. There are two methods you can try, I recommend the second one as it is easier to execute and undo:

1)
You can try setting the file /usr/libexec/polkit-kde-authentication-agent-1 to autostart when you log in to KDE.
In SystemSettings>Autostart click on add at the top right. Browse to /usr/libexec/polkit-kde-authentication-agent-1. When it pops up in the list of autostart applications, you may need to click on the properties icon (the edit icon next the the delete icon, an X). When the properties dialog box pops up, browse to the second tab, Permissions and make sure the box for "is executable" is checked. Save your changes and log out, and then log in to see if that has fixed the issue.

2)
Alternatively, you can copy the file /etc/xdg/autostart/polkit-kde-authentication-agent-1.desktop to ~/.config/autostart:
Code:
cp -rv  /etc/xdg/autostart/polkit-kde-authentication-agent-1.desktop  ~/.config/autostart

Logout and log back in to see if that has any effect.
Back to top
View user's profile Send private message
asturm
Developer
Developer


Joined: 05 Apr 2007
Posts: 9261

PostPosted: Fri Sep 06, 2024 4:36 am    Post subject: Reply with quote

Ran dispatch-conf already?
Back to top
View user's profile Send private message
guerro
Guru
Guru


Joined: 21 Jun 2004
Posts: 416
Location: Brescia

PostPosted: Fri Sep 06, 2024 5:51 am    Post subject: Reply with quote

rab0171610 wrote:

2)
Alternatively, you can copy the file /etc/xdg/autostart/polkit-kde-authentication-agent-1.desktop to ~/.config/autostart:
Code:
cp -rv  /etc/xdg/autostart/polkit-kde-authentication-agent-1.desktop  ~/.config/autostart

Logout and log back in to see if that has any effect.

Done without any effect,

asturm wrote:
Ran dispatch-conf already?

Yes, already done

I start thinking that there is something that inhibit the script.

Is there any way to get if it is executed (and running) after reboot (via terminal es. on VT1) and login (on Konsole)?? So I could know if it autostart and go in error or it doesn't autostart.
_________________
(.(*. .*).)
.. G u e r r o ..
(.(.* *.).)
Back to top
View user's profile Send private message
guerro
Guru
Guru


Joined: 21 Jun 2004
Posts: 416
Location: Brescia

PostPosted: Fri Sep 06, 2024 6:39 am    Post subject: Reply with quote

FOUND THE CAUSE:

Package install polkit-kde-authentication-agent-1 under /usr/libexec, but in polkit-kde-authentication-agent-1.desktop file is referenced as Exec=/usr/lib64/libexec/polkit-kde-authentication-agent-1

Corrected it to Exec=/usr/libexec/polkit-kde-authentication-agent-1 it works as expected.

Investigating on package I found that the path depend on this variable: KDE_INSTALL_FULL_LIBEXECDIR (which has wrong value, in my case and I don't know why)

After some test a thin I understand:
I have installed kfilemetadata 5.116.0 (because there is "qt5" in profile's USE flags) and 6.5.0-r1 both.
probably when I installed 6.5.0-r1 it didn't update polkit-kde-authentication-agent-1.desktop.

I tried to re-emerge kfilemetadata-6.5.0-r1 and then polkit-kde-agent-6.1.4 and now the path is correct.
_________________
(.(*. .*).)
.. G u e r r o ..
(.(.* *.).)
Back to top
View user's profile Send private message
asturm
Developer
Developer


Joined: 05 Apr 2007
Posts: 9261

PostPosted: Mon Sep 09, 2024 8:46 pm    Post subject: Reply with quote

It means you have not run dispatch-conf after update ...

Users of Gentoo: Please listen to Portage output.
Back to top
View user's profile Send private message
guerro
Guru
Guru


Joined: 21 Jun 2004
Posts: 416
Location: Brescia

PostPosted: Wed Sep 11, 2024 8:11 am    Post subject: Reply with quote

asturm wrote:
It means you have not run dispatch-conf after update ...

Users of Gentoo: Please listen to Portage output.

As I told in my previous message, I did it after update, but it didn't make required modifications as expected.
_________________
(.(*. .*).)
.. G u e r r o ..
(.(.* *.).)
Back to top
View user's profile Send private message
asturm
Developer
Developer


Joined: 05 Apr 2007
Posts: 9261

PostPosted: Wed Sep 11, 2024 10:13 am    Post subject: Reply with quote

Then you did not have kde-plasma/polkit-kde-agent-6.1.4 installed previously. It is the only explanation.

And that can only be caused by failure to use kde-plasma/plasma-meta, which would ensure this minimum version of >=6.1.4.
Back to top
View user's profile Send private message
mirekm
Apprentice
Apprentice


Joined: 12 Feb 2004
Posts: 216
Location: Gliwice

PostPosted: Wed Sep 11, 2024 6:20 pm    Post subject: Reply with quote

I have similar problem after upgrade of kde to version 6, but polkit agent listener cannot register. I get following error in the log.

Quote:


New PolkitAgentListener 0x9586f569aa0
Adding new listener PolkitQt1::Agent::Listener(0x9586f569130) for 0x9586f569aa0
Listener online
"Cannot create unix session: No session for pid 5852"

** (process:5852): CRITICAL **: 19:51:29.465: polkit_agent_listener_register_with_options: assertion 'POLKIT_IS_SUBJECT (subject)' failed
"Cannot register authentication agent!"
Authentication agent result: false
Couldn't register listener!


Now I wonder, how can I trace what is reason of that.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum