You are not logged in.

#1 2023-10-16 16:33:31

Registered: 2013-04-06
Posts: 6

[sshd] Require before starting up

Hey there,

Currently the sshd service file contains the following:

Description=OpenSSH Daemon

What this means is that when sshd starts, starts, but it doesn't wait for to finish; crucially, some interfaces may take some time to be up. The issue is that sshd will start even if it can't listen on some of the interfaces; it won't automatically pick it up once interfaces are started. A manual operation is required to restart sshd after interfaces are up.

The fix is simple: add

to wait for the network to be started; one can do it on their own installation, but is it reasonable to put it in the standard sshd service that archlinux provides ? Or should everyone configure it on their own installation ?


#2 2023-10-17 06:26:47

Registered: 2012-08-01
Posts: 1,129

Re: [sshd] Require before starting up


I assume, that you are not experiencing any actual problem with sshd.service (it shouldn’t require being online to start) and this is a request for comments.

`After` (and `Before`) determine the order in which units are activated or stopped, if activation happens. Neither of them triggers activation.

`Requires` (and `Wants`) triggers activation, but does not put the invoking unit in control of when the other unit is considered active. That remains entirely in the other unit. And it does not control order: that is what `After` and `Before` do.

So adding `Requires` doesn’t achieve what you think it does. The effect you observe is a coincidence. That would be true for any similar situation, but it’s in a very special way true for your case: itself does not make guarantees you ascribe to it. So, even if the `Requires` idea would have any effect, it would mean nothing.

At startup implies almost nothing. In particular it doesn’t mean network is available or in any specific state. Its primary use is at shutdown: units in `After` relationship with are deactivated before itself. This is why sshd.service declares this relationship.

If you want for a unit to wait for network to be available, you must configure it in a way specific to your system setup. That will usually mean depending on But be aware that itself is not by itself making any detection and everything depends on your network manager.

What a network manager considers as “being online” is also imprecise. Which brings us to the question you asked at the end. Yes, everyone should configure it on their own installation. The nature of the problem itself makes an universal, one-size-fits-all solution impossible.

Sometimes I seem a bit harsh — don’t get offended too easily!


#3 2023-10-17 07:25:13

Registered: 2012-09-03
Posts: 45,046

Re: [sshd] Require before starting up

Speculating on that sth. might have triggered this inquiry, are you running into a race condition w/ the NIC being renamed? … face_names - eg. iwd runs into that…


Board footer

Powered by FluxBB