FS#34379 - After=network.target missing in opensshd.service

Attached to Project: Arch Linux
Opened by Ryan Egesdahl (deriamis) - Tuesday, 19 March 2013, 21:29 GMT
Last edited by Gaetan Bisson (vesath) - Wednesday, 20 March 2013, 00:13 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Gaetan Bisson (vesath)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description: opensshd.service is missing After=network.target, which is causing it to try starting before there are any IP addresses bound to the network interface. If you're using any ListenAddress directives in sshd_config, the service will fail to start and leave you without remote access.

Additional info:
* Package version 6.1p1-6
* mosh is not compatible with sshd.socket, so there are still reasons to use sshd.service
* From the everything.log:
Mar 19 15:52:20 galileo systemd[1]: sshd.service: main process exited, code=exited, status=255/n/a
Mar 19 15:52:20 galileo systemd[1]: Unit sshd.service entered failed state
Mar 19 15:52:21 galileo systemd[1]: sshd.service holdoff time over, scheduling restart.
Mar 19 15:52:21 galileo systemd[1]: Stopping OpenSSH Daemon...
Mar 19 15:52:21 galileo systemd[1]: Started SSH Key Generation.
Mar 19 15:52:21 galileo systemd[1]: Starting OpenSSH Daemon...
Mar 19 15:52:21 galileo systemd[1]: Started OpenSSH Daemon.
Mar 19 15:52:21 galileo systemd[1]: sshd.service: main process exited, code=exited, status=255/n/a
Mar 19 15:52:21 galileo systemd[1]: Unit sshd.service entered failed state
Mar 19 15:52:21 galileo systemd[1]: sshd.service holdoff time over, scheduling restart.
Mar 19 15:52:21 galileo systemd[1]: Stopping OpenSSH Daemon...
Mar 19 15:52:21 galileo systemd[1]: Started SSH Key Generation.
Mar 19 15:52:21 galileo systemd[1]: Starting OpenSSH Daemon...
Mar 19 15:52:21 galileo systemd[1]: Started OpenSSH Daemon.
Mar 19 15:52:21 galileo systemd[1]: sshd.service: main process exited, code=exited, status=255/n/a
Mar 19 15:52:21 galileo systemd[1]: Unit sshd.service entered failed state
Mar 19 15:52:21 galileo systemd[1]: sshd.service holdoff time over, scheduling restart.
Mar 19 15:52:21 galileo systemd[1]: Stopping OpenSSH Daemon...
Mar 19 15:52:21 galileo systemd[1]: Started SSH Key Generation.
Mar 19 15:52:21 galileo systemd[1]: Starting OpenSSH Daemon...
Mar 19 15:52:21 galileo systemd[1]: sshd.service start request repeated too quickly, refusing to start.
Mar 19 15:52:21 galileo systemd[1]: Failed to start OpenSSH Daemon.
Mar 19 15:52:21 galileo systemd[1]: Unit sshd.service entered failed state
* From auth.log:
Mar 19 15:52:20 galileo sshd[388]: error: Bind to port 22 on <ipv6_ip> failed: Cannot assign requested address.
Mar 19 15:52:20 galileo sshd[388]: error: Bind to port 22 on <ipv4_ip> failed: Cannot assign requested address.
Mar 19 15:52:20 galileo sshd[388]: fatal: Cannot bind any address.
Mar 19 15:52:20 galileo sshd[399]: error: Bind to port 22 on <ipv6_ip> failed: Cannot assign requested address.
Mar 19 15:52:20 galileo sshd[399]: error: Bind to port 22 on <ipv4_ip> failed: Cannot assign requested address.
Mar 19 15:52:20 galileo sshd[399]: fatal: Cannot bind any address.
Mar 19 15:52:20 galileo sshd[401]: error: Bind to port 22 on <ipv6_ip> failed: Cannot assign requested address.
Mar 19 15:52:20 galileo sshd[401]: error: Bind to port 22 on <ipv4_ip> failed: Cannot assign requested address.
Mar 19 15:52:20 galileo sshd[401]: fatal: Cannot bind any address.
Mar 19 15:52:21 galileo sshd[416]: error: Bind to port 22 on <ipv6_ip> failed: Cannot assign requested address.
Mar 19 15:52:21 galileo sshd[416]: error: Bind to port 22 on <ipv4_ip> failed: Cannot assign requested address.
Mar 19 15:52:21 galileo sshd[416]: fatal: Cannot bind any address.
Mar 19 15:52:21 galileo sshd[418]: error: Bind to port 22 on <ipv6_ip> failed: Cannot assign requested address.
Mar 19 15:52:21 galileo sshd[418]: error: Bind to port 22 on <ipv4_ip> failed: Cannot assign requested address.
Mar 19 15:52:21 galileo sshd[418]: fatal: Cannot bind any address.

Steps to reproduce:
* Set a ListenAddress directive in sshd_config for one or more IP addresses
* systemctl enable sshd.service
* systemctl disable ssnd.socket
* reboot
* try to access your box

Steps to fix:
* Get single-user on your box somehow
* edit /usr/lib/systemd/system/sshd.service and add network.target to the After= line
* execute "systemctl --system daemon-reload" and finish boot or reboot as necessary
This task depends upon

Closed by  Gaetan Bisson (vesath)
Wednesday, 20 March 2013, 00:13 GMT
Reason for closing:  Duplicate
Additional comments about closing:   FS#32110 
Comment by Gaetan Bisson (vesath) - Wednesday, 20 March 2013, 00:13 GMT
Our sshd.service works with the default configuration; if you modify sshd_config it is up to you to change sshd.service accordingly. Most people want their SSH daemon to always be running regardless of network status, bind to the wildcard address 0.0.0.0 and pick up interfaces are they are brought up.

Loading...