While creating the FreeBSD package for 5.0.0, I noticed a few new things to be aware of.
With 5.0.0 comes a new backup catalog script. It parses the bacula-dir.conf file and extracts what it needs from that. This means you only need to specify the database connection information in one place and it is not passed to a script via the command line.
If you see this error while running that script:
25-Jan 16:37 ducky.unixathome.org-dir JobId 32500: shell command: run BeforeJob "/usr/local/share/bacula/make_catalog_backup.pl MyCatalog" 25-Jan 16:37 ducky.unixathome.org-dir JobId 32500: BeforeJob: Can't get catalog information at /usr/local/share/bacula/make_catalog_backup.pl line 129. 25-Jan 16:37 ducky.unixathome.org-dir JobId 32500: Error: Runscript: BeforeJob returned non-zero status=13. ERR=Child exited with code 13 25-Jan 16:37 ducky.unixathome.org-dir JobId 32500: Error: Bacula ducky.unixathome.org-dir 5.0.0 (26Jan10): 25-Jan-2010 16:37:10
Then I suspect the permissions on make_catalog_backup.pl are insufficient for Bacula to run it. I made mine chown bacula:bacula and chmod 744:
-rwxr-xr-- 1 bacula bacula 4120 Jan 25 17:10 make_catalog_backup.pl
If you see this error:
25-Jan 16:44 ducky.unixathome.org-dir JobId 32502: shell command: run BeforeJob "/usr/local/share/bacula/make_catalog_backup.pl MyCatalog" 25-Jan 16:44 ducky.unixathome.org-dir JobId 32502: BeforeJob: Can't find your catalog (MyCatalog) in director configuration 25-Jan 16:44 ducky.unixathome.org-dir JobId 32502: Error: Runscript: BeforeJob returned non-zero status=1. ERR=Child exited with code 1
Then chances are the permissions on bacula-dir.conf or dbcheck are insufficient. Make sure this command works:
# su -m bacula -c '/usr/local/sbin/dbcheck -B -c /usr/local/etc/bacula-dir.conf' catalog=MyCatalog db_name=bacula db_driver= db_user=bacula db_password= db_address= db_port=0 db_socket= db_type=PostgreSQL working_dir=/var/db/bacula
If you get: /usr/local/sbin/dbcheck: Permission denied.
Make sure bacula is allowed to run dbcheck. I use this:
-rwxr-xr-- 1 root bacula 100225 Jan 25 17:12 dbcheck
If you get this, check the permissions on bacula-dir.conf:
26-Jan 01:37 dbcheck: ERROR TERMINATION at parse_conf.c:898 Config error: Cannot open config file "/usr/local/etc/bacula-dir.conf": Permission denied
I use this:
-rw-r----- 1 root bacula 9095 Jan 25 17:16 bacula-dir.conf
Finally, to be sure, run this command:
su -m bacula -c '/usr/local/share/bacula/make_catalog_backup.pl MyCatalog'
and if that runs fine, Bacula should be able to run it.
Also, if during the backup, you see permission errors on pathhierarchy or pathvisibility then the database upgrade wasn’t run as the correct user. You may have to adjust the owner of the database to match that of the other tables.
NOTE: This was originally posted to the Bacula users mailing list on 1 January 2010.
Thanks! This actually helped me out alot. The command:
su -m bacula -c ‘/usr/local/share/bacula/make_catalog_backup.pl MyCatalog’
helped me find that I had a permissions issue in on of the files included in the director config.
I had similar problems and I have to fix it by putting these permissions:
>> sudo ls -l /etc/bacula/
total 36
-rwxr-x— 1 bacula bacula 3070 may 15 15:59 bacula-dir.conf
-rwxr-x— 1 bacula bacula 1013 may 10 10:58 bacula-fd.conf
-rwxr-x— 1 bacula bacula 5949 may 13 12:15 bacula-sd.conf
-rwxr-x— 1 bacula bacula 192 may 10 10:55 bconsole.conf
drwxr-x— 2 bacula bacula 4096 may 15 15:59 clientes
-rwxr-x— 1 bacula bacula 442 may 10 10:57 common_default_passwords
-rwxr-x— 1 bacula bacula 2060 may 15 13:12 iaaa_messages.conf
drwxr-x— 2 bacula bacula 4096 may 16 10:48 scripts
>> sudo ls -l /etc/bacula/scripts
total 72
-rwxr-x— 1 bacula bacula 341 sep 8 2012 btraceback.gdb
-rwxr-x— 1 bacula bacula 112 sep 8 2012 delete_catalog_backup
-rwxr-x— 1 bacula bacula 10954 sep 8 2012 disk-changer
-rwxr-x— 1 bacula bacula 16948 sep 8 2012 dvd-handler
-rwxr-x— 1 bacula bacula 2485 sep 8 2012 make_catalog_backup
-rwxr-x— 1 bacula bacula 1646 sep 8 2012 make_catalog_backup_awk
-rwxr-x— 1 bacula bacula 4166 may 16 10:39 make_catalog_backup.pl
-rwxr-x— 1 bacula bacula 7510 sep 8 2012 mtx-changer
-rwxr-x— 1 bacula bacula 1506 sep 8 2012 mtx-changer.conf
-rwxr-x— 1 bacula bacula 256 sep 8 2012 query.sql
>> sudo ls -l /usr/sbin/dbcheck
-rwxr-xr-x 1 root root 101976 sep 8 2012 /usr/sbin/dbcheck
>> sudo ls -l /var/lib/ | grep bacula
drwx—— 2 bacula bacula 4096 may 16 10:59 bacula
07-Jun 14:53 bacula-dir JobId 16: shell command: run BeforeJob “/usr/libexec/bacula/make_catalog_backup.pl MyCatalog bacula bacula test bacula-dir”
07-Jun 14:53 bacula-dir JobId 16: Start Backup JobId 16, Job=BackupCatalog.2013-06-07_14.53.39_13
07-Jun 14:53 bacula-dir JobId 16: Using Device “FileStorage” to write.
07-Jun 14:53 bacula-sd JobId 16: Volume “File10001” previously written, moving to end of data.
07-Jun 14:53 bacula-sd JobId 16: Ready to append to end of Volume “File10001” size=7756119
07-Jun 14:53 bacula-fd JobId 16: Could not stat “/etc/bacula/bacula.sql”: ERR=No such file or directory
07-Jun 14:53 bacula-sd JobId 16: Elapsed time=00:00:01, Transfer rate=0 Bytes/second
*messages
07-Jun 14:53 bacula-dir JobId 16: Bacula bacula-dir 5.2.13 (19Jan13):
Build OS: x86_64-redhat-linux-gnu redhat Enterprise release
JobId: 16
Job: BackupCatalog.2013-06-07_14.53.39_13
Backup Level: Full
Client: “bacula-fd” 5.0.0 (26Jan10) x86_64-redhat-linux-gnu,redhat,
FileSet: “Catalog” 2013-06-07 13:35:03
Pool: “File” (From Job resource)
Catalog: “MyCatalog” (From Client resource)
Storage: “File” (From Job resource)
Scheduled time: 07-Jun-2013 14:53:39
Start time: 07-Jun-2013 14:53:42
End time: 07-Jun-2013 14:53:42
Elapsed time: 0 secs
Priority: 11
FD Files Written: 0
SD Files Written: 0
FD Bytes Written: 0 (0 B)
SD Bytes Written: 0 (0 B)
Rate: 0.0 KB/s
Software Compression: None
VSS: no
Encryption: no
Accurate: no
Volume name(s):
Volume Session Id: 16
Volume Session Time: 1370582280
Last Volume Bytes: 7,756,517 (7.756 MB)
Non-fatal FD errors: 1
SD Errors: 0
FD termination status: OK
SD termination status: OK
Termination: Backup OK — with warnings
Are you sure that the script in question creates /etc/bacula/bacula.sql?