Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

systemd unit: use network-online.target instead?

Closed Beginner friendly
#2,186 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
linux, rust

Research direction

Start with debian/[email protected] at the linked network ordering line. Review the systemd NETWORK_ONLINE guidance and the existing local and server units for consistency. Done means the templated server unit waits for the network-online target and requests that target, with the unit syntax and intended boot ordering verified.

Written by the indexing model from the issue text.

Description

TLDR: Change this

After=network.target 

to this

After=network-online.target
Wants=network-online.target

A while back when I used ss-rust, it would frequently fail to start at boot due to not being able to bind to IP, but fine when manually restarted:

systemd[1]: Started Shadowsocks-Rust Server Service.
ssservice[408]:  INFO shadowsocks server 1.24.0 build 2026-07-03T13:17:33.553871632+00:00
ssservice[408]: server aborted with Cannot assign requested address (os error 99)
systemd[1]: [email protected]: Main process exited, code=exited, status=70/SOFTWARE
systemd[1]: [email protected]: Failed with result 'exit-code'.

Because I bind to public IP to avoid having ss-rust server listening on every interface (e.g. lo, wireguard, tunnel-broker):

{
  "servers": [
    {
      "address": (public ip here),
      "port": 8388,
      "method": "2022-blake3-aes-256-gcm",
      "password": (redacted)
    }
  ]
}

And it fails because the server starts too early:
https://github.com/shadowsocks/shadowsocks-rust/blob/0ff649e9a6174b1c18f7c43457bfe1da2afc4ad9/debian/shadowsocks-rust-server%40.service#L10
Explanation on network.target and network-online.target: https://systemd.io/NETWORK_ONLINE/

network.target indicates that the network management stack has been started. Ordering after it has little meaning during start-up: whether any network interfaces are already configured when it is reached is not defined.

network-online.target is a target that actively waits until the network is “up”, where the definition of “up” is defined by the network management software. Usually it indicates a configured, routable IP address of some kind.
It is an active target, meaning that it may be pulled in by the services requiring the network to be up,
for example network server software should generally not pull this in (since server software generally is happy to accept local connections even before any routable network interface is up). Its primary purpose is network client software that cannot operate without network.

An example of "online" in systemd-networkd:

# 10-ethernet.network
[Link]
RequiredForOnline=routable
RequiredFamilyForOnline=any

Currently all local & server units use After=network.target, but the below is more common (example):

After=network-online.target
Wants=network-online.target

After to order itself after the target, Wants to try starting the network (still starts the service if it fails).

I think for most common usages of ss-rust, you'd want the network to be up, instead of using ss-server locally / without network. So it's more correct to use network-online.target instead, even tho 0.0.0.0 would bypass the issue.

Dominant language
Rust
Stars
10.9k
Forks
1.5k
Avg merge
4d 41m
Merged PRs (30d)
9

Getting set up

We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from shadowsocks/shadowsocks-rust

All issues in shadowsocks/shadowsocks-rust

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.