We use /var/run bound as tmpfs, so the pidfile required by this incarnation of the bareos-server doesn't work properly: service bareos-dir start/restart fails silently on systems that have been rebooted after the installation of the port due to the missing folder /var/run/bareos/ where the script files/bareos-dir.in (later residing in /usr/local/etc/rc.d/bareos-dir) expects the pidfile. Checking the rc-script, I do not find any checks for the existence of /var/run/bareos or suitable tests for traversal. This issue has already been dealt with by FreeBSD a long time ago since tmpfs is a possible filesystem (memory backed) even for /var/run for some security issues. Either a proper check for the existence of the folder /var/run/bareos/ needs to be applied or the pidfile simply should be dropped into folder /var/run/ which very existence is guaranteed by FreeBSD itself. Or I have misunderstood something. Quick and dirty workaround: Change /var/run/bareos/ into /var/run or explicitely set bareos_dir_pidfile="/var/run/bareos-dir.9101.pid" in /etc/rc.conf or /etc/rc.conf.local
Stupid me: I forgot to mention: /var/run needs to have proper access rights for user "bareos" under which the bareos-suite is running, so I guess the folder /var/run/bareos/ makes sense in terms it can be adjusted to the proper access rights. In that case, a proper check of existence is necessary!
Created attachment 174252 [details] Patch rc-scripts properly sysutils/bareos-server rc scripts lack in some checks for proper pidfile handling. See patchset.
Created attachment 174279 [details] bareos-server.patch Refurbished rc-script for both server (bareos-dir, bareos-sd) and client (bareos-sd). Included in patch as of PR210177.
Created attachment 174296 [details] bareos-server-rc.patch Messed up my environment and mixed too much of the patches. With this patchset, I patch only the rc-scripts that way so they provide the desired behaviour: - check for the existence of /var/run/bareos folder, create it if necessary and apply proper ownership
Created attachment 177087 [details] Patchset for making /var/run on TMPFS possible The patchset provided applies to Bareos 16.2.4 and obsoletes the prior version 15 pachtsets. As the bareos-fd (file director) is considered to run with privileges root:wheel and is also considered to run as a solitair service, a special test whether user bareos exists or not is necessary when checking the existence of /var/run/bareos. In case vareos-fd is the only service running, no user/group bareos is present and var/run/bareos has privileges root:wheel. If uid bareos exists (probed via getent) we consider other bareos services present and mutual running. In such a case the ownership of /var/run/bareos is bareos:bareos.
The provided patchset has not been able to be tested du to Bug 214578
A commit references this bug: Author: acm Date: Mon Nov 21 20:59:11 UTC 2016 New revision: 426754 URL: https://svnweb.freebsd.org/changeset/ports/426754 Log: - Fix start when /var/run is on TMPFS - Bump PORTREVISION PR: 212282 Submitted by: O. Hartmann ohartmann (_at_) walstatt.org Changes: head/sysutils/bareos-client/Makefile head/sysutils/bareos-client-static/Makefile head/sysutils/bareos-server/Makefile head/sysutils/bareos-server/files/bareos-dir.in head/sysutils/bareos-server/files/bareos-fd.in head/sysutils/bareos-server/files/bareos-sd.in