There are two approaches:
1. Edit override config (/etc/systemd/system/network-online.target.d/override.conf
)
Type command sudo systemctl edit network-online.target
paste the following config lines
[Unit]
After=graphical.target
That will create an override config at /etc/systemd/system/network-online.target.d/override.conf
, which will partially override /etc/systemd/system/network-online.target
.
2. Edit unit directly (/etc/systemd/system/network-online.target
)
Type command sudo systemctl edit network-online.target --full
Find After=
in [Unit]
section and change the value to graphical.target
If you accidentally break the configuration, you can find the original one at /lib/systemd/system/network-online.target
.
sudo systemctl edit --force --full <your-service.service>
to create a new service
man systemd.unit
to read the manual
multi-user.target
and graphics services are before graphical.target
(ref)
man systemd.special
to read special systemd units manual
network-online.target
Units that strictly require a configured network connection should pull in network-online.target (via a Wants= type dependency) and order themselves after it. This target unit is intended to pull in a service that
delays further execution until the network is sufficiently set up. What precisely this requires is left to the implementation of the network managing service.
multi-user.target
A special target unit for setting up a multi-user system (non-graphical). This is pulled in by graphical. Units that are needed for a multi-user system shall add Wants= dependencies for their unit to this unit during installation. This is best configured via WantedBy=multi-user.target in the unit's [Install] section.
graphical.target
A special target unit for setting up a graphical login screen. This pulls in multi-user.target. Units that are needed for graphical logins shall add Wants= dependencies for their unit to this unit (or multi-user.target) during installation. This is best configured via WantedBy=graphical.target in the unit's [Install] section.