How to troubleshoot Mountain Lion’s Apache

After I install Mac OS X Mountain Lion, it seems like my Apache server can no longer start successfully:

[code lang=”bash”]bash-3.2# sudo tail /private/var/log/apache2/error_log
[Thu Aug 02 09:36:46 2012] [notice] caught SIGTERM, shutting down
[Thu Aug 02 09:37:57 2012] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
httpd: Could not reliably determine the server’s fully qualified domain name, using kahwee-mba.local for ServerName
[Thu Aug 02 09:37:57 2012] [notice] Digest: generating secret for digest authentication …
[Thu Aug 02 09:37:57 2012] [notice] Digest: done
[Thu Aug 02 09:37:57 2012] [notice] Apache/2.2.22 (Unix) DAV/2 mod_ssl/2.2.22 OpenSSL/0.9.8r configured — resuming normal operations
[Thu Aug 02 09:46:17 2012] [error] [client 127.0.0.1] File does not exist: /Library/WebServer/Documents/favicon.ico
[Thu Aug 02 09:54:19 2012] [error] [client 127.0.0.1] File does not exist: /Library/WebServer/Documents/r, referer: http://home.internal.kw.sg/
[Thu Aug 02 09:54:19 2012] [error] [client 127.0.0.1] File does not exist: /Library/WebServer/Documents/favicon.ico
[Thu Aug 02 09:54:31 2012] [notice] caught SIGTERM, shutting down
[/code]

To find out why, run apachectl -t:

[code lang=”bash”]
bash-3.2# sudo apachectl -t
httpd: Syntax error on line 106 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/mod_dav_fs.so into server: dlopen(/usr/libexec/apache2/mod_dav_fs.so, 10): Symbol not found: _dav_add_responsen Referenced from: /usr/libexec/apache2/mod_dav_fs.son Expected in: flat namespacen in /usr/libexec/apache2/mod_dav_fs.so
[/code]

Seems like it is caused by my disabling of mod_dav. mod_dav_fs acts as a support module for mod_dav and provides access to resources located in the server’s file system.

So I go to line 106 of /private/etc/apache2/httpd.conf and I comment out that line too.

[code lang=”bash”]sudo nano /private/etc/apache2/httpd.conf[/code]

Try to run the syntax check of Apache configuration again:

[sourcecode language=”bash”]
bash-3.2# sudo apachectl -t
Syntax OK
bash-3.2# [/sourcecode]

That seems to be working, now we start Apache:

[code lang=”bash”]sudo apachectl start[/code]

Useful apachectl commands include:

  • apachectl start
  • apachectl stop
  • apachectl restart
  • apachectl -t

Hope it helps!

How to fix Node DNS resolver in Mac

I was working on the node package manager, npm, in Mac OS X and realized I cannot install Zombie.

[code lang=”bash”]kahwee:~ kahwee$ npm install zombie
npm info it worked if it ends with ok
npm info using npm@0.2.11-5
npm info using node@v0.2.6
npm ERR! Error connecting to server http://registry.npmjs.org/zombie
npm ERR! Error: ETIMEOUT, Timeout while contacting DNS servers
npm ERR! at Timer.callback (dns:15:13)
npm ERR! at node.js:773:9
npm ERR! Report this entire log at http://github.com/isaacs/npm/issues
npm ERR! or email it to npm-@googlegroups.com
npm ERR! Just tweeting a tiny part of the error will not be helpful.
npm not ok[/code]

I was hunting around what’s wrong with my DNS servers and I realized that even though Node.js is taking the DNS server settings from resolv.conf, Mac OS X did not have that updated as I would expect. The following is not my nameserver:

[code lang=”bash”]kahwee:~ kahwee$ cat /etc/resolv.conf
#

Mac OS X Notice

#

This file is not used by the host name and address resolution

or the DNS query routing mechanisms used by most processes on

this Mac OS X system.

#

This file is automatically generated.

#
domain Aphrodite
nameserver 192.168.1.254[/code]

So I commented that portion and changed it with nano:

[code lang=”bash”]sudo nano /etc/resolv.conf[/code]

Changed it to and comment the invalid entry:

[code lang=”bash”]kahwee:~ kahwee$ cat /etc/resolv.conf
#

Mac OS X Notice

#

This file is not used by the host name and address resolution

or the DNS query routing mechanisms used by most processes on

this Mac OS X system.

#

This file is automatically generated.

#
#domain Aphrodite
#nameserver 192.168.1.254
nameserver 165.21.100.88
nameserver 165.21.83.88[/code]

And now it works:

[code lang=”bash”]kahwee:~ kahwee$ npm install zombie
npm info it worked if it ends with ok
npm info using npm@0.2.11-5
npm info using node@v0.2.6
npm info fetch http://registry.npmjs.org/zombie/-/zombie-0.8.10.tgz

npm ok[/code]

iTunes Store died for me, error -50

My iTunes has been pretty much screwed these days with the notification message:

One Moment Please.
Connecting to the iTunes Store.
Loading

If iTunes doesn’t open, click the iTunes application icon in your Dock or Windows Task Bar.

So iTunes does not itself know it is in iTunes. Very philosophical.

I tried logging out of my iTunes account and cannot log in back. I can log in using iTunes for Windows on my Windows machine but not iTunes for Mac. I have also reset everything in Safari.

Signing in to iTunes give me the following:

[iTunes We could not complete your iTunes Store request. An unknown error occured (-50).]

I can’t use iTunes Store any more and Apple Support doesn’t seem to have a similar problem listed.

[UPDATE: I resolved the issue.]

[ad#highlight]

Resolution

Okay actually, I sort of solved it accidentally a few minutes after I write this. I just randomly delete some files that says iTunes such as the cache and I chanced upon the right file to delete.

There appears to have been some problems with iTunes preferences. I don’t exactly know which particular setting is incorrect; I don’t recall editing my preferences in the past couple of months.

Anyway, I deleted the preferences file. Mine is found in:

[code lang=”bash”]/Users/kahwee/Library/Preferences/com.apple.iTunes.plist[/code]

This causes iTunes to launch the set up wizard for iTunes where you have to click through all over again, as if it is a new installation. But that’s fine for me, I hardly customized my iTunes anyway.

And the iTunes Store is working again. Damn.

Being a technician can be hard

Saw this at Wynn’s:

Not funny if you’re a technician

Customer: I have problems printing in red.
Tech support: Do you have a color printer?
Customer: Aaaah, thank you.

This reminds me of something that really occurred actually. Someone was trying to print color out of a printer that does only monochrome printing. My previous company doesn’t load the printer with color cartridges and many people get confused when it says color printer and it prints out in monochrome.

Customer: Can’t get on the Internet.
Tech support: Are you sure you used the right password?
Customer: Yes, I’m sure. I saw my colleague do it.
Tech support: Can you tell me what the password was?
Customer: Five stars.

South Park: Stan fixes the internet

Okay okay, you know how to fix the internet? You just unplug and plug it back. Solves most problems and your technician probably would’ve tell you the same. Continue reading “Being a technician can be hard”