Tuesday, October 14, 2008

BackupPC on FreeNAS - Part 3 (Issues with Samba)

I've showed you in two posts how to install BackupPC on FreeNAS (BackupPC on FreeNAS & BackupPC on FreeNAS - Part 2)

It looks like that there is a problem with samba if you install it as I've described this in my previous posts. The FreeNAS binaries are compiled with different path-settings as the original pkg's from FreeBSD.

So if you do not need samba, don't install the packages! Skip the following steps:

freenas:~# pkg_add -r net/samba-libsmbclient-3.0.28

freenas:~# pkg_add -r net/samba-nmblookup-3.0.28.tbz

freenas:~# pkg_add -r net/samba-3.0.28,1

If you need samba, please be aware that you might see some problems!

One issue I've seen is that the /var/etc/private/smbpasswd file was not updated during the boot. My workaround is to add the following in /etc/rc.d/smbpasswd:

(/bin/echo "${_password}"; /bin/echo "${_password}") | ${command} -c /var/etc/smb.conf -s -a "${_username}" > /dev/null

Can anyone confirm similar problems?


Unknown said...

hey harry, i can't get my samba working either. I have the same exact problem as you do. Unfortunately, I've already installed samba and nmlookup according you previous posts. Do you know how to remove those packages?
Thanks. I love FreeNAS and BackupPC. It's the best thing out there I think.

harryd said...

Hi John,

can you please send me an email with more details. Maybe I can share some workarounds I've found out.

Regards, harryd

Unknown said...

When I restart the CIFS/SMB service, I get the following in /var/log/samba/log.smbd file:

[2008/10/15 18:58:42, 0] smbd/server.c:main(944)
smbd version 3.0.31 started.
Copyright Andrew Tridgell and the Samba Team 1992-2008
[2008/10/15 18:58:42, 1] smbd/files.c:file_init(193)
file_init: Information only: requested 10000 open files, 7187 are available.
[2008/10/15 18:58:42, 1] lib/util_tdb.c:tdb_log(664)
tdb(unnamed): tdb_open_ex: failed to get global lock on /var/etc/private/secre
ts.tdb: Invalid argument
[2008/10/15 18:58:42, 0] passdb/secrets.c:secrets_init(67)
Failed to open /var/etc/private/secrets.tdb
[2008/10/15 18:58:42, 0] /work/a/ports/net/samba3/work/samba-3.0.31/source/lib/p
ERROR: smbd-smb.conf : fcntl lock of file /var/run/smbd-smb.conf.pid failed. E
rror was Invalid argument

I haven't tried your workaround for the smb password update. Would it help for this situation?

Unknown said...

This can all be resolved by just not installing samba. It is not required, the BackupPC documentation says all you need are the smbclient and nmblookup bins. I solved this in the following manner:

1)Don't install the samba3 package, just wget it to /root/ ...

wget ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.2-release/Latest/samba3.tbz

2) make a directory to extract it into and extract it...

mkdir ~/samba3
mv samba3.tbz ~/samba3
cd samba3
tar jvxf samba3.tbz

3) copy the smbclient and nmblookup bins to /usr/local/bin/ and set correct permissions...

cp bin/smbclient /usr/local/bin/
cp bin/nmblookup /usr/local/bin/
chmod 555 /usr/local/bin/smbclient
chmod 555 /usr/local/bin/nmblookup

4) not done yet...we need a couple of system libs to make these bins work...

pkg_add -r libexecinfo
pkg_add -r popt

5) only thing left is squashing an error message about the freenas smb.conf being in an odd place...

ln -s /var/etc/smb.conf /usr/local/etc/

6) that's it you now have fully working smbclient and nmblookup on your freenas box without messing up anything else by installing the full samba package and all of those unwanted dependencies

7) go ahead and rm -rf ~/samba3 if you don't want to keep that around anymore

harryd said...

Thx Aaron :-) I haven't tried this so far. But it sounds good...

Unknown said...

Give it a go...I've been using a setup like that for a week or so now at a small office backing up half a dozen desktops and a few laptops using rsyncd on backuppc/freenas and deltacopy on the windows clients. Haven't had any issues so far...ohh and just one more little note I found turning compression off in backuppc and setting gzip on for the zfs dataset seemed to be alot more resource friendly.

harryd said...

@Aaron... Sure I will... In my latest setup I've also turned the compression off and enabled the zfs compression feature. Looks like I have to write a follow up post ;-)