Using fstab to automatically mount samba drives

It is possible to specify mount_smbfs-mounts in /etc/fstab. For instance it can be used to automatically mount Samba drives automatically at boot up. When I configured this I ran into a number of small problems. To not be needed to enter a password each time one can use /etc/nsmb.conf. Though I could not really get it to work, every time I got queried about the password even if I had given it in nsmb.conf. I tried both with unencrypted and crypted password. Nothing worked. By coincidense I tired to change the user name to only capital letters, and that solved it!

So in you nsmb.conf it should look like this:

PS. Still have the noauto option and a mount script eventhough I have read it should work without noauto, though I had problems with it before and also it makes your system very dependent on the other machine with the samba drives. If that is not up and running if when you FreeBSD machine boots, the mounting will fail and the boot process will halt and your system will not go up.

Update 2007-05-24:
Yesterday I discovered after a reboot that my shares from a Windows machine wasnt mounted any more. I tried to use mount_smbfs manually but failed. It reported:
mount_smbfs: can't get server address: syserr = Permission denied

I spent quite some time searching for a solution and finally after posting on a mailinglist I figured it out. I’t nothing to do wiht permissions, Samba cannot locate the server, thats the problem! So if you specify its real address and not only WINS name it works:
mount_smbfs -I //joe@FILESERVER/share /mnt

But how to solve it for fstab?
Again comes nsmb.conf into play. Under the each server section in nsmb.conf one parameter you can give is the address to the machine. Either the ip number or its realy networkname works, e.g.

Mounting a shared windows drive

I’m about to setup a photoblog for a friend and since he currently got his machine/server standing here I thought it could be convinient if I could have his webfiles on that machine and somehow mount that into my FreeBSD machine. So sstarted to search for mounting samba and stumbled upon this article:
FreeBSD and Samba: Automounting

But I could not make it work, first I had Samba 2 so upgraded to 3, but still no progress. Got wierd errors when doing mount_smbfs. The first I got was: “mount_smbfs: vfsload(smbfs): File exists” which didnt make much sense. I tried a lot of things, nothing helped. Finally I rebooted and now I got “mount_smbfs: vfsload(smbfs): Exec format error” which was not much more informative…
Though I found some information about that one needed to have NETSMB option set when compiling the kernel so checked my Kernel config file. Had that already and also the other pre-requisits… Though after a while I realized that I was missing the SMBFS option! So recompiling the kernel with all of these options solved it:

options NETSMB
options SMBFS
options LIBICONV

IMAP stops responding

My qmail setup has worked quite well, though I have had a bit of irritating thing with it. After opening a number of folders in Thuderbird, it stopped responding. After reading and seraching a bit I discovered it was a configuration issue in the courier-imap server.

Probably didnt read it too well when installing but QmailRocks mentioned one should increase MAXPERIP if running in a small home or office network.

Now it works as a sharm.

Changing IP

So once more I changed ISP. Each time I do that the server gets really slow to ssh into, have not figured out yet why. But to speed up things a bit I’ll write down here which files I need to change.

First /etc/rc.conf which sets the IP
/etc/namedb/named.conf for the DNS
/etc/ipfw.conf for the firewall


Strange perl error while updating ports

When running

/usr/local/sbin/portupgrade -ra

I got several errors:

** Port marked as IGNORE: databases/p5-DBD-Pg:
        Needs DBI 1.38 which needs perl 5.6, install lang/perl5.8 and try again
  • Port marked as IGNORE: mail/p5-Mail-SpamAssassin: Needs perl 5.6.1 or higher, install lang/perl5.8 and try again

Could not figure out what was wrong since I just had installed perl5.8 from ports! After googling I found out that apparently this is a problem with old FreeBSD installations, 4.10 like I have. The problem is that the installation does not update some files that are automatically done on systems like 5.3. By issuing the command

/usr/local/bin/use.perl port

the updates are done.

Problems installing Horde again

I have just made a total upgrade of my ports tree and ran into some problems. One was that Horde or rather php couldnt load any dynamic libraries anymore. Don’t remember having any problems with that before. A search on hte net gave me the hint I needed. In the article “dBforums – unable to find php_mysql.dll” it is described how one should change extension_dir in /usr/local/etc/php.ini. After changing it to /usr/local/lib/php/20020429/ Horde installed nicely again.

Keeping installed packages up-to-date

This FreeBSDDiary article explains how to keep your installed packages from ports up-to-date. “The FreeBSD Diary—Got ports? Here is THE way to upgrade them!”

When I ran pkgdb -F I got some Stale Dependencies I could not solve since somehow installed packages like ImageMagick depended on fontconfig that was not installed. Have no idea how I have ended up in that situation.

But reading on I found information on the pkgdb man-page that said one should run portsdb -Uu after doing a cvsup on the ports tree. I have cvsuped my ports tree several times without running it so now I’m doing that.

Short summary:
cvsup -g -L 2 ./ports-supfile
portsdb -Uu
pkgdb -F
portupgrade -arp

Installing qmail

I have been planning on installing mail on this server for quite some time but never really got around to do it, until now. So qmail it is. Found the website and followed their FreeBSD installation guide.

The only thing that has not really been as described is the php.ini file. I didnt have any at all but I had the distribution one so I made a copy of it:

cp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini

I got as far as to page 13, has to continue some other day.

Update 2004-07-21: Today I got a bit further and now I have both CLAM antivirus protection and SpamAssassin installed.
Update 2004-08-30: Today I finished the whole installation according to qmailrocks but there are still things to be done:

2004-09-03: Continuing with qmail. So I found out by reading LifeWithQmail that the /var/qmail/users/assign controlls which users that gets addresses. Though when I ran qmail-pw2u I got this error all the time:

qmail-pw2u: fatal: unable to find alias user

and I couldn’t figure out why. Reading in some forums I started to get a clue. If a include file exists it must list alias otherwise will qmail-pw2u give this error. Which is a bit strange, specifically since I had an assignment file without alias before I started to look into this. The assignment file that is produced from the QmailRocks installation doesn’t have it and qmail definetly works after that installation.

So should I edit my newly created assign file and remove alias or should it be kept? The generated file includes three different alias rules, and according to the documentation the alias user is a catch-all user.

Still cannot get it to work to send e-mail to an ordinary user: gets: Sorry, no mailbox here by that name. vpopmail (#5.1.1)