GUI apps fail to ask for root access in KDE

I installed KDE in my “Manjaro” install (more on that later) and it runs mostly ok, except it never asks for password and any application or process that requires root access will fail: Timeshift just blinks on screen and Pamac runs ok until you try to apply updates and changes to packages.

Command line sudo and other commands that ask for password themselves like trizen or chsh work normally.

The problem seemingly stems either from me failing to install/configure KDE correctly or from the fact this “Manjaro” install is an Arch Linux running on WSL transformed into Manjaro. :innocent: Please, don’t shoot me.

I installed and configured Xvnc over Xrdp to a seemingly working condition and I can access the DE from Windows itself through RDP. Again, it seems to work nicely if not by the auth issue on the desktop environment.

I tried to launch timeshif-launcher from command-line and got the below output as response. I’m still trying to figure this, but I guess it failed to authorize because it doesn’t have a session?

 dandrea > ~ $ timeshift-launcher
/sbin/timeshift-launcher: line 15: [: =: unary operator expected
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ====
Authentication is needed to run `/sbin/env' 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.

Upstream…

But, I have here KDE, and polkit works as expected :thinking:

$ pacman -Q|grep polkit
lib32-polkit 0.117-1
polkit 0.118-1
polkit-kde-agent 5.20.0-1
polkit-qt5 0.113.0-2

what happens if you do

pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY timeshift-gtk

?

Pretty much the same. Actually, just running pkexec from command-line gives the same output.

The output here is:

$ pacman -Q|grep polkit                                                       
polkit 0.117-1
polkit-kde-agent 5.19.5-1
polkit-qt5 0.113.0-2

lib32-polkit is a target not found to pacman.

That means (probably due to your Arch conversion) you dont have the multilib repos enabled.
I dont know if it matters for whats happening here, but its a noted difference.

…do we know how well polkit works in WSL ?

Not related.

@dandrea

basics:
Share to pastebin.com list of current installed packages. REPO only.

pacman -Qqen > ~/pkglist-repo.txt

Next. You are in proper groups?

groups
cat /etc/group

Packages:

sys network power lp wheel dandrea

Existing groups:

I have here bash in use. You have zsh. Maybe here is something missed in zsh configuration?
See in code:

#!/bin/bash

app_command='timeshift-gtk'

if [ `id -u` -eq 0 ]; then
	#user is admin
	${app_command}
else
	#user is not admin
	if `echo $- | grep "i" >/dev/null 2>&1`; then
		#script is running in interactive mode
		su - -c "${app_command}"
	else
		#script is running in non-interactive mode
		if [ $XDG_SESSION_TYPE = "wayland" ] ; then
			xhost +SI:localuser:root
			pkexec ${app_command}
			xhost -SI:localuser:root
			xhost
		elif command -v pkexec >/dev/null 2>&1; then
			pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY ${app_command}
		elif command -v sudo >/dev/null 2>&1; then
			x-terminal-emulator -e "sudo ${app_command}"
		elif command -v su >/dev/null 2>&1; then
			x-terminal-emulator -e "su - -c '${app_command}'"
		else
			x-terminal-emulator -e "echo 'Command must be run as root user: ${app_command}'"
		fi
	fi
fi

One more. Check environment variables if all is FINE.

1 Like

Changing the shell to bash does no good. :frowning:
Everything else is “factory default” (even though this is a WSL thing).