Polkit is not working anymore

hey! i have tried to make polkit work and it worked for a time, and it is not working anymore IDK why. my nixos configuration -


  # Polkit
    systemd = {
    user.services.polkit-gnome-authentication-agent-1 = {
      description = "polkit-gnome-authentication-agent-1";
      wantedBy = [ "graphical-session.target" ];
      wants = [ "graphical-session.target" ];
      after = [ "graphical-session.target" ];
      serviceConfig = {
          Type = "simple";
          ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
          Restart = "on-failure";
          RestartSec = 1;
          TimeoutStopSec = 10;
        };
    };
  };

also i do have polkit_gnome package installed on my nixos.

1 Like

Is there a reason you aren’t using the nixos polkit module? Usually, any modules which need polkit will also enable this option or assert that the option should be set to true.

hmm, i’ve tried that with that module and without module, non of them worked for me. i do need graphical polkit such as gnome polkit, but i am unable to run it.

What does the status of the service show?

$ sudo systemctl status polkit.service                                                                            130 ↵
[sudo] password for username: 
● polkit.service - Authorization Manager
     Loaded: loaded (/etc/systemd/system/polkit.service; linked; preset: enabled)
    Drop-In: /nix/store/g9sf21w83zw9jbqm51sm0hrg14y98l49-system-units/polkit.service.d
             └─overrides.conf
     Active: active (running) since Mon 2023-08-28 21:57:39 +06; 4min 32s ago
       Docs: man:polkit(8)
   Main PID: 990 (polkitd)
         IP: 0B in, 0B out
         IO: 2.2M read, 0B written
      Tasks: 4 (limit: 18753)
     Memory: 4.6M
        CPU: 223ms
     CGroup: /system.slice/polkit.service
             └─990 /nix/store/q5r1kj02avsjgyxhjkkll99na6kgnwqs-polkit-122/lib/polkit-1/polkitd --no-debug

Aug 28 21:57:39 nix-os systemd[1]: Starting Authorization Manager...
Aug 28 21:57:39 nix-os polkitd[990]: Started polkitd version 122
Aug 28 21:57:39 nix-os polkitd[990]: Loading rules from directory /etc/polkit-1/rules.d
Aug 28 21:57:39 nix-os polkitd[990]: Loading rules from directory /run/current-system/sw/share/polkit-1/rules.d
Aug 28 21:57:39 nix-os polkitd[990]: Finished loading, compiling and executing 4 rules
Aug 28 21:57:39 nix-os systemd[1]: Started Authorization Manager.
Aug 28 21:57:39 nix-os polkitd[990]: Acquired the name org.freedesktop.PolicyKit1 on the system bus

What errors do you get when an application tries to use the polkit gui?

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

EDIT = seriously have a pain with polkit, need to fix this quickly but i can’t.

KDE, or mate polkit will be fine, just tell how to enable that?

You enable them by installing them and running them on login. Just pick one from Nixpkgs, add it to your config to install it.

That’s not the service for the graphical polkit that you shared. Run systemctl status polkit-gnome-authentication-agent-1

$ systemctl status polkit-gnome-authentication-agent-1
Unit polkit-gnome-authentication-agent-1.service could not be found.

My bad, it should be systemctl status --user polkit-gnome-authentication-agent-1

ᐅ systemctl status --user polkit-gnome-authentication-agent-1
× polkit-gnome-authentication-agent-1.service - polkit-gnome-authentication-agent-1
     Loaded: loaded (/etc/systemd/user/polkit-gnome-authentication-agent-1.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Tue 2023-08-29 09:18:27 +06; 12min ago
   Duration: 36ms
    Process: 52225 ExecStart=/nix/store/fq1igqqj97dsp0b7wallm70sfd5y3vyl-polkit-gnome-0.105/libexec/polkit-gnome-authentication-agent-1 (code=e>
   Main PID: 52225 (code=exited, status=1/FAILURE)
        CPU: 34ms

Aug 29 09:18:27 nix-os systemd[1041]: polkit-gnome-authentication-agent-1.service: Scheduled restart job, restart counter is at 6.
Aug 29 09:18:27 nix-os systemd[1041]: Stopped polkit-gnome-authentication-agent-1.
Aug 29 09:18:27 nix-os systemd[1041]: polkit-gnome-authentication-agent-1.service: Start request repeated too quickly.
Aug 29 09:18:27 nix-os systemd[1041]: polkit-gnome-authentication-agent-1.service: Failed with result 'exit-code'.
Aug 29 09:18:27 nix-os systemd[1041]: Failed to start polkit-gnome-authentication-agent-1.

The service is failing to run. Please post the output of journalctl -u polkit-gnome-authentication-agent-1, we’ll see if it explains why it is failing.

idk why it has no entries,

$ journalctl -u polkit-gnome-authentication-agent-1                                            
-- No entries --

Try running /nix/store/fq1igqqj97dsp0b7wallm70sfd5y3vyl-polkit-gnome-0.105/libexec/polkit-gnome-authentication-agent-1

this thing worked half, after running that form kitty, now i am getting that polkit pop up when i did gparted but i am getting a new error,

(polkit-gnome-authentication-agent-1:4700): polkit-gnome-1-WARNING **: 20:06:48.464: Unable to get a pixbuf for GTK_STOCK_DIALOG_AUTHENTICATION (gtk-dialog-authentication) at size 48

That is just a warning, it isn’t relevant. If you run systemctl restart --user polkit-gnome-authentication-agent-1 then systemctl status --user polkit-gnome-authentication-agent-1, does it still say failed?

it is not just a warning, gparted does not launch. and as you said when i do -

polkit-gnome-authentication-agent-1.service - polkit-gnome-authentication-agent-1
     Loaded: loaded (/home/nahian-adnan/.config/systemd/user/polkit-gnome-authentication-agent-1.service; enabled; preset: enabled)
     Active: active (running) since Tue 2023-08-29 20:34:53 +06; 14s ago
   Main PID: 44039 (polkit-gnome-au)
      Tasks: 5 (limit: 18753)
     Memory: 3.1M
        CPU: 67ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/polkit-gnome-authentication-agent-1.service
             └─44039 /nix/store/fq1igqqj97dsp0b7wallm70sfd5y3vyl-polkit-gnome-0.105/libexec/polkit-gnome-authentication-agent-1

Aug 29 20:34:53 nix-os systemd[1050]: Started polkit-gnome-authentication-agent-1.
Aug 29 20:34:53 nix-os polkit-gnome-au[44039]: AT-SPI: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files

EDIT = still can’t launch gparted and it is a polkit issue,

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

It is just a warning, the output shows that it is a warning. These GTK warnings are common. The crash is being caused by something else. Can you share your entire configuration? I’ll test the polkit and see if I can get it running on my machine.