[RESOLVED] Launching gParted

I’ve tried security.polkit.enable/env/XDG_RUNTIME_DIR=/DISPLAY=/export/pkttyagent/pkexec/exec/xhost/io.elementary.desktop.agent-polkit/sudo/dbus-launch. Haven’t tried gksu/do/dbus-session-run because I don’t know how to get that on NixOS

I’m still failing at launching with various errors

polkit-agent-helper-1: error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie
Error executing command as another user: Not authorized

This one can be corrected with pkttyagent

(gpartedbin:): Gtk-WARNING **: : cannot open display:

This one can be corrected with sudo

(gpartedbin:): Gtk-WARNING **: : cannot open display: :0

I’ve heard that WayLand don’t permit to open graphical apps as another user than the one launching the WM

This one can be corrected with xhost, but ideally I would have liked a solution less dangerous security-wise than xhost si:localuser:root && sudo sudo; sudo gparted & sleep 1 && xhost -si:localuser:root, and it takes root environment who is, if not already configured, quite not adapted to graphical parameters of the current user WM

sudo --preserve-env gparted seems to resolve all problems, keeping root rights, taking user display parameters aswell as all other environment (WM graphical…)

Error executing command as another user: No authentication agent found.

This one can be corrected with io.elementary.desktop.agent-polkit/pkexec

If you have different combination of already tried commands; way of using the unusable ones; new ways, don’t hesitate to tell me

I believe just enabling polkit and not running gparted as root is the intended way to do this.

In fact, it seems to be enabled by default under pantheon, just not using sudo should do the trick.

Updated accordingly (I’ve forgotten, but that was among the first solutions I’ve tried)

Bump! I’m encountering the same error: (gpartedbin:): Gtk-WARNING **: : cannot open display: on stable-23.11. I have configured polkit, but the error persists. Running with sudo -E resolves the issue, but I’d like to avoid using sudo.

2 Likes

Same issue while using Hyprland.

My error was installing it as a user package, not as a system package.

Edit: Configuring polkit is unnecessary for me (stable-23.11).