After upgrading to Kubuntu 19.04, I don't know how to write a service so that it can start after DNS service has been initialized.
In this past, I just use After=network.target
, but now it doesn't work. I also tried After=network-online.target
, but no luck.
So I think the problem is systemd-resolved
, how could I solve this problem?
update:
ERROR: getaddrinfo: Temporary failure in name resolution
ERROR: failed to resolve the provided hostname
These are two related logs. So I can confirm the problem is related to DNS service.
systemd-resolved
is the problem, why not useAfter=systemd-resolved.service
? But it sounds as if you are not really sure if that is really your problem, so I would recommend to find the source of the problem first. Look at the service log andjournalctl
.ping www.google.com
or does your service start then if you start it manually?After=systemd-resolved.service
is thatsystemd-resolved.service
's unit saysBefore=network.target
. So if I useAfter=network.target
, it implicitlyAfter=systemd-resolved.service
.systemctl start myservice.service
to start it.