Sunday, April 26, 2015

Mac OS X Yosemite: Stop log messages: postfix/master[xxxxx]: fatal: bind fe80::1 port 25: Can't assign requested address

After upgrading to Max OS X Yosemite my machine was running slowly and when I looked in /var/log/mail.log log file I saw the following error repeated every time launchd tried to respawn a postfix process.

postfix/master[xxxxx]: fatal: bind fe80::1 port 25: Can't assign requested address


Apart from filling up the logs this means that launchd is trying to start postfix every few seconds and postfix is quitting, which puts quite an overhead on the system and slows it down significantly.

I then found this article which solved my problem:
http://serverfault.com/questions/646284/postfix-not-working-on-macos-yosemite


Basically, /etc/postfix/main.cf contains the following line, which, for some reason, is not working with IPV6. (maybe the clue is that postfix is trying to bind to address fe80::1 but localhost on IPv6 is ::1):

inet_interfaces = localhost


Changing the line to the IPV4 IP address for localhost fixes the problem. Simply change the entry to this:

inet_interfaces = 127.0.0.1

The next time launchd attempts to start postfix it should work and there should be no more errors.

Apparently changing the protocol to IPv4 (thanks to David Leber) also fixes the problem but I have not confirmed this:

inet_protocols = ipv4


Prevent Mac OSX from writing hidden (._XXX and .DS_Store) files to your samba share

I had a cifs/smb share on a linux server which was being polluted with hidden files (like ._DS_Store and .DS_Store) created by MacOSX clients.  It doesn't really cause any problems, but for users who use the same share with a client which is not a Mac, these files are visible and it is really annoying and looks messy.

On Mac OS X you can disable writing of hidden files to shares by using the following command in Terminal:

defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
killall Finder
 
HOWEVER, that only sorts out the problem for that one Mac, any others connecting to the share will need the same treatment so this is not really the ideal solution.

The better solution is to disallow these types of files on the cifs/smb share instead. Any and all Macs using the share are then not permitted to save those files

You can do this easily by editing your /etc/samba/smb.conf file and adding the veto files option, as in this example:

  [TV]
   path = /share/TV
   guest ok = yes
   browseable = yes
   create mask = 0666
   directory mask = 0777
   read only = no
   writeable = yes
   available = yes
   veto files = /._*/.DS_Store/


The veto files can be a single file pattern, or multiple so long as you seperate each one with a /

Once the config change is made, restart samba with:

service samba restart