Showing posts with label bacula. Show all posts
Showing posts with label bacula. Show all posts

Thursday, December 2, 2010

vchanger, Bacula, and "ERR=Unknown error during program execvp"

 After upgrading Bacula to 5.0.3, I started getting an error message when attempting to load a tape:


ERR=Unknown error during program execvp


I suspected it was a problem with vchanger, as it couldn't load/unload tapes, either. After looking in the disk that vchanger happened to be using, I discovered that drive0 obviously had a tape in it, but the file loaded0 was empty. I determined which "tape slot" was empty, added the name of the slot to the file loaded0, and unloaded it. Everything worked after that.


Wednesday, December 1, 2010

Problems Building RPMs for Bacula 5.0.3

So, after starting to build the RPMs from source for Bacula 5.0.3, I discovered several errors.


1. File /home/user1/rpm/SOURCES/bacula-5.0.2.tar.gz: No such file or directory

 Easily fixed, but I ran into additional errors:

2. error: Installed (but unpackaged) file(s) found:
   /usr/lib/bacula/btraceback.mdb

 Also easily fixed... Alas! More problems:

3. RPM build errors:
    Bad exit status from /home/user/rpm/tmp/rpm-tmp.26291 (%doc)
    File listed twice: /usr/lib/libbaccfg-5.0.3.so
    File listed twice: /usr/lib/libbaccfg.la
    File listed twice: /usr/lib/libbaccfg.so
    File listed twice: /usr/lib/libbacfind-5.0.3.so
    File listed twice: /usr/lib/libbacfind.la
    File listed twice: /usr/lib/libbacfind.so
    File listed twice: /usr/lib/libbacpy-5.0.3.so
    File listed twice: /usr/lib/libbacpy.la
    File listed twice: /usr/lib/libbacpy.so

Around line 1422 or so in the bacula.spec file, you'll see:

%files libs
%defattr(-,root,root)
%{_libdir}/libbac*
%{_libdir}/libbaccfg*
%{_libdir}/libbacfind*
%{_libdir}/libbacpy*


It appears that we don't need all those wildcards... the first wildcard encompasses the remainder - so I removed every line except for the line ending in /libbac*.

4. One final error: the spec file needs for there to be a Release_Notes-5.0.3-1.tar.gz with the file Release_Notes-5.0.3-1.txt in the SOURCES directory. After adding that, the Bacula RPMs built correctly.

Here's the diff of the bacula.spec file:

--- bacula.spec 2010-12-01 10:47:37.000000000 -0500
+++ rpm/SPECS/bacula.spec       2010-12-01 10:57:20.000000000 -0500
@@ -6,7 +6,7 @@

 # basic defines for every build
 %define _release           1
-%define _version           5.0.2
+%define _version           5.0.3
 %define _packager D. Scott Barninger
 %define depkgs_version 18Dec09

@@ -1356,6 +1356,7 @@

 %{_sbindir}/bacula-fd
 %{_sbindir}/btraceback
+%attr(-, root, %{daemon_group}) %{script_dir}/btraceback.mdb
 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.gdb
 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.dbx
 %{_sbindir}/bconsole
@@ -1422,9 +1423,6 @@
 %files libs
 %defattr(-,root,root)
 %{_libdir}/libbac*
-%{_libdir}/libbaccfg*
-%{_libdir}/libbacfind*
-%{_libdir}/libbacpy*

 %post libs
 /sbin/ldconfig











Monday, November 15, 2010

Bacula - Exluding Certain Subdirectories Using Regular Expressions

I was asked by a former colleague how to do the following in Bacula:

Backup all the sub directories in /data/users/, but exclude /data/users/*/scratch.

Unfortunately, Bacula is slightly less than intuitive on this matter. Simply adding the directory and adding an exclusion later won't work correctly. You need to exclude the directories, first, and then add the directory.

Here is the pattern that works (in the FileSet for the given host - you can ignore the large list of options I have in the set; the first block of options are not necessary for the selective exclusion)

FileSet {
  Name = "file_server set"
          Include {
    Options {
      signature = SHA1
        compression=GZIP5
        onefs=yes
        noatime=yes
        hardlinks=yes
        sparse=yes
        ignore case=no
        checkfilechanges=yes
    }

   /usr
   /etc

   /var
    Options {

         RegexDir = "^/data/users/.*/scratch"
        exclude = yes
    }
   /data/users
  }
}


As you can see, the exclusion needs to happen before the directory is selected. It appears to be a "first match" wins selection method.

Of course, you should test this yourself to make sure it works and doesn't negatively affect your backups.

Wednesday, June 23, 2010

Trouble sending out email from Bacula 5.0.2 and CentOS 5.5

I recently noticed that Bacula installations on CentOS 5.x (primarily 5.5) boxes were not sending out email after job completion. It was baffling as bsmtp worked fine on the command line... at least when I ran it as root. I tried running it as the bacula user (my Bacula director runs as the Bacula user, not root) and it failed:

$ su - bacula -s "/usr/sbin/bsmtp"
-bsmtp: error while loading shared libraries: libbac-5.0.1.so: cannot open shared object file: Permission denied


Ah... I checked the file permissions:

ls -la /usr/lib/libbac-5.0.1.so
-rwxr-x--- 1 root root 330240 Jun 22 12:46 /usr/lib/libbac-5.0.1.so

Simple fix:

chmod o+r /usr/lib/libbac-5.0.1.so

On 64 bit CentOS/Rhel, it will be /usr/lib64/libbac-50.0.1.so

I'm guessing that there was a problem in the spec file (I built it from an srpm.)

Sunday, May 23, 2010

Bacula Windows Client and error 1067

I recently ran into an error starting the bacula-fd service on a windows client: error 1067. I looked it up... several people had this error, but no resolution. I looked at the application log on the windows client, but there was no bacula message.

To figure it out, I started the bacula-fd.exe file by hand from a command prompt. It gave the full error message (I had a minor typo in the bacula-fd.conf file.)
I corrected the typo and was able to successfully start the service.

Coincidentally, a useful one liner for bconsole on Linux:

watch -n 1 --differences "echo status 2 2 | bconsole | \
    grep 'Files=' | sed -e 's/ */ /g' | cut -f 3 -d \" \""

In this case, my storage device is #2. It produces out put like this (every second):
Every 1.0s: echo status 2 2 | bconsole | grep 'Files=' | sed -e 's/ */ /g' | cut -f 3 -d " " Sun May 23 00:45:54 2010

Bytes=1,765,498,476



Unfortunately, this won't work on FreeBSD as the watch command from ports has different syntax.

Friday, March 5, 2010

Bacula 5.0

Bacula 5.0 has been out for a little while. Apparently, the developers decided to skip 4.x to differentiate the community edition from the enterprise edition. The new features list is here. I'll be setting it up soon and will likely post some sample configurations.

Wednesday, October 14, 2009

Building Bacula Client RPMs for CentOS 5.x

This is a quick and dirty explanation of the process. I'm building as root - which you should probably avoid doing.

Download and install the srpm file from bacula's site (sudo rpm -ivh name-of-srpm.srpm)

You'll need to install the rpmbuild utility:



sudo yum -y install rpm-build


To build the client only:

Install a couple of prerequisite rpms:
sudo yum -y install ncurses-devel libtermcap-devel

rpmbuild --define build_client_only=1 --define build_centos5=1 -bb /usr/src/redhat/SPECS/bacula.spec