Re: Cyrus-imapd fails to bind on reboot when assigned to listen on specific IP

Nic Bernstein <[email protected]>
Newsgroups gmane.mail.imap.cyrus
Message-ID <[email protected]>
On 3/20/21 6:09 AM, [email protected] wrote:
> When I don't specify an IP address, cyrus-imapd starts correctly on a 
> server reboot.
>
> When I specify IP / protocol:
>
> |imap   cmd="imapd"   listen="192.168.1.230:imap"  prefork=5 proto=tcp4|
>
> cyrus-imapd tries to bind to those before it is available, and fails:
>
> Mar 20 20:53:31 emp87 cyrus/master[973]: unable to bind to imap/ipv4 socket: Cannot assign requested address
> Mar 20 20:53:31 emp87 cyrus/master[973]: unable to create imap listener socket: Cannot assign requested address
>
> Restarting the service and all is good.
>
> I can put After=network-online.target in the service description, but 
> seems odd that I have to... any other suggestions?
>

You've got the correct answer right there; 
"After=network-online.target".  When you don't specify a bind address, 
cyrus uses 0.0.0.0, initially getting just 127.0.0.1.  As any new 
interfaces come online, it will bind to them.  But if you give it a 
specific IP, and that IP isn't available, cyrus exits. Had you also 
given it 127.0.0.1, that might have worked, but I've not tried it.

FWIW, my Debian-based service  unit has this: After=local-fs.target 
network.target
which seems correct to me.

Cheers,
     -nic

-- 
Nic Bernstein                               [email protected]
https://www.nicbernstein.com
https://www.linkedin.com/in/nic-b-26577a178/


------------------------------------------
Cyrus: Info
Permalink: https://cyrus.topicbox.com/groups/info/Te727080483918be4-M8c48cf4685cf355a042e8b4c
Delivery options: https://cyrus.topicbox.com/groups/info/subscription
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.