You are not logged in.

#1 2025-07-18 16:55:17

randomiranda
Member
Registered: 2025-02-23
Posts: 14

polkit doesn't work in wayland [solved]

recently i moved over to niri and i can't get polkit working. i've tried various polkit agents but they all give the same error message

$ pkexec gparted
Authorization required, but no authorization protocol specified


(gpartedbin:8878): Gtk-WARNING **: 23:47:30.995: cannot open display: :0

Last edited by randomiranda (2025-07-19 01:21:59)

Offline

#2 2025-07-18 17:17:37

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,840

Re: polkit doesn't work in wayland [solved]

Poikit is not a (direct) dependency of niri and is also not mentioned on https://wiki.archlinux.org/title/Niri .

It does depend on xdg-desktop-portal though which usually needs a graphical polkit agent .

The cannot open display error is often related to xwayland issues .

Please post the outputs of

$ pacman -Qi xorg-xwayland
$ pacman -Qi niri

Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 2025-07-18 17:24:00

randomiranda
Member
Registered: 2025-02-23
Posts: 14

Re: polkit doesn't work in wayland [solved]

$ pacman -Qi xorg-xwayland
Name            : xorg-xwayland
Version         : 24.1.8-1
Description     : run X clients under wayland
Architecture    : x86_64
URL             : https://xorg.freedesktop.org
Licenses        : LicenseRef-Adobe-Display-PostScript  BSD-3-Clause
                  LicenseRef-DEC-3-Clause  HPND
                  LicenseRef-HPND-sell-MIT-disclaimer-xserver  HPND-sell-variant  ICU  ISC
                  MIT  MIT-open-group  NTP  SGI-B-2.0  SMLNJ  X11
                  X11-distribute-modifications-variant
Groups          : xorg
Provides        : xorg-server-xwayland
Depends On      : nettle  libepoxy  libxfont2  pixman  xorg-server-common  libxcvt  mesa
                  libglvnd  libxau  wayland  libdrm  libtirpc  libei  libxshmfence
                  libdecor  glibc
Optional Deps   : None
Required By     : plasma-workspace  xwayland-satellite
Optional For    : None
Conflicts With  : xorg-server-xwayland
Replaces        : xorg-server-xwayland
Installed Size  : 2.24 MiB
Packager        : Andreas Radke <andyrtr@archlinux.org>
Build Date      : Thu 19 Jun 2025 12:07:45 AM +07
Install Date    : Fri 20 Jun 2025 11:43:37 AM +07
Install Reason  : Installed as a dependency for another package
Install Script  : No
Validated By    : Signature
$ pacman -Qi niri
Name            : niri
Version         : 25.05.1-2
Description     : A scrollable-tiling Wayland compositor
Architecture    : x86_64
URL             : https://github.com/YaLTeR/niri
Licenses        : GPL-3.0-or-later
Groups          : None
Provides        : None
Depends On      : cairo  gcc-libs  glib2  glibc  libdisplay-info  libinput  libpipewire
                  libxkbcommon  mesa  pango  pixman  seatd  systemd-libs
                  xdg-desktop-portal-impl
Optional Deps   : alacritty: a suggested GPU-accelerated terminal emulator
                  bash: for niri-session script [installed]
                  fuzzel: a suggested Wayland application launcher [installed]
                  mako: a suggested Wayland notification daemon [installed]
                  org.freedesktop.secrets: for apps to rely on secrets portal [installed]
                  swaybg: a suggested Wayland wallpaper tool [installed]
                  swaylock: a suggested Wayland screen locker
                  waybar: a suggested Wayland customizable desktop bar [installed]
                  xwayland-satellite: for running X11 apps in XWayland [installed]
                  xdg-desktop-portal-gtk: a suggested XDG desktop portal [installed]
                  xdg-desktop-portal-gnome: a XDG desktop portal required for screencasting
                  [installed]
Required By     : None
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 22.83 MiB
Packager        : Caleb Maclennan <alerque@archlinux.org>
Build Date      : Thu 29 May 2025 07:57:07 PM +07
Install Date    : Fri 18 Jul 2025 07:46:34 PM +07
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature

Offline

#4 2025-07-18 19:02:22

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,714

Re: polkit doesn't work in wayland [solved]

i've tried various polkit agents but they all give the same error message

Authorization required, but no authorization protocol specified

means there *is* no polkit agent (running)

Also don't run "pkexec gparted", gparted is supposed to self-elevate.

Offline

#5 2025-07-18 22:06:45

tekstryder
Member
Registered: 2013-02-14
Posts: 504

Re: polkit doesn't work in wayland [solved]

randomiranda wrote:
$ pkexec gparted
Authorization required, but no authorization protocol specified
(gpartedbin:8878): Gtk-WARNING **: 23:47:30.995: cannot open display: :0

Fix your polkit and see:

https://gitlab.gnome.org/GNOME/gparted/ … te_2402996

Offline

#6 2025-07-19 01:15:00

randomiranda
Member
Registered: 2025-02-23
Posts: 14

Re: polkit doesn't work in wayland [solved]

the link above provided 2 workarounds
executing programs using

sudo -EH

or

pkexec env WAYLAND_DISPLAY="$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" XDG_RUNTIME_DIR=/run/user/0 

both work fine

Offline

#7 2025-07-19 07:13:33

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,714

Re: polkit doesn't work in wayland [solved]

sudo env WAYLAND_DISPLAY="$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" XDG_RUNTIME_DIR=/run/user/0 gparted

doesn't work?
Does

pkexec gparted

still get you "Authorization required, but no authorization protocol specified"?
gparted tries to open display :0 and xwayland is installed, so it's not pure wayland and the original issue was the inability to provide credentials to pkexec.

Last edited by seth (2025-07-19 07:13:40)

Offline

Board footer

Powered by FluxBB