1

Entire error message:

ninja: Entering directory `build'
[1/2] Installing files.
Installation failed due to insufficient permissions.
Attempting to use polkit to gain elevated privileges...
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===
Authentication is needed to run `/usr/bin/python3' as the super user
Authenticating as: ,,, (pi)
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.
FAILED: meson-internal__install 
/home/pi/.local/bin/meson install --no-rebuild
ninja: build stopped: subcommand failed.

I'm trying to build libcamera on Raspberry Pi, but for some reason this pops up. I have no idea how to fix this, prior to this I didn't even know what policykit was. Any ideas welcome!

So far I tried updating ninja and meson, as both are present in the build process. I am of course providing correct credentials when authenticating. I'm using bullseye. And I'm connected with ssh to the Pi.

2
  • I presume you were running ninja build, but for clarity, can you include the command you initially ran?
    – Kevin E
    Mar 18 at 17:10
  • I typically see instructions tell you to meson build && sudo ninja install (and yes, I know the long-standing wisdom is don't build things as root if you don't have to—but you still have to install it as root so what's the difference really). PolicyKit and pkexec are relative newcomers, and still seem to have their share of problems, especially, it seems, when you don't have a desktop environment running.
    – Kevin E
    Mar 18 at 17:27

2 Answers 2

2

In order to get PolicyKit working over SSH, you'll need to run a copy of PolicyKit auth agent in the context of the session, as described here. Try running the following commands before you build:

/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1&
sudo xauth add $(xauth list $DISPLAY)
0

The problem was... That I was connected over ssh. It had to be done on a screen attached ti the Pi, otherwise it would not work. Still don't understand why and this is not really an answer, as the preferred way would be to just be able to do this over ssh.

1
  • Try doing sudo ninja install instead next time and see if you have different results. That shouldn't require using or understanding any PolicyKit stuff, which seems to be designed more for desktop environments. As long as your user is in the sudo group or /etc/sudoers, it should work, no muss, no fuss. If it's not the default for Raspberry Pi OS to set up the first user as an admin, many guides exist for this.
    – Kevin E
    Mar 18 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.