Description of problem:
When NetworkManager and NetworkManager-wait-online services are disabled, missing dependencies on NetworkManager-wait-online service are reported during boot.
Jul 19 03:05:08 localhost systemd: Job NetworkManager-wait-online.service/start failed with result 'dependency'.
I have disabled the NetworkManager-wait-online and NetworkManager service during installation via kickstart.
Version-Release number of selected component (if applicable):
Use the simple kickstart file and add the commands to stop and disable NetworkManager and NetworkManager-wait-online service in the post script section.
Steps to Reproduce:
1. Import the kickstart file while installation, kickstart file will stop NetworkManager and NetworkManager-wait-online services.
3. Try to grep out the NetworkManager-wait-online from the log files. you will find dependency errors in logs.
"NetworkManager-wait-online.service/start failed with result 'dependency'" should not be happened, as both the services are stop and disabled.
"systemd" should not check that service and print dependency error in log file, as both the services are stop and disabled.
This scenario appears to be a bug like : https://bugzilla.redhat.com/show_bug.cgi?id=921774
# rpm -qf /usr/lib/systemd/system/network-online.target.wants/NetworkManager-wait-online.service
The NetworkManager-wait-online.service is enabled statically. If you disable NetworkManager.service, then you see the dependency-related info message in the log, because NetworkManager-wait-online.service has a Requisite=NetworkManager.
(In reply to Jan Synacek from comment #2)
> # rpm -qf
> The NetworkManager-wait-online.service is enabled statically.
What do you mean? The service is disabled according to comment 0, and
when I try to reproduce I get:
$ systemctl status NetworkManager-wait-online
● NetworkManager-wait-online.service - Network Manager Wait Online
Loaded: loaded (/usr/lib/systemd/system/NetworkManager-wait-online.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Jul 20 11:46:50 winterfell systemd: Dependency failed for Network Manager Wait Online.
Jul 20 11:46:50 winterfell systemd: Job NetworkManager-wait-online.service/start failed with result 'dependency'.
Why is systemd trying to start NetworkManager-wait-online.service even
if it's disabled?
> If you disable NetworkManager.service, then you see the
> dependency-related info message in the log, because
> NetworkManager-wait-online.service has a Requisite=NetworkManager.
But NetworkManager-wait-online is disabled in this case too...
Do you think this is caused by wrong dependencies in NM-wait-online
(In reply to Beniamino Galvani from comment #3)
> (In reply to Jan Synacek from comment #2)
> > # rpm -qf
> > /usr/lib/systemd/system/network-online.target.wants/NetworkManager-wait-
> > online.service
> > NetworkManager-1.4.0-0.3.git20160621.072358da.el7.x86_64
> > The NetworkManager-wait-online.service is enabled statically.
> What do you mean? The service is disabled <...>
It is present in /usr/lib/systemd/system/network-online.target.wants/NetworkManager-wait-online.service, which makes it "statically enabled" (for the lack of better description...), meaning that the network-online target has a Wants= type of dependency on NetworkManager-wait-online.service. That's why the NM-w-o service is started even though it shows as being disabled. The failed dependency is then caused by the Requisite= option.
> Why is systemd trying to start NetworkManager-wait-online.service even
> if it's disabled?
> Do you think this is caused by wrong dependencies in NM-wait-online
> unit file?
As suggested by Michal, one way to solve this would be to remove the Requisite= from the NetworkManager-wait-online.service and make the nm-online tool return 0 when NM is not running.
(In reply to Jan Synacek from comment #4)
> > Do you think this is caused by wrong dependencies in NM-wait-online
> > unit file?
> As suggested by Michal, one way to solve this would be to remove the
> Requisite= from the NetworkManager-wait-online.service and make the
> nm-online tool return 0 when NM is not running.
Instead, how about removing the static "Want" dependency of
network-online.target to NM-w-o.service? I'm not sure of the reason
why it was added in the first place (it was suggested here ), but
that dependency makes impossible to disable NM-w-o (if we exclude
masking) when a service pulls network-online.target in.
systemd-networkd-wait-online doesn't use the static dependency either
Removing the static dependency will prevent the warning as
network-online.target will not start NM-w-o if this is disabled. When
the service is re-enabled, it will add the "Want" dependency from
network-online.target again and everything should work as before.
You would have to make sure that NM-w-o is enabled after installation, so you don't cause any regressions. But, even then, if you enabled NM-w-o and disabled NM, you would still get the warnings in the logs. I think that part of the fix should also be documenting that if people disable NM, they should also make sure that NM-w-o is disabled.
Ok, so it seems that this topic (removing the static dependency) has
been discussed multiple times   with the outcome that the
current solution is good enough.
Regarding the initial request, the error is caused by the fact that there
is a service that depends on network connectivity, and when NM is
installed this creates a dependency on NM-wait-online.
systemctl list-dependencies --reverse NetworkManager-wait-online
shows which services are requesting network connectivity.
These solutions come to mind:
1) simply ignore the error, since it is expected if there are
services requesting network connectivity but NM is disabled
2) mask the NetworkManager-wait-online service to prevent it from
being started ("systemctl mask NetworkManager-wait-online")
Are these acceptable solutions?
I'm closing this as the error is harmless and can be avoided masking the service. Please reopen if needed.