Ask Your Question
0

F25 SSHD not starting on boot after recent updates?

asked 2017-03-07 15:39:10 -0600

Matt101 gravatar image

Hi,

I have had a correctly working SSHD setup since I installed F25 on my home server many months ago, and it has worked with issue for months.

I recently ran an upgrade which upgraded the openssh on March 6 2017:

Upgraded openssh-7.4p1-3.fc25.x86_64                @updates
Upgrade          7.4p1-4.fc25.x86_64                @updates
Upgraded openssh-clients-7.4p1-3.fc25.x86_64        @updates
Upgrade                  7.4p1-4.fc25.x86_64        @updates
Upgraded openssh-server-7.4p1-3.fc25.x86_64         @updates
Upgrade                 7.4p1-4.fc25.x86_64         @updates

SSHD now doesn't start during boot with the following error messages appearing:

Mar 07 19:08:22 mbox sshd[1301]: error: Bind to port 54010 on 192.168.0.14 failed: Cannot assign requested address.
Mar 07 19:08:22 mbox sshd[1301]: fatal: Cannot bind any address.
Mar 07 19:08:22 mbox systemd[1]: sshd.service: Main process exited, code=exited, status=255/n/a
Mar 07 19:08:22 mbox systemd[1]: sshd.service: Unit entered failed state.
Mar 07 19:08:22 mbox systemd[1]: sshd.service: Failed with result 'exit-code'.
Mar 07 19:11:07 mbox sshd[2215]: Server listening on 192.168.0.14 port 54010.

I can open a terminal on the box and run: "systemctl start sshd" as root and it will then start without any errors.

I have checked my sshdconfig with: "sshd -t" all fine (and is as was when previously worked), and I had previously allowed the port in selinux with: "semanage port -a -t sshport_t -p tcp 54010"

Any help greatly appreciated?

edit retag flag offensive close merge delete

Comments

What do you have as ListenAddress in sshd.conf file?

alcir gravatar imagealcir ( 2017-03-08 02:28:23 -0600 )edit

192.168.0.14

Matt101 gravatar imageMatt101 ( 2017-03-08 12:57:00 -0600 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2017-03-08 03:17:42 -0600

So, I have performed some test. If ListenAddress in the sshd configuration file is set 0.0.0.0 or it is commented (as per default), you should have no problems.

If you have specified an IP on wich sshd has to listen to, then the problem is that sshd starts before the IP is configured. So, to solve this, you have to add network-online.target to the systemd unit related to sshd.

sudo vi /etc/systemd/system/multi-user.target.wants/sshd.service

Add network-online.target to Wants and After

[Unit]
...
After=network.target sshd-keygen.target network-online.target
Wants=sshd-keygen.target network-online.target
...

Reload systemd

sudo systemctl daemon-reload

Now, after the reboot, the sshd daemon should ben online.

systemctl status sshd
● sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: disa
   Active: active (running) since Wed 2017-03-08 10:08:31 CET; 22s ago
edit flag offensive delete link more

Comments

Hi, your solution worked, thank you!

Matt101 gravatar imageMatt101 ( 2017-03-08 13:11:46 -0600 )edit

Question Tools

Stats

Asked: 2017-03-07 15:39:10 -0600

Seen: 611 times

Last updated: Mar 08 '17