Bug 243102

Summary: sysutils/bareos-server: make_catalog_backup.pl can't find mysqldump
Product: Ports & Packages Reporter: Ryan <freebsd>
Component: Individual Port(s)Assignee: Jose Alonso Cardenas Marquez <acm>
Status: New ---    
Severity: Affects Only Me CC: ewhac
Priority: --- Flags: bugzilla: maintainer-feedback? (acm)
Version: Latest   
Hardware: amd64   
OS: Any   

Description Ryan 2020-01-05 03:27:30 UTC
Line 101 of /usr/local/lib/bareos/scripts/make_catalog_backup.pl calls for `mysqldump` however, when run from bconsole or on a schedule, the script fails and Bareos displays the following:

BeforeJob: sh: mysqldump: not found
Error: Runscript: BeforeJob returned non-zero status=127. ERR=Child exited with code 127

If I prepend `/usr/local/bin/` to `mysqldump` on line 101 it resolves the issue.

I have a feeling there's a better way to fix this, I'm just not sure how. I tried adding a `.profile` file exporting PATH to bareos's home directory but that didn't seem to make a difference.
Comment 1 Ryan 2020-01-05 03:32:46 UTC
Relates to bug #209811
Comment 2 Leo L. Schwab 2020-03-16 07:14:52 UTC
I bumped in to a relative of this today while setting up a new install.  My setup is using postgresql, and the log message read:

15-Mar 22:14 xxxxx JobId 5: BeforeJob: sh: pg_dump: not found

`pg_dump` was definitely installed.  I spent a few hours diagnosing it.  Essentially the problem is that rc.d launches bareos-dir with the PATH set to "/sbin:/bin:/usr/sbin:/usr/bin".  However, the postgresql11-client package installs all the utilities in /usr/local/bin, so job scripts launched from bareos-dir won't find it.

I'm not sure what the Correct Way to fix this is.  I managed to work around the issue by adding the following line to /etc/rc.conf:

bareos_dir_env="PATH=$PATH:/usr/local/sbin:/usr/local/bin"

And then restarting bareos-dir.  I then ran the catalog backup job manually from `bconsole`, which completed successfully.

Note that this trick only appears to work from within `run_rc_command` itself.  If you use `sysrc -A` to check the setting, the "$PATH" part won't be expanded correctly, instead displaying as:

bareos_dir_env: PATH=:/usr/local/sbin:/usr/local/bin