Comment 4 for bug 216847

Revision history for this message
Greg Porterfield (gregport) wrote :

I'm having this exact symptom but in a different environment: Ubuntu 10.04 Lucid Server.

After configuring /etc/ssh/sshd_config to have a specific ListenAddress instead of 0.0.0.0, the ssh daemon consistently fails to start at boot time. Errors from /var/log/auth.log:

Sep 23 14:26:45 a02-gsp sshd[697]: error: Bind to port 22 on 10.100.50.19 failed: Cannot assign requested address.
Sep 23 14:26:45 a02-gsp sshd[697]: fatal: Cannot bind any address.

And errors in /var/log/syslog immediately after boot:

Sep 23 14:26:45 a02-gsp init: ssh main process (739) terminated with status 255
Sep 23 14:26:45 a02-gsp init: ssh main process ended, respawning
Sep 23 14:26:45 a02-gsp init: ssh main process (744) terminated with status 255
Sep 23 14:26:45 a02-gsp init: ssh respawning too fast, stopped

So this appears to be the same problem, but the root cause would seem to be upstart in this case. Since /etc/init/ssh.conf says "start on filesystem", sshd is started before the network interfaces are configured and fails to bind to the specific address that isn't configured yet.

I've implemented the following workaround which seems to be working well: changed the start event in ssh.conf to "start on started network-interface" and added a "sleep 3" in the pre-start script (see attached patch). Without the sleep to wait for the interface to be configured, sshd would still fail to start some of the time.

If this would be more appropriate as a new bug specific to Lucid Server I'll be happy to open a new one.