After much neglect to this blog, I finally have some free time again and am performing some needed updates to the server here. Things had been moving along well enough under Snow Leopard (Mac OS X 10.6), but after holding at 10.6.4 for some time, it was time for some updates. Moving 10 10.6.8 would have required a few recompiles of tools anyway, so I decided to go ahead with the move to Lion.
Starting out at 10.6.4, I couldn't even run the Lion install I had from the App store (10.7.2) without updating my system to 10.6.8. The version of Xcode (required to compile new software) required 10.7.3, so my plan involved first upgrading to 10.6.8, running the 10.7.2 installer, System Update to bring it to 10.7.4, then installing Xcode, and finally, installing the optional Command Line Tools from within Xcode (Preferences, Downloads). Then the fun really started...
First I updated the MySQL install on my system from an older 5.1 build to the latest 5.1.63, 64 bit version. There isn't a 10.7 specific build, so I installed the 10.6 version without problems.
I did have to copy over my Data directory to the new install directory to preserve my databases, and after starting MySQL everything was exactly where it should have been.
Checking this via the PHPMyAdmin (PMA) web page, though, I found that PHP was no longer able to talk to the MySQL server, the mysql.sock file wasn't where it was expected to be. A bit of googling and checking my system found that my etc/php.ini file had been renamed, I restored this, and found that I needed to add a few new lines to tell PHP where to find the mysql.sock file:
mysql.default_socket = /tmp/mysql.sock
mysqli.default_socket = /tmp/mysql.sock
Stopping Web Sharing and restarting, and all was well again with PHPMyAdmin. I was even pleasantly surprised to find that my other virtual domain in Apache hadn't been stomped by the Lion upgrade and was still working fine.
I next was able to build the latest version of Dovecot, 2.1.8 at the time of this article. After some failed attempts to build this under 10.6.4 (multiple undefined symbols relating to _libiconv), a tip from Timo Sirainen to change some flags during the initial configuration let me finally get a clean compile.
CPPFLAGS='-I/opt/local/include/postgresql85 -I/opt/local/include' \
LDFLAGS="-L/opt/local/lib/postgresql85 -L/opt/local/lib" \
sudo make install
With that out of the way, next was a new version of Postfix, 2.9.3. For some reason, compiling this on Lion resulted in a few hundred warnings such as this: warning: '/*' within block comment, but as these are simply warnings they can be ignored. The odd part is that the makefile had specific instructions to not display such warnings, but this is for some reason being ignored. Maybe I'll have time to investigate that later.
My current make statement for Postfix, with all of the options required for the setup here (MySQL, Dovecot, PCRE, etc), is as follows:
make -f Makefile.init makefiles \
CCARGS='-arch x86_64 -DUSE_TLS -DUSE_SASL_AUTH \
-DHAS_PCRE -I/usr/local/include \
-DHAS_SSL -I/usr/include/openssl \
-DHAS_MYSQL -I/usr/local/mysql/include' \
AUXLIBS='-L/usr/lib -llber -lresolv -L/usr/local/lib \
-L/usr/local/lib -lpcre -lssl -L/usr/local/mysql/lib \
-lmysqlclient -lz -lm'
As with most Apple updates, my old Postfix config had been wiped out, so I deleted everything in /etc/postfix and restored my old config files from my backup drive, and ran through the Postfix update process, and was able to get Postfix up and running.
It wasn't until the first mail arrived (a test message I sent from another account) that I saw issue, the Policyd software was no longer working. As this is just some PERL scripts, I figured it should have been fine, but checking its log file I found that some PERL modules were no longer installed. A total of three errors came up, for the sake of anyone googling and landing here, I'll give each error and the corresponding command line required to get the required module installed:
Can't locate Config/IniFiles.pm in @INC (@INC contains: /usr/local/lib/policyd-2.0 /usr/lib/policyd-2.0 /Library/Perl/5.12/darwin-thread-multi-2level /Library/Perl/5.12 /Network/Library/Perl/5.12/darwin-thread-multi-2level /Network/Library/Perl/5.12 /Library/Perl/Updates/5.12.3 /System/Library/Perl/5.12/darwin-thread-multi-2level /System/Library/Perl/5.12 /System/Library/Perl/Extras/5.12/darwin-thread-multi-2level /System/Library/Perl/Extras/5.12 .) at /usr/local/sbin/cbpolicyd line 31.
$ sudo perl -MCPAN -e 'install Config::IniFiles'
Can't locate Cache/FastMmap.pm in @INC (@INC contains: /usr/local/lib/policyd-2.0 /usr/lib/policyd-2.0 /Library/Perl/5.12/darwin-thread-multi-2level /Library/Perl/5.12 /Network/Library/Perl/5.12/darwin-thread-multi-2level /Network/Library/Perl/5.12 /Library/Perl/Updates/5.12.3/darwin-thread-multi-2level /Library/Perl/Updates/5.12.3 /System/Library/Perl/5.12/darwin-thread-multi-2level /System/Library/Perl/5.12 /System/Library/Perl/Extras/5.12/darwin-thread-multi-2level /System/Library/Perl/Extras/5.12 .) at /usr/local/lib/policyd-2.0/cbp/cache.pm line 35.
$ sudo perl -MCPAN -e 'install Cache::FastMmap'
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Proxy, SQLite, Sponge.
at /usr/local/lib/policyd-2.0/cbp/dbilayer.pm line 119
$ sudo perl -MCPAN -e 'install DBD::mysql'
The sudo above was necessary to override some system permissions issues. Once these modules were installed, Policyd was able to properly communicate with mysql, and mails were able to be received correctly.