# su - cyrus -c '/usr/cyrus/bin/idled -C /etc/imapd.conf' bind: Address already in use
How do I figure out what exactly it is trying to bind to?
You could trace it. Do you see idled in the process table? fuser might also tell you what process has the socket open.
I've never done that. Can you give me the 3-line crash course in tracing? :)
It depends on your operating system. What are you using?
Problem solved!
[wrap up for the 'ol archiving engines...]
I gave strace a shot with Cyrus still running: I tried to start idled as the cyrus user using strace:
# su - cyrus -c 'strace /usr/cyrus/bin/idled -C /etc/imapd.conf'
I immediately noticed it was trying to unlink() the socket -- which failed for permission denied. Then it went on to try to bind to the socket. From strace...
[snip...]
unlink("/var/imap/socket/idle") = -1 EACCES (Permission denied)
umask(0) = 077
bind(3, {sin_family=AF_UNIX, path="/var/imap/socket/idle"}, 24) = -1 EADDRINUSE (Address already in use)
[snip...]
Bear in mind that there absolutely no other idled's running and fuser on the socket shows no processes are using it...
I haven't coded sockets in years... digging in the bind(2) man page, led to the unix(7) man page which warns that, "binding to a socket with a filename creates a socket in the file system that MUST BE DELETED by the caller when it is no longer needed..."
So idled is calling unlink() as part of it's startup procedure to clean up leavings from previous idled's; unlink() fails but it goes on hoping the bind() will suceed. Idled finally exits when the bind fails because the socket already exists.
I added group write perm to my /var/imap/socket dir. (I have mine set to be owned by the Sendmail smmsp user.) Ding. idled starts and runs fine.
-Craig