#2152 Issue closed: Bacula support for "bacula-enterprise-client" RPMs (different file locations)

Labels: enhancement, fixed / solved / done, external tool

linuxdan opened issue at 2019-05-31 18:27:

Relax-and-Recover (ReaR) Issue Template

Fill in the following items before submitting a new issue
(quick response is not guaranteed with free support):

  • ReaR version ("/usr/sbin/rear -V"):
    2.4 / Git

  • OS version ("cat /etc/rear/os.conf" or "lsb_release -a" or "cat /etc/os-release"):
    CentOS 7 (RedHatEnterpriseServer 7)

  • ReaR configuration files ("cat /etc/rear/site.conf" and/or "cat /etc/rear/local.conf"):
    local.conf =
    BACKUP=BACULA
    OUTPUT=ISO

  • Hardware (PC or PowerNV BareMetal or ARM) or virtual machine (KVM guest or PoverVM LPAR):
    Dell Precision Tower 3620

  • System architecture (x86 compatible or PPC64/PPC64LE or what exact ARM device):
    x86_64

  • Firmware (BIOS or UEFI or Open Firmware) and bootloader (GRUB or ELILO or Petitboot):
    BIOS

  • Storage (local disk or SSD) and/or SAN (FC or iSCSI or FCoE) and/or multipath (DM or NVMe):
    local disks

  • Description of the issue (ideally so that others can reproduce it):
    Does not work with bacula-enterprise-client - specifically bacula-enterprise-client-8.8.6-1.el7.x86_64
    Looking for binaries and config files in the wrong location.
    Perhaps these are for open-source Bacula.
    I will check that out.

  • Workaround, if any:
    Multiple file edits.

diff -btwr usr/share/rear/prep/BACULA/default/450_check_BACULA_client_configured.sh /usr/share/rear/prep/BACULA/default/450_check_BACULA_client_configured.sh
10c10
<    [ -s /etc/bacula/bacula-sd.conf ]
---
>    [ -s /opt/bacula/etc/bacula-fd.conf ]
19c19
<    [ -s /etc/bacula/bacula-fd.conf ]
---
>    [ -s /opt/bacula/etc/bacula-fd.conf ]
25c25
<    [ -s /etc/bacula/bconsole.conf ]
---
>    [ -s /opt/bacula/etc/bconsole.conf ]
diff -btwr usr/share/rear/prep/BACULA/default/500_check_BACULA_bconsole_results.sh /usr/share/rear/prep/BACULA/default/500_check_BACULA_bconsole_results.sh
14,15c14,15
< # is the director server present? Fetch from /etc/bacula/bconsole.conf file
< BACULA_DIRECTOR=$(grep -i address /etc/bacula/bconsole.conf | awk '{ print $3 }')
---
> # is the director server present? Fetch from /opt/bacula/etc/bconsole.conf file
> BACULA_DIRECTOR=$(grep -i address /opt/bacula/etc/bconsole.conf | awk '{ print $3 }')
17c17
< StopIfError "Director not defined in /etc/bacula/bconsole.conf"
---
> StopIfError "Director not defined in /opt/bacula/etc/bconsole.conf
32c32
< BACULA_CLIENT=`grep $(hostname -s) /etc/bacula/bacula-fd.conf | grep "\-fd" | awk '{print $3}' | sed -e "s/-fd//g"`
---
> BACULA_CLIENT=`grep $(hostname -s) /opt/bacula/etc/bacula-fd.conf | grep "\-fd" | awk '{print $3}' | sed -e "s/-fd//g"`
34c34
< StopIfError "Client $(hostname -s) not defined in /etc/bacula/bacula-fd.conf"
---
> StopIfError "Client $(hostname -s) not defined in /opt/bacula/etc/bacula-fd.conf
diff -btwr usr/share/rear/verify/BACULA/default/050_check_requirements.sh /usr/share/rear/verify/BACULA/default/050_check_requirements.sh
22c22
<    [ -x /usr/sbin/bacula-fd ]
---
>    [ -x /opt/bacula/bin/bacula-fd ]
25c25
<    [ -s /etc/bacula/bacula-fd.conf ]
---
>    [ -s /opt/bacula/etc/bacula-fd.conf ]
28c28
<    [ -x /usr/sbin/bconsole ]
---
>    [ -x /opt/bacula/bin/bconsole ]
31c31
<    [ -s /etc/bacula/bconsole.conf ]
---
>    [ -s /opt/bacula/etc/bconsole.conf ]
diff -btwr usr/share/rear/verify/BACULA/default/100_start_bacula-fd.sh /usr/share/rear/verify/BACULA/default/100_start_bacula-fd.sh
16c16
<    bacula-fd -u root -g bacula -c /etc/bacula/bacula-fd.conf
---
>    /opt/bacula/bin/bacula-fd -u root -g bacula -c /opt/bacula/etc/bacula-fd.conf
  • Attachments, as applicable ("rear -D mkrescue/mkbackup/recover" debug log files):

linuxdan commented at 2019-05-31 18:41:

I checked and found the alternate file paths in CentOS - bacula-client and bacula-console

So my guess appears accurate. Open source bacula and bacula enterprise put things in different locations.

What would be easier ?
Making a separate BACKUP type like ENT_BACULA
or
adding code to BACULA to look in two locations ?

linuxdan commented at 2019-05-31 18:49:

Red Hat RPM's use the same paths as CentOS

jsmeix commented at 2019-06-03 10:26:

I do not use Bacula or any other third-party backup tools.
Therefore I can neither reproduce such issues
nor can I verify what could actually fix it.

@gdha
do you perhaps know someone who could help
with issues in case of BACKUP=BACULA
(ideally a Bacula developer from Bacula.org)?

@linuxdan
my offhanded preference is to add code to BACULA to look in two locations
because I think in both cases it is basically "the same Bacula software"
where only the files are installed at different locations.

I think a separate BACKUP type like ENT_BACULA would only make sense
if the bacula-enterprise-client software would behave substantially different
compared to what is currently implemented for BACKUP=BACULA.

I would prefer a generic future-proof solution with additional config variables
in usr/share/rear/conf/default.conf where Bacula directories are specified,
for example something like

# For bacula-enterprise-client use BACULA_CONF_DIR="/opt/bacula/etc"
BACULA_CONF_DIR="/etc/bacula"
# For bacula-enterprise-client use BACULA_BIN_DIR="/opt/bacula/bin"
BACULA_BIN_DIR="/usr/sbin"

or even with automated setting of the right values like

BACULA_CONF_DIR="/etc/bacula"
# bacula-enterprise-client uses /opt/bacula/etc
test -d "/opt/bacula/etc" && BACULA_CONF_DIR="/opt/bacula/etc"
BACULA_BIN_DIR="/usr/sbin"
# bacula-enterprise-client uses /opt/bacula/bin
test -d "/opt/bacula/bin" && BACULA_BIN_DIR="/opt/bacula/bin"

You can run code as you like in usr/share/rear/conf/default.conf
because in ReaR also config files are sourced and executed
as bash scripts, e.g. see how REAL_MACHINE is set in default.conf

jsmeix commented at 2019-06-03 10:34:

@linuxdan
is your first change from bacula-sd.conf to bacula-fd.conf in

diff -btwr usr/share/rear/prep/BACULA/default/450_check_BACULA_client_configured.sh /usr/share/rear/prep/BACULA/default/450_check_BACULA_client_configured.sh
10c10
<    [ -s /etc/bacula/bacula-sd.conf ]
---
>    [ -s /opt/bacula/etc/bacula-fd.conf ]

intentionally or is it perhaps a typo?

gdha commented at 2019-06-03 12:55:

@jsmeix I have no knowledge of any Bacula user ( is over 10 years ago I used it ). Indeed the proposed solution with the BACULA_BIN_DIR setting looks the correct way to go for. Preferably automatically detected via a prep script.
Is this something @linuxdan could try out and propare a PR for it?

linuxdan commented at 2019-06-03 13:34:

@linuxdan
is your first change from bacula-sd.conf to bacula-fd.conf in

diff -btwr usr/share/rear/prep/BACULA/default/450_check_BACULA_client_configured.sh /usr/share/rear/prep/BACULA/default/450_check_BACULA_client_configured.sh
10c10
<    [ -s /etc/bacula/bacula-sd.conf ]
---
>    [ -s /opt/bacula/etc/bacula-fd.conf ]

intentionally or is it perhaps a typo?

That's a typo. Sharp eyes.

Thanks.

linuxdan commented at 2019-06-03 13:41:

@jsmeix I have no knowledge of any Bacula user ( is over 10 years ago I used it ). Indeed the proposed solution with the BACULA_BIN_DIR setting looks the correct way to go for. Preferably automatically detected via a prep script.
Is this something @linuxdan could try out and prepare a PR for it?

I am willing to give it a try.
I have already identified all the places BACULA_BIN_DIR and BACULA_CONF_DIR are needed.
All I need is a clue or three about how to set up a prep script.

linuxdan commented at 2019-06-03 13:42:

Unfortunately, I have no spare time to work this for the next two weeks.
Can it wait that long ?

jsmeix commented at 2019-06-04 06:27:

@linuxdan
no worries - no rush - it can wait as long as you need.
Apparently you are currently the only one
who uses ReaR with bacula-enterprise-client.

jsmeix commented at 2019-06-05 09:19:

@gdha
regarding

Preferably automatically detected via a prep script

in your https://github.com/rear/rear/issues/2152#issuecomment-498244676

If we do the automated settings directly in default.conf as in
https://github.com/rear/rear/issues/2152#issuecomment-498201997
the whole code is simpler because default.conf is sourced before
etc/rear/local.conf so that the user can enforce his own settings.

If we do the automated settings in a prep script
e.g. at the beginning of the existing BACULA specific
usr/share/rear/prep/BACULA/default/400_prep_bacula.sh
the code gets more complicated because the prep script
is sourced after both default.conf and etc/rear/local.conf
were sourced so that special stuff is needed to be able to
distingush the default case where automated settings should happen
from the case where the user had specified the values in etc/rear/local.conf
so that no automated settings should happen in the prep script
(ReaR must obey what its user has explicity specifed).

The usual way how to distingush the default case
from the user specified case is that by default
config variables are set to an empty value.

So we would have in default.conf

# If empty BACULA_CONF_DIR and BACULA_BIN_DIR
# are automatically set in
# prep/BACULA/default/400_prep_bacula.sh
# Usually BACULA_CONF_DIR is "/etc/bacula"
# but for bacula-enterprise-client it is "/opt/bacula/etc"
# Usually BACULA_BIN_DIR is "/usr/sbin"
# but for bacula-enterprise-client it is "/opt/bacula/bin"
BACULA_CONF_DIR=""
BACULA_BIN_DIR=""

and in prep/BACULA/default/400_prep_bacula.sh
something like

if ! test $BACULA_CONF_DIR ; then
    BACULA_CONF_DIR="/etc/bacula"
    # bacula-enterprise-client uses /opt/bacula/etc
    test -d "/opt/bacula/etc" && BACULA_CONF_DIR="/opt/bacula/etc"   
fi
if ! test $BACULA_BIN_DIR ; then
    BACULA_BIN_DIR="/usr/sbin"
    # bacula-enterprise-client uses /opt/bacula/bin
    test -d "/opt/bacula/bin" && BACULA_BIN_DIR="/opt/bacula/bin"
fi

or better in compliance with "Try to care about possible errors"
in https://github.com/rear/rear/wiki/Coding-Style
in 400_prep_bacula.sh something like

if ! test -d "$BACULA_CONF_DIR" ; then
    test -d "/etc/bacula" && BACULA_CONF_DIR="/etc/bacula"
    # bacula-enterprise-client uses /opt/bacula/etc
    test -d "/opt/bacula/etc" && BACULA_CONF_DIR="/opt/bacula/etc"   
fi
test -d "$BACULA_CONF_DIR" || Error "No BACULA_CONF_DIR"
if ! test -d "$BACULA_BIN_DIR" ; then
    BACULA_BIN_DIR="/usr/sbin"
    # bacula-enterprise-client uses /opt/bacula/bin
    test -d "/opt/bacula/bin" && BACULA_BIN_DIR="/opt/bacula/bin"
fi

jsmeix commented at 2019-06-05 09:20:

@linuxdan
see https://github.com/rear/rear/issues/2152#issuecomment-499006517
for "a clue or three about how to set up a prep script".

github-actions commented at 2020-06-29 01:37:

Stale issue message

VN1977 commented at 2020-11-23 14:57:

Hello!
I have the same problem. Can you return to it and solve at last?

gdha commented at 2020-11-23 15:16:

@VN1977 We do not use (enterprise) bacula whatsoever, so do not expect from us to blindly change code which cannot be tested.
Therefore, may I propose if you can prepare a pull request for the needed changes?

VN1977 commented at 2020-11-23 18:22:

Sure i can add pull request.
And want to clarify that i use community edition not enterprise.

Regards, Vladimir

linuxdan commented at 2020-11-23 19:21:

This issue was for the Enterprise Bacula client.

VN1977 commented at 2020-11-23 20:06:

Sorry i see.
If it's possible to continue here I try to explain the problem because it's
connected with community edition too.
According to this manual
https://www.bacula.org/whitepapers/CommunityInstallationGuide.pdf community
version is installed to /opt/bacula, so it could be two places where config
and bin files live. For RPM version 5 default path was /etc/bacula but
current RPMs compiled differently. Of cource I can compile the new custom
RPM with /etc/bacula to comply rear.

Regards, Vladimir

VN1977 commented at 2020-11-24 08:22:

I honestly tried to create a new pull request but didn't understand how to do it. It was my first expirience.

gdha commented at 2020-11-24 08:49:

@VN1977 See Contributing section of http://relax-and-recover.org/development/
If it is unclear please let us know

VN1977 commented at 2020-11-24 09:22:

Yes, it's unclear. I never worked with git and created pull requests. I thought that creating it similar to posting issues

gdha commented at 2020-12-09 13:32:

@linuxdan @VN1977 Could you have a look at the comments from @jsmeix - https://github.com/rear/rear/pull/2535#issuecomment-741769548
And, provide the required feedback what the best approach is according you?

linuxdan commented at 2020-12-09 21:47:

@linuxdan @VN1977 Could you have a look at the comments from @jsmeix - #2535 (comment)
And, provide the required feedback what the best approach is according you?

That is a completely different issue that this one.
I would have to re-investigate the source code.
Is anyone planning to help see this issue reaches a fix ?

linuxdan commented at 2020-12-09 21:52:

Sorry i see. If it's possible to continue here I try to explain the problem because it's connected with community edition too. According to this manual https://www.bacula.org/whitepapers/CommunityInstallationGuide.pdf community version is installed to /opt/bacula, so it could be two places where config and bin files live. For RPM version 5 default path was /etc/bacula but current RPMs compiled differently. Of cource I can compile the new custom RPM with /etc/bacula to comply rear. Regards, Vladimir

That guide is dated 2018 and refers to apt commands for installing. I am working with CentOS/RHEL systems. The community RPM installs to /etc/bacula

Try installing it on a CentOS system or just look at the contents of the CentOS RPM.

VN1977 commented at 2020-12-10 06:18:

This guide is about Centos 6 and 7 too. Look for page 6 for instance. I work with CentOS 7.
If you don't like guides look at
https://www.bacula.lat/script-installation-bacula-community-9-x-official-packages/?lang=en
Community version installs to /opt at least 9.6, try to deploy test lab.


[Export of Github issue for rear/rear.]