RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2001221 - sshd fails to start during boot while configured to bind with specific IP Address using "ListenAddress <IPADDRESS>"
Summary: sshd fails to start during boot while configured to bind with specific IP Add...
Keywords:
Status: CLOSED DUPLICATE of bug 1936538
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: openssh
Version: 8.4
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: Dmitry Belyavskiy
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-09-04 13:13 UTC by Nandhakumar Madheshwaran
Modified: 2021-09-06 12:49 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-09-04 16:51:03 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-96237 0 None None None 2021-09-04 13:14:06 UTC

Description Nandhakumar Madheshwaran 2021-09-04 13:13:09 UTC
Description of problem:
~~~~~~~~~~~~~~~~~~~~~~~

sshd.service fails to start during boot if configured to bind with a specific IP Address using "ListenAddress <IPADDRESS>" directive.

Sep 04 00:18:59 nmadhesh_rhel8 sshd[800]: error: Bind to port 22 on 192.168.0.XXX failed: Cannot assign requested address.
Sep 04 00:18:59 nmadhesh_rhel8 sshd[800]: fatal: Cannot bind any address.

It looks like the sshd is starting before the network is completely online.

However, the service sshd is started later 42seconds while it was reattempted to start.


Version-Release and involved Components (if applicable):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
OS Distro 	: Red Hat Enterprise Linux release 8.4 (Ootpa)
Arch		: x86_64
openssh-server-8.0p1-6.el8_4.2.x86_64
NetworkManager-1.30.0-10.el8_4.x86_64



Steps to Reproduce:
~~~~~~~~~~~~~~~~~~~

1. Configure the sshd to listen to a specific IP Address.

$ grep ListenAddress /etc/ssh/sshd_config 
ListenAddress 192.168.0.XXX


2. Reboot the system and see the sshd service will fail with the following error.


Sep 04 17:53:17 nmadhesh_rhel8 sshd[793]: error: Bind to port 22 on 192.168.0.XXX failed: Cannot assign requested address.
Sep 04 17:53:17 nmadhesh_rhel8 sshd[793]: fatal: Cannot bind any address.
Sep 04 17:53:17 nmadhesh_rhel8 systemd[1]: sshd.service: Main process exited, code=exited, status=255/n/a
Sep 04 17:53:17 nmadhesh_rhel8 systemd[1]: sshd.service: Failed with result 'exit-code'.
Sep 04 17:53:17 nmadhesh_rhel8 systemd[1]: Failed to start OpenSSH server daemon.


3. If we wait for some time(42Seconds), then sshd service will be attempted to be restarted by systemd. This makes the boot time longer than usual.

Sep 04 17:53:59 nmadhesh_rhel8 systemd[1]: sshd.service: Service RestartSec=42s expired, scheduling restart.
Sep 04 17:53:59 nmadhesh_rhel8 systemd[1]: sshd.service: Scheduled restart job, restart counter is at 1.
Sep 04 17:53:59 nmadhesh_rhel8 systemd[1]: Stopped OpenSSH server daemon.
Sep 04 17:53:59 nmadhesh_rhel8 systemd[1]: Stopped target sshd-keygen.target.
Sep 04 17:53:59 nmadhesh_rhel8 systemd[1]: Stopping sshd-keygen.target.
Sep 04 17:53:59 nmadhesh_rhel8 systemd[1]: Reached target sshd-keygen.target.
Sep 04 17:53:59 nmadhesh_rhel8 systemd[1]: Starting OpenSSH server daemon...
Sep 04 17:53:59 nmadhesh_rhel8 sshd[1314]: Server listening on 192.168.0.XXX port 22.
Sep 04 17:53:59 nmadhesh_rhel8 systemd[1]: Started OpenSSH server daemon.

Actual results:
~~~~~~~~~~~~~~~
sshd service fails to start during boot before the Network/IP Address is online.


Expected results:
~~~~~~~~~~~~~~~~~
sshd service should start without any issues after the Network/IP Address is online during system boot.


Additional info:
~~~~~~~~~~~~~~~~

Adding 'After=network-online.target' as a dependency under the sshd.service unit file helps to start sshd without fail.

But any future updates of openssh-server will override these changes. Need a permanent solution.

Comment 1 Dmitry Belyavskiy 2021-09-04 16:51:03 UTC
Looks like a duplicate of bz#1936538 to me

*** This bug has been marked as a duplicate of bug 1936538 ***


Note You need to log in before you can comment on or make changes to this bug.