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.

Sunday, October 31, 2010

FreeNAC - VLAN access management on Cisco Switches

I started playing around with FreeNAC recently in conjunction with several Cisco 3500XL switches. I tried playing around with the virtual machine they provided. It needs an upgrade on the FreeNAC source to the latest code in order for the windows GUI to work (there are schema errors unless you upgrade the FreeNAC source.)
    I was interrupted in the testing. I'll post more when I have results... most likely tips.

Thursday, September 30, 2010

CentOS 5.5, Samba/Winbind, Windows 2008R2 Active Directory

In order to facilitate client backups, I set up samba on CentOS on a Windows 2008R2 based domain. I created an empty directory, /etc/skel2, as I was not planning on letting users log in via ssh or the console.

 Unfortunately, the samba 3.0.x line wouldn't work correctly. I could join the domain, but not connect to shares. Samba logged the following message every connection attempt:


  read_data: read failure for 4 bytes to client 192.168.70.23. Error = Connection reset by peer

I upgraded to the Samba3 package with yum (Samba 3.3.x) and rejoined. I added a pam.d entry in the samba config:

 session required pam_mkhomedir.so skel=/etc/skel2 umask=0077


( I don't want users to see each other's directories. I did not modify system-auth, as I did not want the users to log in with anything but samba.)

And added this to smb.conf:


  winbind separator = \
  # use uids from 10000 to 20000 for domain users
  idmap uid = 10000-20000
 # use gids from 10000 to 20000 for domain groups
 idmap gid = 10000-20000
 # allow enumeration of winbind users and groups
 winbind enum users = yes
 winbind enum groups = yes
 winbind use default domain = yes
 # give winbind users a real shell (only needed if they have telnet access)
 template homedir = /data/clientdata/backups/%D/%U
 template shell = /bin/bash

 obey pam restrictions = yes

An important note, the samba3 rpm separates the smbd and nmbd init scripts, so you'll need to do a separate "chkconfig nmb on."

Friday, August 27, 2010

Upgrading to ESXi 4.1 from 4.0.

I recently needed to update an ESXi 4.0 host to ESXi 4.1. After discovering that the host update utility was not supported with ESXi 4.1, I resorted to my other option, the vSphere CLI.
Here's the session (on Windows 7 64bit):

 C:\Program Files (x86)\VMware\VMware vSphere CLI>bin\vihostupdate.pl --server my_server -b upgrade-from-ESXi4.0-to-4.1.0-0.0.260247-release.zip -i

The output:


 Please wait patch installation is in progress ...
 The update completed successfully, but the system needs to be rebooted for the changes to be effective.


Followed by a reboot:


 C:\Program Files (x86)\VMware\VMware vSphere CLI> bin\vicfg-hostops.pl --server my_server -o reboot

 Host my_server rebooted successfully.

Wednesday, August 11, 2010

Netgear GSM Switches and LAGs/Port channels

Setting up port-channels/lags is pretty easy on Netgear GSM switches. In this example, we are assuming that we are connecting two Netgear GSM7324 switches, and adding vlan 10 to them. We'll link together ports 23 and 24 on both switches.

1. create the interface:

configure
port-channel lag_01

2. assign it to two ports:
configure
interface range 0/23-0/24
addport 1

3. Allow VLAN 10 and 1 to travel over it. Require them both to be tagged:
configure
interface lag 1
vlan participation include 1
vlan tagging 1
vlan participation include 10
vlan tagging 10