You are not logged in.
I'm trying to get tor.service to start only after the network (which is an ethernet managed by systemd-networkd) has connected.
Following wiki information, I've added the following drop-in file for tor.service:
[Unit]
After=
After=network.target network-online.target
Before=nss-lookup.target
Wants=network-online.target
Moreover, I've enabled systemd-networkd-wait-online.service:
● systemd-networkd-wait-online.service - Wait for Network to be Configured
Loaded: loaded (/usr/lib/systemd/system/systemd-networkd-wait-online.service; enabled; preset: enabled)
Drop-In: /etc/systemd/system/systemd-networkd-wait-online.service.d
└─no-timeout.conf
Active: active (exited) since Mon 2024-04-22 17:15:48 EDT; 1min 22s ago
Docs: man:systemd-networkd-wait-online.service(8)
Main PID: 771 (code=exited, status=0/SUCCESS)
CPU: 7ms
avril 22 17:15:36 xxx systemd[1]: Starting Wait for Network to be Configured...
avril 22 17:15:48 xxx systemd[1]: Finished Wait for Network to be Configured.
For this, I have the following drop-in file to avoid timeouts:
[Service]
ExecStart=
ExecStart=/usr/lib/systemd/systemd-networkd-wait-online --timeout=0
Now, when my system boots it sometimes (but not always) says that tor.service is enabled but not started:
○ tor.service - Anonymizing overlay network for TCP
Loaded: loaded (/usr/lib/systemd/system/tor.service; enabled; preset: disabled)
Drop-In: /etc/systemd/system/tor.service.d
└─after_online.conf
Active: inactive (dead)
The command "journalctl -b -u tor.service" returns no entries.
However, "systemctl status" and "systemctl status multi-user.target" show that
the system is running well and that multi-user.target was reached:
● multi-user.target - Multi-User System
Loaded: loaded (/usr/lib/systemd/system/multi-user.target; static)
Active: active since Mon 2024-04-22 17:15:48 EDT; 2min 53s ago
Docs: man:systemd.special(7)
avril 22 17:15:48 xxx systemd[1]: Reached target Multi-User System.
This is despite the default tor.service having:
[Install]
WantedBy=multi-user.target
I tried looking at "systemctl list-dependencies tor.service", which lists most of them as green but a couple are gray (such as systemd-boot-random-seed.service and the such).
Thank you in advance for any help
Offline
Why is there an empty After= line in the drop-in file and does it help if you remove it ?
The examples in https://wiki.archlinux.org/title/System … work_is_up all list Wants= before After= .
Does it make a difference if you switch their order ?
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
tor is wanted yb teh MU.target, but still has to wait for network.target and network-online.target - what's their statūs when this happens?
Offline
Why is there an empty After= line in the drop-in file and does it help if you remove it ?
The examples in https://wiki.archlinux.org/title/System … work_is_up all list Wants= before After= .
Does it make a difference if you switch their order ?
I don't think order makes a difference.
For the empty line, I've heard some places that some options in drop-in files will only append (i.e. add the stuff you mention), so you need to add an empty line before to clear it.
I'm not sure it's the case of After, and can't find info on it, so I just clear it to make sure it's empty.
tor is wanted yb teh MU.target, but still has to wait for network.target and network-online.target - what's their statūs when this happens?
From memory, both are started succesfully on boot. I'll confirm when this reproduces.
Offline
tor is wanted yb teh MU.target, but still has to wait for network.target and network-online.target - what's their statūs when this happens?
Here's the status when this happens:
● network.target - Network
Loaded: loaded (/usr/lib/systemd/system/network.target; static)
Active: active since Thu 2024-04-25 19:22:10 EDT; 4min 36s ago
Docs: man:systemd.special(7)
https://systemd.io/NETWORK_ONLINE
avril 25 19:22:10 xxx systemd[1]: Reached target Network.
and:
● network-online.target - Network is Online
Loaded: loaded (/usr/lib/systemd/system/network-online.target; static)
Active: active since Thu 2024-04-25 19:22:21 EDT; 4min 29s ago
Docs: man:systemd.special(7)
https://systemd.io/NETWORK_ONLINE
avril 25 19:22:21 xxx systemd[1]: Reached target Network is Online.
Offline