Since sysutils/munin-master/pkg-install uses crontab(1), the munin crontab file will always be installed at /var/cron/tabs/munin. This is an issue when installing munin-master by specifying a different root directory (e.g. for a jail via "pkg -r <jailroot> install munin-master"). The cron(8) process reading /var/cron/tabs/munin will try to execute /usr/local/bin/munin-cron, which doesn't exist, and under the different root hierarchy there won't be any crontab file at all. I'm not really sure how to best fix this, as crontab(1) has no notion of specifying a different root (and copying the tab file around after crontab(1) created it is messy... I guess nothing should be installed outside of the root anyways, not even temporarily?)
Wouldn't it make more sense to use pkg -j, in that case the crontab command would run inside the jail and that should work, no?
I think this is open for debate, but in my opinion, no, b/c: - using -j won't work for microjails where there is no complete system - pkg(1)'s -r can be used for anything and is not jail related, the jail part in my description was only an example; I don't think it's intended things should be installed anywhere outside the hierarchy pointed to by -r I reopened this, as I don't think -j is the solution here (also "FIXED" is the wrong resolution, nothing was changed, there are other types that would be more suitable).
Just for completeness: when pkg-install is executed, PKG_ROOTDIR is set, so the script has that information and should use it. The only issue is that crontab(1) cannot be used as it has no equivalent of -r, and given crontab(1)'s man page says that the crontab files "are not intended to be edited directly". As mentioned in the original description, I'm not sure how to best fix this.
Suggestion: the script could maybe just check if a different root dir is used, and if so, skip the crontab(1) logic and inform the user that he has to do that step himself. That isn't ideal, but still better than installing things where it isn't supposed to write to at all.
(In reply to Tassilo Philipp from comment #2) Yeah, I forgot to change the Resolution to something else than FIXED. It would probably be best to provide a munin.conf and place it in /usr/local/etc/cron.d instead of calling crontab. I'll look at implementing that.
Ah, very good idea, didn't think of that. Thanks!
Created attachment 239794 [details] munin.cron
(In reply to Tassilo Philipp from comment #6) Hey, would you test the attached patch? Thanks.
(In reply to Florian Smeets from comment #8) Tested it, updated a munin node, made sure only the cron.d file is active, and it's looking good. Thanks for your work, that's a much cleaner style indeed!
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=02388ae491f5d00fb4dfe7e1945b8644c3c1aae7 commit 02388ae491f5d00fb4dfe7e1945b8644c3c1aae7 Author: Florian Smeets <flo@FreeBSD.org> AuthorDate: 2023-01-29 22:17:24 +0000 Commit: Florian Smeets <flo@FreeBSD.org> CommitDate: 2023-01-30 18:46:33 +0000 sysutils/munin-{master,node}: change cron job install Don't rely on directly calling crontab(1) to install the cron job, use the etc/cron.d directory for which we've had support for a while. This fixes installing munin-master using pkg -r as crontab(1) installed the cron job on the host system not in the specified alternative root otherwise. Completely remove pkg-install, that also removes the automatic migration for newsyslog files after src revision r340318 it's been 4 years and a bit. Leave the pkg-deinstall script for a while to make sure that the automatically installed cron jobs via crontab(1) are removed. PR: 258072 Reported by: Tassilo Philipp <tphilipp@potion-studios.com> Tested by: Tassilo Philipp <tphilipp@potion-studios.com> sysutils/munin-master/Makefile | 3 + sysutils/munin-master/files/cron (new) | 1 + sysutils/munin-master/files/pkg-message.in | 22 ------- sysutils/munin-master/pkg-install (gone) | 100 ----------------------------- sysutils/munin-master/pkg-plist | 2 + sysutils/munin-node/files/pkg-message.in | 19 ------ sysutils/munin-node/pkg-install (gone) | 42 ------------ 7 files changed, 6 insertions(+), 183 deletions(-)
I'm seeing an issue with munin-master.conf located at /usr/local/etc/cron.d/ in FreeBSD 13.2. After the munin packages are installed, the cron is not picking up the munin-cron schedule from munin-master.conf located at /usr/local/etc/cron.d/ until I touch the file to change the modification time. This is weird because if I create another file in same folder, the cron picks it up but still not the munin-master.conf until its touched. Any ideas?