Polkit authentication failing via EOF

Hello! I’m trying to run btrfs-assistant and running into the following error:

$ gtk-launch btrfs-assistant
==== AUTHENTICATING FOR org.btfrs-assistant.pkexec.policy.run ====
Authentication is required to run Btrfs Assistant
Authenticating as: laura
Password: 
** (process:3293): WARNING **: 21:30:39.536: Got unexpected EOF while reading from controlling terminal.

==== AUTHENTICATION FAILED ====
Error executing command as another user: Not authorized

This incident has been reported.
$

It doesn’t give me the opportunity to enter my password. Seeing this was an authentication issue, I tried the following:

$ sudo gtk-launch btrfs-assistant
[sudo] password for laura: 

(gtk-launch:3577): Gtk-WARNING **: 21:33:30.799: cannot open display: 
$

What might be causing this?

You probably should run btrfs-assistant-launcher maybe?

I have never tried launching btrfs assistant using a terminal polkit agent.

Oh running btrfs-assistant-launcher does manage to authenticate, but then just outputs the following, with no gui appearing:

$ btrfs-assistant-launcher
==== AUTHENTICATING FOR org.btfrs-assistant.pkexec.policy.run ====
Authentication is required to run Btrfs Assistant
Authenticating as: laura
Password: 
==== AUTHENTICATION COMPLETE ====
Usage: btrfs-assistant-bin [options]
An application for managing Btrfs and Snapper

Options:
  -h, --help                         Displays help on commandline options.
  --help-all                         Displays help, including generic Qt
                                     options.
  -v, --version                      Displays version information.
  -l, --list                         List snapshots
  -r, --restore <index of snapshot>  Restore the given snapshot
$

Yeah, because if you run it from a terminal it assumes you want to interact with it from the terminal. It has a cli interface.

Sorry I haven’t been descriptive enough. I’m trying to execute it from a terminal because launching it via fuzzel or via executing the .desktop file in a file explorer weren’t causing any effect, so I was hoping to diagnose it via terminal.

You are probably missing a graphical polkit agent(or it isn’t configured properly).

Normally, if you run btrfs-assistant-launcher from a terminal it would launch a graphical polkit agent asking for a password and then launch the terminal. You are getting the terminal-based polkit agent which is a fallback.

So I have polkit-gnome and I can see /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1, but I can’t find a systemctl entry in order to enable it. I’ve tried with --user too.

I have figured out to create ~/.config/systemd/polkit-gnome.service with

[Unit]
PartOf=graphical-session.target
After=graphical-session.target
Requisite=graphical-session.target

[Service]
ExecStart=/lib/polkit-gnome/polkit-gnome-authentication-agent-1
Restart=on-failure

And now I get the graphical authentication when I try to launch btrfs assistant, but it still doesn’t cause any gui to appear.
What could still be going wrong?

Oh, now that the graphical polkit is here, the btrfs-assistant-launcher does throw an error:

$ btrfs-assistant-launcher 
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
Authorization required, but no authorization protocol specified

qt.qpa.xcb: could not connect to display :0
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: eglfs, linuxfb, minimal, minimalegl, offscreen, vkkhrdisplay, vnc, xcb.

/usr/bin/btrfs-assistant: line 46: 14647 Aborted                 (core dumped) btrfs-assistant-bin ${params}

So I will try reinstalling the package.

Reinstalling from the aur did not fix the issue. I’m not sure why its not able to use xcb. Anyone know how I can find out?

What WM are you using?

Niri, but I have xwayland-satellite and x11/electron apps are working.

What DE or WM are you using?

Just niri (https://github.com/YaLTeR/niri) on an otherwise very fresh EndeavourOS install (with no default window manager).

I ran into this same issue when setting up Hyprland yesterday. I had to add this to my config.
exec-once = systemctl --user start hyprpolkitagent
And then also this which activates other stuff as well.
exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP --all
So you will probably need to launch a polkit agent when you WM get’s launched.

I now have a service for polkit-gnome

● polkit-gnome.service
     Loaded: loaded (/home/laura/.config/systemd/user/polkit-gnome.service; enabled; preset: enabled)
     Active: active (running) since Fri 2025-05-02 13:16:40 BST; 30min ago
 Invocation: 3573d39bbe1e4ebb8e63dc7982cae648
   Main PID: 951 (polkit-gnome-au)
      Tasks: 6 (limit: 18855)
     Memory: 18.3M (peak: 38.5M)
        CPU: 624ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/polkit-gnome.service
             └─951 /lib/polkit-gnome/polkit-gnome-authentication-agent-1

May 02 13:16:40 pigeon systemd[808]: Started polkit-gnome.service.
May 02 13:23:08 pigeon polkit-gnome-au[951]: Unable to get a pixbuf for GTK_STOCK_DIALOG_AUTHENTICATION (gtk-dialog-authentication) at size 48

Running dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP --all in terminal before trying btrfs-assistant-launcher doesn’t fix the Qt platform plugin “xcb” thing. Could it matter when it’s run?
I am getting the polkit agent at least now.

First make sure you have qt6-wayland installed.

Other than that, since you are running a WM, you need to make sure you set all the Qt env variables.

Probably these right?
env = QT_QPA_PLATFORMTHEME,qt6ct

Minimally you will want QT_QPA_PLATFORM to be set properly.

Ahh I was missing qt6-wayland. Thank you. It launched without issue without looking into environment variables. What should QT_QPA_PLATFORM be set to?