Open Yannik opened 1 year ago
working on 13.1.0 I found:
root@packetfence:/usr/local/pf/conf# git status
fatal: detected dubious ownership in repository at '/usr/local/pf/conf'
To add an exception for this directory, call:
git config --global --add safe.directory /usr/local/pf/conf
root@packetfence:/usr/local/pf/logs# journalctl -t packetfence-tracking-config
-- Journal begins at Mon 2024-03-11 04:07:12 CET, ends at Fri 2024-03-15 09:30:01 CET. --
-- No entries --
root@packetfence:/usr/local/pf/logs# systemctl status packetfence-tracking-config.service
● packetfence-tracking-config.service - PacketFence Configuration Change Tracking
Loaded: loaded (/lib/systemd/system/packetfence-tracking-config.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2024-03-08 12:32:27 CET; 6 days ago
TriggeredBy: ● packetfence-tracking-config.path
Docs: http://packetfence.org
Process: 10370 ExecStartPre=/bin/sh -c if [ ! -d "/usr/local/pf/conf/.git" ]; then /usr/bin/git init /usr/local/pf/conf/;cd /usr/local/pf/conf/;/usr/bin/git add /usr/local/pf/conf/*;fi>
Process: 10373 ExecStart=/bin/bash -c /usr/bin/git -c user.name='PacketFence Tracking' -c user.email='tracking@packetfence.org' --git-dir=/usr/local/pf/conf/.git commit -a -m "Commit `>
Main PID: 10373 (code=exited, status=1/FAILURE)
CPU: 5ms
Warning: journal has been rotated since unit was started, output may be incomplete.
To solve the problem I copied /lib/systemd/system/packetfence-tracking-config.service
to /etc/systemd/system/
and changed it like this:
root@packetfence:/usr/local/pf/conf# diff -u /lib/systemd/system/packetfence-tracking-config.service /etc/systemd/system/packetfence-tracking-config.service
--- /lib/systemd/system/packetfence-tracking-config.service 2024-02-05 01:03:17.000000000 +0100
+++ /etc/systemd/system/packetfence-tracking-config.service 2024-03-15 10:00:32.222113376 +0100
@@ -6,7 +6,7 @@
[Service]
Type=oneshot
WorkingDirectory=/usr/local/pf/conf
-ExecStartPre=/bin/sh -c "if [ ! -d \"/usr/local/pf/conf/.git\" ]; then /usr/bin/git init /usr/local/pf/conf/;cd /usr/local/pf/conf/;/usr/bin/git add /usr/local/pf/conf/*;fi"
+ExecStartPre=/bin/sh -c "if [ ! -d \"/usr/local/pf/conf/.git\" ]; then /usr/bin/git init /usr/local/pf/conf/;git config --system --add safe.directory /usr/local/pf/conf;cd /usr/local/pf/conf/;rm .gitignore.example;echo .gitattributes >> .gitignore;/usr/bin/git add .gitignore /usr/local/pf/conf/*;fi"
ExecStart=/bin/bash -c "/usr/bin/git -c user.name=\'PacketFence Tracking\' -c user.email=\'tracking@packetfence.org\' --git-dir=/usr/local/pf/conf/.git commit -a -m \"Commit `date +%%F-%%T`\""
I deleted /usr/local/pf/conf/.git
so that the ExecStartPre
condition would match again.
After systemctl daemon-reload
and pfcmd service tracking-config restart
:
root@packetfence:/usr/local/pf/conf# git status; git log
On branch master
nothing to commit, working tree clean
commit 7c7d0187502e12e6f3923ab878b22099f0f3ccee (HEAD -> master)
Author: PacketFence Tracking <tracking@packetfence.org>
Date: Fri Mar 15 10:03:24 2024 +0100
Commit 2024-03-15-10:03:24
Hi all,
I installed a fresh packetfence 12.2 on debian bullseye. (Exact package version: 12.2.0+20230315071555+806841734+0011+maintenance~12~2+bullseye1)
The service config looks like this:
So according to ExecStartPre, if /usr/local/pf/conf/.git does not exist, the files should be staged (git add), but this does not happen for some reason.
I dug through the journal and this is the output of the first run of ExecStartPre:
Due to this failure, the files are never staged.
The same "detected dubios ownership" error message is also displayed when running git status in /usr/local/pf/conf:
In addition to this bug, it is also be notable that new config files, if they are ever introduced, will not be added to git, because
git commit -a
only stages files that are already in git.Best regards Yannik