Bug 16804 - bacula backup catalog doesn't run because of a permission issue
Summary: bacula backup catalog doesn't run because of a permission issue
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 5
Hardware: All Linux
Priority: High critical
Target Milestone: ---
Assignee: QA Team
QA Contact:
URL:
Whiteboard: advisory MGA5-64-OK
Keywords: validated_update
Depends on:
Blocks:
 
Reported: 2015-09-22 20:29 CEST by Thomas Spuhler
Modified: 2015-10-15 21:51 CEST (History)
5 users (show)

See Also:
Source RPM: bacula
CVE:
Status comment:


Attachments

Description Thomas Spuhler 2015-09-22 20:29:19 CEST
Description of problem:
bacula backup catalog doesn't run because of a permission issue.

bacula-dir runs as -u bacula -g bacula, but the permission of /usr/sbin/dbcheck is rwxr---- root bacula
as a result,bacula-dir has no way to run it.

Version-Release number of selected component (if applicable):
7.0.5-14.4

How reproducible:
every time

Steps to Reproduce:
1.use bat or bconsole and run backup catalog. It will fail 
2.you will see the following error in the job log file:

shell command: run BeforeJob "/usr/libexec/bacula/make_catalog_backup.pl MyCatalog"
BeforeJob: sh: /usr/sbin/dbcheck: Permission denied
BeforeJob: Can't find your catalog (MyCatalog) in director configuration


Reproducible: 

Steps to Reproduce:
Thomas Spuhler 2015-09-22 20:30:10 CEST

Priority: Normal => High
Status: NEW => ASSIGNED
CC: (none) => thomas
Assignee: bugsquad => thomas

Comment 1 Thomas Spuhler 2015-09-22 20:41:52 CEST
This error has been resolved by chaning the permisssion of /usr/sbin/dbcheck to rwxr-x--- root bacula
The following files are now in mga5 upgrades_testing:
bacula-7.0.5-14.5.mga5.src.rpm
lib64bacula7-7.0.5-14.5.mga5.x86_64.rpm
lib64bacula-sql7-7.0.5-14.5.mga5.x86_64.rpm
bacula-common-7.0.5-14.5.mga5.x86_64.rpm
bacula-dir-7.0.5-14.5.mga5.x86_64.rpm
bacula-sd-7.0.5-14.5.mga5.x86_64.rpm
bacula-fd-7.0.5-14.5.mga5.x86_64.rpm
bacula-console-7.0.5-14.5.mga5.x86_64.rpm
bacula-bat-7.0.5-14.5.mga5.x86_64.rpm
bacula-tray-monitor-7.0.5-14.5.mga5.x86_64.rpm
lib64bacula-devel-7.0.5-14.5.mga5.x86_64.rpm
nagios-plugins-bacula-7.0.5-14.5.mga5.x86_64.rpm
bacula-debuginfo-7.0.5-14.5.mga5.x86_64.rpm
and i586 packages.

I have tested this on my server. The problem was also discussed on a WEB site and the reporter of #16717 has proposed and found the solution working.

This bug has priority over #16717 as it prevents bacula from doing backups and the solution is known.
This does not resolve bug #16717. This bug needs more work to be resolved.

Assignee: thomas => qa-bugs

Comment 2 claire robinson 2015-09-22 22:13:05 CEST
Assigning bug 16022 back to Thomas so we don't have two bacula bugs assigned to QA
Comment 3 Lewis Smith 2015-10-05 21:46:05 CEST
About to test MGA5 x64.
Background info (different from Mageia 4):
 /usr/share/doc/bacula-common/README.mageia      [Package summary]
 /usr/share/doc/bacula-common/quickstart_*.txt   [Installation per database]
 http://lucasmanual.com/mywiki/Bacula#Configure_Bacula
section 'Manage bacula' gives some basic bconsole usage examples.
 /usr/share/bacula/index.html        [Bacula Administration Tool user guide]

Installed from issued repos:
 bacula-bat-7.0.5-14.mga5
 bacula-common-7.0.5-14.mga5
 bacula-console-7.0.5-14.mga5
 bacula-dir-7.0.5-14.mga5
 bacula-fd-7.0.5-14.mga5
 bacula-sd-7.0.5-14.mga5
 bacula-tray-monitor-7.0.5-14.mga5
 lib64bacula7-7.0.5-14.mga5
 lib64bacula-sql7-7.0.5-14.mga5
 nagios-plugins-bacula-7.0.5-14.mga5

To follow: /usr/share/doc/bacula-common/quickstart_mysql.txt

CC: (none) => lewyssmith

Comment 4 Lewis Smith 2015-10-06 20:34:35 CEST
Actually trying
 /usr/share/doc/bacula-common/quickstart_postgresql.txt
without much success. Postgres server is running, also all the 3 bacula daemons bacula-dir|fd|sd - as yet unconfigured.

 # alternatives --set libbaccats.so /usr/lib64/libbaccats-postgresql.so
 Using `/usr/lib64/libbaccats-postgresql.so' to provide `libbaccats.so'.
looks OK.

 # postgresql-setup initdb
 bash: postgresql-setup: command not found

 # su - postgres
 gpg-agent[6095]: directory `/var/lib/pgsql/.gnupg' created
 gpg-agent[6095]: directory `/var/lib/pgsql/.gnupg/private-keys-v1.d' created
 gpg-agent[6096]: gpg-agent (GnuPG) 2.0.27 started

 [postgres@localhost ~]$ cd /usr/libexec/bacula
 [postgres@localhost bacula]$ ./create_bacula_database
 -bash: ./create_bacula_database: Permission denied
 [postgres@localhost bacula]$ ./make_bacula_tables
 -bash: ./make_bacula_tables: Permission denied
 [postgres@localhost bacula]$ ./grant_bacula_privileges
 -bash: ./grant_bacula_privileges: Permission denied

All the cited files in /usr/libexec/bacula are:
 -rwxr-x--- 1 root root  1307 May  1 21:13 create_bacula_database*
 -rwxr-x--- 1 root root   857 May  1 21:13 create_mysql_database*
 -rwxr-x--- 1 root root  2219 May  1 21:13 create_postgresql_database*
 -rwxr-x--- 1 root root   837 May  1 21:13 create_sqlite3_database*
 -rwxr-x--- 1 root root  1318 May  1 21:13 make_bacula_tables*
 -rwxr-x--- 1 root root  3619 May  1 21:13 make_catalog_backup.pl*
 -rwxr-x--- 1 root root 14362 May  1 21:13 make_mysql_tables*
 -rwxr-x--- 1 root root 14933 May  1 21:13 make_postgresql_tables*
 -rwxr-x--- 1 root root 14176 May  1 21:13 make_sqlite3_tables*
 -rwxr-x--- 1 root root  1348 May  1 21:13 grant_bacula_privileges*
 -rwxr-x--- 1 root root  1180 May  1 21:13 grant_mysql_privileges*
 -rwxr-x--- 1 root root  3123 May  1 21:13 grant_postgresql_privileges*
 -rwxr-x--- 1 root root   676 May  1 21:13 grant_sqlite3_privileges*
 [postgres@localhost bacula]$ id
 uid=982(postgres) gid=980(postgres) groups=980(postgres)

 # ls -l /usr/sbin/dbcheck
 -rwxr-x--- 1 root root 109328 Mai   1 21:13 /usr/sbin/dbcheck*
this last being what the update will change.

I am reluctant to change anything - permissions etc - for fear of messing things up. So far, a virgin installation. Await feedback: @Thomas?
Comment 5 Thomas Spuhler 2015-10-06 20:46:10 CEST
(In reply to Lewis Smith from comment #4)
> Actually trying
>  /usr/share/doc/bacula-common/quickstart_postgresql.txt
> without much success. Postgres server is running, also all the 3 bacula
> daemons bacula-dir|fd|sd - as yet unconfigured.
> 
>  # alternatives --set libbaccats.so /usr/lib64/libbaccats-postgresql.so
>  Using `/usr/lib64/libbaccats-postgresql.so' to provide `libbaccats.so'.
> looks OK.
> 
>  # postgresql-setup initdb
>  bash: postgresql-setup: command not found
> 
>  # su - postgres
>  gpg-agent[6095]: directory `/var/lib/pgsql/.gnupg' created
>  gpg-agent[6095]: directory `/var/lib/pgsql/.gnupg/private-keys-v1.d' created
>  gpg-agent[6096]: gpg-agent (GnuPG) 2.0.27 started
> 
>  [postgres@localhost ~]$ cd /usr/libexec/bacula
>  [postgres@localhost bacula]$ ./create_bacula_database
>  -bash: ./create_bacula_database: Permission denied
>  [postgres@localhost bacula]$ ./make_bacula_tables
>  -bash: ./make_bacula_tables: Permission denied
>  [postgres@localhost bacula]$ ./grant_bacula_privileges
>  -bash: ./grant_bacula_privileges: Permission denied
> 
> All the cited files in /usr/libexec/bacula are:
>  -rwxr-x--- 1 root root  1307 May  1 21:13 create_bacula_database*
>  -rwxr-x--- 1 root root   857 May  1 21:13 create_mysql_database*
>  -rwxr-x--- 1 root root  2219 May  1 21:13 create_postgresql_database*
>  -rwxr-x--- 1 root root   837 May  1 21:13 create_sqlite3_database*
>  -rwxr-x--- 1 root root  1318 May  1 21:13 make_bacula_tables*
>  -rwxr-x--- 1 root root  3619 May  1 21:13 make_catalog_backup.pl*
>  -rwxr-x--- 1 root root 14362 May  1 21:13 make_mysql_tables*
>  -rwxr-x--- 1 root root 14933 May  1 21:13 make_postgresql_tables*
>  -rwxr-x--- 1 root root 14176 May  1 21:13 make_sqlite3_tables*
>  -rwxr-x--- 1 root root  1348 May  1 21:13 grant_bacula_privileges*
>  -rwxr-x--- 1 root root  1180 May  1 21:13 grant_mysql_privileges*
>  -rwxr-x--- 1 root root  3123 May  1 21:13 grant_postgresql_privileges*
>  -rwxr-x--- 1 root root   676 May  1 21:13 grant_sqlite3_privileges*
>  [postgres@localhost bacula]$ id
>  uid=982(postgres) gid=980(postgres) groups=980(postgres)
> 
>  # ls -l /usr/sbin/dbcheck
>  -rwxr-x--- 1 root root 109328 Mai   1 21:13 /usr/sbin/dbcheck*
> this last being what the update will change.

I never used postgresql
but the dbcheck should be 
ls -l /usr/sbin/dbcheck
-rwxr-x--- 1 root bacula 109328 Sep 10 15:48 /usr/sbin/dbcheck*

> 
> I am reluctant to change anything - permissions etc - for fear of messing
> things up. So far, a virgin installation. Await feedback: @Thomas?
Comment 6 Lewis Smith 2015-10-08 20:22:23 CEST
Having another go x64.
In case the problem was down to Postgres, I changed things to MariaDB following
/usr/share/doc/bacula-common/quickstart_mysql.txt (remember, nothing has yet been set up).
 # alternatives --set libbaccats.so /usr/lib64/libbaccats-mysql.so
 Using `/usr/lib64/libbaccats-mysql.so' to provide `libbaccats.so'.

 # cd /usr/libexec/bacula
 # ./create_bacula_database mysql
 Creating mysql database
 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
 Creation of bacula database failed.

I then updated everything to:
 bacula-bat-7.0.5-14.5.mga5
 bacula-common-7.0.5-14.5.mga5
 bacula-console-7.0.5-14.5.mga5
 bacula-dir-7.0.5-14.5.mga5
 bacula-fd-7.0.5-14.5.mga5
 bacula-sd-7.0.5-14.5.mga5
 bacula-tray-monitor-7.0.5-14.5.mga5
 lib64bacula7-7.0.5-14.5.mga5
 lib64bacula-sql7-7.0.5-14.5.mga5
 nagios-plugins-bacula-7.0.5-14.5.mga5

Stopped all three bacula daemons, and tried again. Same result:
 # ./create_bacula_database mysql
 Creating mysql database
 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
 Creation of bacula database failed.
but could this be a MariaDB problem?

Some files have changed permissions etc:
 # ls -l /usr/libexec/bacula
 -rwxr-x--- 1 root bacula   672 Med  22 20:15 delete_catalog_backup*
 -rwxr-x--- 1 root bacula  3619 Med  22 20:15 make_catalog_backup.pl*
 # ls -l /usr/sbin/dbcheck
 -rwxr-x--- 1 root root 109328 Med  22 20:15 /usr/sbin/dbcheck*
[group still root], the others being as before.

But if the last *should* be (Comment 5):
 -rwxr-x--- 1 root bacula 109328 Sep 10 15:48 /usr/sbin/dbcheck*
should this not have been done by the update? I *could* change this manually, but that would negate the update validation.
Also, I may be doing something wrong, again.
Comment 7 Thomas Spuhler 2015-10-08 23:51:08 CEST
this was added in subrel 5: %attr(0750,root,bacula})%{_sbindir}/dbcheck in bacula-dir
so this should be done in the upgrade or am I missing something?
Comment 8 Thomas Spuhler 2015-10-09 00:02:33 CEST
(In reply to Lewis Smith from comment #6)
> Having another go x64.
> In case the problem was down to Postgres, I changed things to MariaDB
> following
> /usr/share/doc/bacula-common/quickstart_mysql.txt (remember, nothing has yet
> been set up).
>  # alternatives --set libbaccats.so /usr/lib64/libbaccats-mysql.so
>  Using `/usr/lib64/libbaccats-mysql.so' to provide `libbaccats.so'.
> 
>  # cd /usr/libexec/bacula
>  # ./create_bacula_database mysql
>  Creating mysql database
>  ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using
> password: NO)
>  Creation of bacula database failed.
> 
> I then updated everything to:
>  bacula-bat-7.0.5-14.5.mga5
>  bacula-common-7.0.5-14.5.mga5
>  bacula-console-7.0.5-14.5.mga5
>  bacula-dir-7.0.5-14.5.mga5
>  bacula-fd-7.0.5-14.5.mga5
>  bacula-sd-7.0.5-14.5.mga5
>  bacula-tray-monitor-7.0.5-14.5.mga5
>  lib64bacula7-7.0.5-14.5.mga5
>  lib64bacula-sql7-7.0.5-14.5.mga5
>  nagios-plugins-bacula-7.0.5-14.5.mga5
> 
> Stopped all three bacula daemons, and tried again. Same result:
>  # ./create_bacula_database mysql
>  Creating mysql database
>  ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using
> password: NO)
>  Creation of bacula database failed.
> but could this be a MariaDB problem?

Did you set a rootpassword earlier in mariadb? If yes you probably need to run it with the -p option (-p = password)

> 
> Some files have changed permissions etc:
>  # ls -l /usr/libexec/bacula
>  -rwxr-x--- 1 root bacula   672 Med  22 20:15 delete_catalog_backup*
>  -rwxr-x--- 1 root bacula  3619 Med  22 20:15 make_catalog_backup.pl*
>  # ls -l /usr/sbin/dbcheck
>  -rwxr-x--- 1 root root 109328 Med  22 20:15 /usr/sbin/dbcheck*
> [group still root], the others being as before.
> 
> But if the last *should* be (Comment 5):
>  -rwxr-x--- 1 root bacula 109328 Sep 10 15:48 /usr/sbin/dbcheck*
> should this not have been done by the update? I *could* change this
> manually, but that would negate the update validation.
> Also, I may be doing something wrong, again.
Comment 9 Thomas Spuhler 2015-10-09 00:14:39 CEST
(In reply to Thomas Spuhler from comment #7)
> this was added in subrel 5: %attr(0750,root,bacula})%{_sbindir}/dbcheck in
> bacula-dir
> so this should be done in the upgrade or am I missing something?

Ooops, %attr(0750,root,bacula}) is not right, needs to be %attr(0750,root,bacula)
                             ^
This is probably why it uses root                    
I need to rebuild with subrel 6
Comment 10 Thomas Spuhler 2015-10-09 00:26:56 CEST
OK, the new bacula-7.0.5-14.6.mga5 packages are now in updates_testing:
bacula-7.0.5-14.6.mga5.src.rpm
lib64bacula7-7.0.5-14.6.mga5.x86_64.rpm
lib64bacula-sql7-7.0.5-14.6.mga5.x86_64.rpm
bacula-common-7.0.5-14.6.mga5.x86_64.rpm
bacula-dir-7.0.5-14.6.mga5.x86_64.rpm
bacula-sd-7.0.5-14.6.mga5.x86_64.rpm
bacula-fd-7.0.5-14.6.mga5.x86_64.rpm
bacula-console-7.0.5-14.6.mga5.x86_64.rpm
bacula-bat-7.0.5-14.6.mga5.x86_64.rpm
bacula-tray-monitor-7.0.5-14.6.mga5.x86_64.rpm
lib64bacula-devel-7.0.5-14.6.mga5.x86_64.rpm
nagios-plugins-bacula-7.0.5-14.6.mga5.x86_64.rpm
bacula-debuginfo-7.0.5-14.6.mga5.x86_64.rpm
and corresponding i586 packages
Dave Hodgins 2015-10-09 03:09:41 CEST

CC: (none) => davidwhodgins
Whiteboard: (none) => advisory

Comment 11 Herman Viaene 2015-10-09 16:42:25 CEST
MAG5-64 on HP Probook 6555b KDE
Run into installation problem (had just forced an update on core-testing:
bacula-common = 1:7.0.5-14.6.mga5 is needed by bacula-sd-1:7.0.5-14.6.mga5.x86_64
nagios is needed by nagios-plugins-bacula-1:7.0.5-14.6.mga5.x86_64
bacula-common = 1:7.0.5-14.6.mga5 is needed by bacula-fd-1:7.0.5-14.6.mga5.x86_64
ERROR: 'unpack' failed for nagios-4.0.8-2.mga5
ERROR: 'script' failed for bacula-common-7.0.5-14.6.mga5

CC: (none) => herman.viaene

Comment 12 Lewis Smith 2015-10-11 22:21:21 CEST
Testing x64 with:
 bacula-bat-7.0.5-14.6.mga5
 bacula-common-7.0.5-14.6.mga5
 bacula-console-7.0.5-14.6.mga5
 bacula-dir-7.0.5-14.6.mga5
 bacula-fd-7.0.5-14.6.mga5
 bacula-sd-7.0.5-14.6.mga5
 bacula-tray-monitor-7.0.5-14.6.mga5
 lib64bacula7-7.0.5-14.6.mga5
 lib64bacula-sql7-7.0.5-14.6.mga5
 nagios-plugins-bacula-7.0.5-14.6.mga5

# ls -l /usr/sbin/dbcheck
-rwxr-x--- 1 root bacula 109328 Hyd   9 00:21 /usr/sbin/dbcheck*   [as it should be]

Stopped all 3 Bacula daemons.
Trying Postgres (which has no password) to start with:
 /usr/share/doc/bacula-common/quickstart_postgresql.txt
# alternatives --set libbaccats.so /usr/lib64/libbaccats-postgresql.so
Using `/usr/lib64/libbaccats-postgresql.so' to provide `libbaccats.so'.
# su - postgres
[postgres@localhost ~]$ cd /usr/libexec/bacula
[postgres@localhost bacula]$ ./create_bacula_database
-bash: ./create_bacula_database: Permission denied
[postgres@localhost bacula]$ 
[postgres@localhost bacula]$ exit
logout
I wonder whether these commands need a final 'postgres'; see the MySQL equivalent below.

Reverting to Mysql/MariaDB, whis has a password, so you need to add -p to the given setup commands:
 /usr/share/doc/bacula-common/quickstart_mysql.txt
# alternatives --set libbaccats.so /usr/lib64/libbaccats-mysql.so
Using `/usr/lib64/libbaccats-mysql.so' to provide `libbaccats.so'.
# cd /usr/libexec/bacula
# ./create_bacula_database mysql -p
Creating mysql database
Enter password: 
Creation of bacula database succeeded.
# ./make_bacula_tables mysql -p
Making mysql tables
Enter password: 
Creation of Bacula MySQL tables succeeded.
# ./grant_bacula_privileges mysql -p
Granting mysql privileges
Enter password: 
...
Privileges for user bacula granted on database bacula.

Changed Password (except for DB) in all the /etc/bacula/*.conf to 'password'.
Re-started the 3 Bacula daemons.
Played with bconsole (have to be root). Tried as normal user from the menu Bacula Bat Console [GUI], "Failed to execute command "/usr/sbin/bat -c /etc/bacula/bat.conf". Methwyd gweithredu proses plentyn "/usr/sbin/bat" (Permission denied)". Root again...
# bat
basically worked - except icon hints are empty.

Update deemed OK.

Whiteboard: advisory => advisory MGA5-64-OK

Comment 13 Thomas Spuhler 2015-10-11 23:19:43 CEST
(In reply to Lewis Smith from comment #12)
> Testing x64 with:
>  bacula-bat-7.0.5-14.6.mga5
>  bacula-common-7.0.5-14.6.mga5
>  bacula-console-7.0.5-14.6.mga5
>  bacula-dir-7.0.5-14.6.mga5
>  bacula-fd-7.0.5-14.6.mga5
>  bacula-sd-7.0.5-14.6.mga5
>  bacula-tray-monitor-7.0.5-14.6.mga5
>  lib64bacula7-7.0.5-14.6.mga5
>  lib64bacula-sql7-7.0.5-14.6.mga5
>  nagios-plugins-bacula-7.0.5-14.6.mga5
> 
> # ls -l /usr/sbin/dbcheck
> -rwxr-x--- 1 root bacula 109328 Hyd   9 00:21 /usr/sbin/dbcheck*   [as it
> should be]
> 
> Stopped all 3 Bacula daemons.
> Trying Postgres (which has no password) to start with:
>  /usr/share/doc/bacula-common/quickstart_postgresql.txt
> # alternatives --set libbaccats.so /usr/lib64/libbaccats-postgresql.so
> Using `/usr/lib64/libbaccats-postgresql.so' to provide `libbaccats.so'.
> # su - postgres
> [postgres@localhost ~]$ cd /usr/libexec/bacula
> [postgres@localhost bacula]$ ./create_bacula_database
> -bash: ./create_bacula_database: Permission denied
> [postgres@localhost bacula]$ 
> [postgres@localhost bacula]$ exit
> logout
> I wonder whether these commands need a final 'postgres'; see the MySQL
> equivalent below.
I have never used postgres, but according to the docu, you don't have to specify it. Also see the script, postgres is the default and doesn't need to be specified.
Maybe someone else know better about postgreas!
> 
> Reverting to Mysql/MariaDB, whis has a password, so you need to add -p to
> the given setup commands:
>  /usr/share/doc/bacula-common/quickstart_mysql.txt
> # alternatives --set libbaccats.so /usr/lib64/libbaccats-mysql.so
> Using `/usr/lib64/libbaccats-mysql.so' to provide `libbaccats.so'.
> # cd /usr/libexec/bacula
> # ./create_bacula_database mysql -p
> Creating mysql database
> Enter password: 
> Creation of bacula database succeeded.
> # ./make_bacula_tables mysql -p
> Making mysql tables
> Enter password: 
> Creation of Bacula MySQL tables succeeded.
> # ./grant_bacula_privileges mysql -p
> Granting mysql privileges
> Enter password: 
> ...
> Privileges for user bacula granted on database bacula.
> 
> Changed Password (except for DB) in all the /etc/bacula/*.conf to 'password'.
> Re-started the 3 Bacula daemons.
> Played with bconsole (have to be root). Tried as normal user from the menu
> Bacula Bat Console [GUI], "Failed to execute command "/usr/sbin/bat -c
> /etc/bacula/bat.conf". Methwyd gweithredu proses plentyn "/usr/sbin/bat"
> (Permission denied)". Root again...
> # bat
> basically worked - except icon hints are empty.
> 
> Update deemed OK.
Comment 14 claire robinson 2015-10-15 16:27:45 CEST
Could you formulate an advisory please Thomas
claire robinson 2015-10-15 16:27:57 CEST

Keywords: (none) => validated_update
CC: (none) => sysadmin-bugs

Comment 15 claire robinson 2015-10-15 16:31:48 CEST
Seems we already have one, nevermind :)
Comment 16 Mageia Robot 2015-10-15 21:51:54 CEST
An update for this issue has been pushed to Mageia Updates repository.

http://advisories.mageia.org/MGAA-2015-0158.html

Status: ASSIGNED => RESOLVED
Resolution: (none) => FIXED


Note You need to log in before you can comment on or make changes to this bug.