If you’re using FreeBSD6 as NFS server, you may find useful these quick tips related to /etc/export syntax, because otherwise you will be stuck with a generic
mountd[321]: bad exports list
in your logs.
So, what went wrong here?
One possible cause is that in your exports file you’re trying to export as shared NFS resource a symlink and not a real directory. NFS doesn’t like it at all and will simply no work.
One other, curious, glitch I found is that if you have two resource in two separate lines with the same options, the latter will fail.
Example of /etc/exports:
/path/share1
/path/share2 -network 192.168.1.0
/path/share3 -network 192.168.1.0
in this case share1 and share2 will work, while share3 won’t work and you’ll get a
mountd[321]: can't change attributes for /path/share3
mountd[321]: bad exports list line /path/share3
but if you change the network value in share3 (and only this), it will work!
Maybe there’s an explanation for this (I didn’t read all the exports(5) manpage) but anyway it’s a little bit strange.
Archive for the ‘FreeBSD’ Category
FreeBSD6 and nfsd gotchas
Posted by Vide on August 21, 2008
Posted in Fixes, FreeBSD, Tips | 1 Comment »
Cron and multiple recipients
Posted by Vide on March 31, 2008
If you are using a maintainance user executing scheduled cronjobs, maybe you’ve found yourself needing to report the result of these jobs to different email addresses. Everyone knows for sure the MAILTO parameter, as explained in the crontab(5) manpages.
But maybe you don’t know that MAILTO is interpreted sequencially, when it’s found, so you can have different recipients in the same crontab, like in this example:
MAILTO="user1@domain.tld"
* * * * * echo "abc"
MAILTO=”user2@domain.tld”
* * * * * echo “dfe”
so user1 will get mailed with "abc" and user2 with "dfe".
It works in the standard "cron" program, so for example you can use this tip in Debian or FreeBSD (and in other Unices to, I guess)
Posted in Debian, FreeBSD, Gentoo, Linux, Tips, Unix | Tagged: cron, Tips, Unix | Leave a Comment »
Obtain the Dell service tag in FreeBSD/Debian/Gentoo
Posted by Vide on October 10, 2007
Well, the title could be a little misleading cause this actually works in Linux and with other manufacturer as well, but since we were searching info for this particular topic, and didn’t manage to find anything useful on Google…
Anyway, it’s very very simple. All you have to do is install dmidecode (from Alan Cox) with:
FreeBSD
portinstall dmidecode
or whatever manner you use to install FreeBSD’s ports :)
Debian/Ubuntu
apt-get install dmidecode
Gentoo
emerge dmidecode
NOTE: this work as well with HP servers’ serial numbers and, I suppose, with IBM, Sun etc too.
Once installed, all you have to do is execute
# dmidecode -s chassis-serial-number
et voilĂ , you will get your service tag printed on screen. Moreover if your server is in the datacenter and you cannot remember the exact model
# dmidecode -s system-product-name
PowerEdge 1750
for example.
Just a note: dmidecode is the program used by OCS Inventory client to collect all these data.
Posted in Debian, FreeBSD, Gentoo, Linux, Tips, Ubuntu | Tagged: Dell, FreeBSD, Linux, serial number, service tag, Tips, tool | Leave a Comment »
Updating root servers list for djbdns (dnscache)
Posted by rga on October 1, 2007
Hello,
Since Dr. Bernstein (aka dj) has abandoned djbdns or it looks like, some root server was removed from main list and there is no reason to use it.
To update such list, we only need to launch a little djdbdns soft and put it in the correct place.
# cd /service/dnscache/root/servers/
# mv @ oldrootlist (optional )
# dnsip `dnsqr ns . | awk ‘/^answer: \./ { print $5 }’` > @
If necessary, you can reload dnscache as follows:
# svc -d /service/dnscache
# svc -u /service/dnscache
or with a simple HUP:
# svc -h /service/dnscache
See you & thanks for djbdns!
Posted in FreeBSD, Linux, Tips, Unix | 1 Comment »
Postfix in a multi-IP environment
Posted by Vide on September 26, 2007
If you have to install postfix in a multi-IP environment, say, if you need it to listen to two or more IP (for example a real IP and an alias on the same NIC), there is a cute directive in main.cf that let you decide which IP should postfix (well, it’s parts like smtp, virtual/maildrop etc) use when contacting an external server.
inet_interfaces = 192.168.1.200, 192.168.1.201, localhost
smtp_bind_address = 192.168.1.201
with inet_interfaces your postfix will listen to these 3 IPs, and with smtp_bind_address you will tell postfix to specifically use 192.168.1.201 when contacting an external address.
Posted in FreeBSD, Linux, Postfix, Tips, Unix | Tagged: mail server, multi-homed, Postfix, Tips, virtual ip | Leave a Comment »
Tools every sysadmin should be aware of – part I
Posted by Vide on September 10, 2007
I’m going to start this list of tools that really help me improving my daily work with two (not so little) programs that really save you hours if you are administrating more then 10 machines. OCS Inventory and GLPI. These are two web-based programs (based on PHP+Apache+Mysql, so really easy to deploy) that can do almost all the dirty work of inventoring, organizing and managing your IT infrastructure.
OCS Inventory, with its agents, it’s the heart of the system: you have to install an agent on every machine you want to inventor (and you can do it with automated scripting even on Windows!) and this agent will recollect every bit of hardwar/software information on that computer and store it in OCS Invetory database. Now, firing up the web based interface, you can review all the data collected directly in OCS Inventory, although it’s a bit rough and not very user friendly. But the most important task of OCS inventory is not displaying data, but to collect it. Ihave inventored Windows XP, Windows Vista, every flavour of Linux, FreeBSD, OSX etc. And when you need to manage all this data…
…enter GLPI. GLPI is really thinked towards sysadmins/helpdesk which have to know everything about the hardware park they are managing. It sports a relatively simple user interface, a very very rich feature set and can “suck” all the data from OCS Inventory, in an automated form. GLPI is really amazing, if you are thinking about a feature you would need in this kind of programs, GLPI got it. Searches based on hardware data like MAC address? Got it. Software management so you can keep track in every moment of where you have put that particular Photoshop license? Got it. Contracts/warranties management, with integrated reminders? Got it.
You should definitely check these softwares out, they will make your life easier, granted!
Oneliner: play with dates
Posted by Vide on September 4, 2007
If you need to work with dates in a shell script, this oneline could be useful:
echo $((`date +%s` - $OFFSET))|awk '{print strftime("%Y-%m-%d",$1)}'
What it does: it takes the current system time, converts it to epoch, rest $OFFSET (which should be in seconds) and then convert it again in the forma YYYY-MM-DD (but you can use every output supported by strftime, man strftime). Useful if you want to do some quick date calculation without having to fight with months, leap years and so on.
Posted in FreeBSD, Linux, OSX, Oneliner, Shell scripts | 1 Comment »
Mount a FreeBSD NFS share under MacOSX
Posted by Vide on August 6, 2007
FreeBSD NFS server by default only accepts NFS connection arriving from ports > 1024, as a “security” measure. This prevents OSX clients to correctly mount NFS shares, because even if executed with sudo your FreeBSD server will still complain with something like:
kernel: NFS request from unprivileged port
To solve this, the easiest way is to add the -P parameter on the client side, mounting the share with
sudo mount_nfs -P server.address:/path/to/share /path/to/local/directory
Posted in FreeBSD, OSX, Tips | Leave a Comment »
Unexpected Softupdates Inconsistency
Posted by rga on August 3, 2007
Hello,
Today we have a FreeBSD server with an incorrect shutdown/poweroff, when we wanted to put the server UP again, the FreeBSD server all time auto-reboots itself with an error message ‘unexpected softupdates inconsistency’.
To fix it this situation, the trick is to use fsck on all affected partitions using single user mode.
When the server boots, enter this line at prompt to enter using single mode:
> boot -s
(also, if you have a graphical menu, you can choose the 4 option)
Push enter to start a basic shell interaction using sh (bourne shell, not bash!, because /usr is not mounted)
Then, you need to checkout all partitions and fix it using fsck tool.
# fsck -y /dev/ad0s1f
or by name
# fsck -y /usr
When fixed, try to mount it using mount tool, if you don’t see any warning, you are happy, if not, repeat these steps more than one time if necessary.
# mount /usr (no warnings, cool!)
# mount /usr (and you see Operation not permited, hey I am root!, no problem, fsck it again)
If you want that FreeBSD do that for us, you only need to put the correct option in /etc/rc.conf
fsck_y_enable=”YES”
Not all time this option will work, but it helps in the next incorrect shutdow/poweroff.
See you.
Posted in FreeBSD, Tips | Leave a Comment »