Samba 3.4 Changes idmap backend!

I recently upgraded some hosts to Fedora 11 which has Samba 3.4 included. I configure most of the hosts I control to be integrated with Active Directory for authentication and this upgrade broke that authentication.

The problem was that the winbind daemon was not able to query the LDAP server which was used as the idmap directory due to the way I had configured the idmap backend in smb.conf. This caused winbind and samba to restart successfully and I could enumerate groups and users perfectly well in bulk. I was not able, however, to enumerate a single user using ‘wbinfo -i ‘ or groups and I was not able to login.

This problem was caused by this config value:

idmap backend = "ldap:ldap://ldap1,ldap://ldap2"

After a bit of troubleshooting, I discovered that winbind was not able to query the LDAP server successfully. I fixed this issue by changing the above config value to:

idmap backend = ldap:ldap://ldap1 ldap://ldap2

I then restarted winbind and tested failover by enumerating a few users and then stopping the primary ldap server (ldap1) and enumerating a few more users.

error while loading shared libraries: : cannot open shared object file: No such file or directory

A fairly typical scenario when installing software that does not come fro the distribution package manager is to install an application and find that it cannot find a library necessary to run, although the library is definitely installed.  I recently ran into this issue when compiling spine on an old Debian Sarge system.

$ ./spine
./spine: error while loading shared libraries: libmysqlclient_r.so.15: cannot open shared object file: No such file or directory

I verified that this file existed with locate.

$ locate libmysqlclient_r.so.15
/usr/local/mysql-5.0.45-linux-i686/lib/libmysqlclient_r.so.15.0.0
/usr/local/mysql-5.0.45-linux-i686/lib/libmysqlclient_r.so.15

The problem was that I did not have the mysql library directory included in /etc/ld.so.conf or /etc/ld.so.conf.d.  To fix the problem, I added the mysql library path to /etc/ld.so.conf and re-ran ldconfig using sudo.

#/etc/ld.so.conf/usr/local/lib/sasl2
/usr/local/lib
/lib
/usr/lib
/usr/lib/atlas
/usr/local/mysql-5.0.45-linux-i686/lib

include /etc/ld.so.conf.d/*.conf

Then run ldconfig:

$ sudo ldconfig

I was then able to run spine without any issues.

History with time stamps!

When reviewing the history file in bash, it’s terrible not knowing when a command was executed.  Using the HISTTIMEFORMAT variable in a .bashrc file, the timestamp can be added to all commands.

# ~/.bashrc
HISTTIMEFORMAT=”%m/%d/%y %I:%M:%S %p ”
Sample output:

525  05/21/09 07:56:46 PM tail -f /var/log/messages  /var/log/secure

As you can see, the command is preceeded by the line number and a timestamp.

Software RAID and GRUB

When building out a system with a boot partition using software RAID, it is critical to install GRUB on both drives to that if one fails, the other can be used to boot the system.
1. Make sure that the RAID volume is synchronized (assuming /dev/md0 for /boot):

mdadm -D /dev/md0

2. Install grub on the first drive:

# grub
Probing devices to guess BIOS drives. This may take a long time.

grub> root (hd0,0)
Filesystem type is ext2fs, partition type 0xfd

grub> setup (hd0)
Checking if “/boot/grub/stage1” exists… no
Checking if “/grub/stage1” exists… yes
Checking if “/grub/stage2” exists… yes
Checking if “/grub/e2fs_stage1_5” exists… yes
Running “embed /grub/e2fs_stage1_5 (hd0)”…  15 sectors are embedded.
succeeded
Running “install /grub/stage1 (hd0) (hd0)1+15 p (hd0,0)/grub/stage2 /grub/menu.lst”… succeeded
Done.

3. Install grub on the second drive:

grub> root (hd1,0)
Filesystem type is ext2fs, partition type 0xfd

grub> setup (hd1)
Checking if “/boot/grub/stage1” exists… no
Checking if “/grub/stage1” exists… yes
Checking if “/grub/stage2” exists… yes
Checking if “/grub/e2fs_stage1_5” exists… yes
Running “embed /grub/e2fs_stage1_5 (hd1)”…  15 sectors are embedded.
succeeded
Running “install /grub/stage1 (hd1) (hd1)1+15 p (hd1,0)/grub/stage2 /grub/menu.lst”… succeeded
Done.

grub> quit
That should allow booting from either drive without modification of grub.conf or /etc/fstab.