Dubious ownership in repository error

I am experiencing an error I cannot get to the bottom of, I have referenced the steps in the following post Daily Update error - GIT - #25 by murrant

This issue did surface after the disk filled up and had to be extended.

FAIL: Failed to fetch version from local git: fatal: detected dubious ownership in repository at ‘/opt/librenms’ To add an exception for this directory, call: git config --global --add safe.directory /opt/librenms

WARN: Your local git branch is not master, this will prevent automatic updates.
Fix: You can switch back to master with git checkout master

Did you run this?

Yes, I have ran this command and there was no change with the error message.

What user did you run the command as?

I ran this command initially as the root user, then reran it as the librenms user

When looking at the /opt/librenms with ls -l the user of all the files and directories is librenms.

I tried to reset git to fix this and ended up breaking the application so bad, I rolled back a vmware snapshot from right before I ran the commands to recover it.

After research and bouncing ideas around with a few colleagues, this error stemmed from a missing configuration in the /etc/apache2/sites-enabled librenms.conf file in Ubuntu 20.04 and Ubuntu 22.04. It was found after comparing a newer built server with an older LibreNMS instance experiencing the issue that was built a few years ago.

Adding the following line in the virtual host configuration fixed the problem, this also fixed the error with the python dependencies check failing that has surfaced in other posts.

#<FilesMatch “.+.php$”>
#SetHandler “proxy:unix:/run/php-fpm-librenms.sock|fcgi://localhost”

Note: Remove the “#” from the last line between Files and Match

Basically, the php was being ran by whatever user your web server was running as.
Changing it to use the librenms fpm-php pool makes it run as the librenms user.

Running the suggested fix as the web server user would have also fixed the message.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.