You are not logged in.
NetworkManager has always taken relatively long time to start during boot, presumably waiting for wlan to connect.
$ systemd-analyze blame
7.682s NetworkManager.service
..Previously I was able to get it to start on background by removing /etc/systemd/system/multi-user.target.wants/NetworkManager.service
This prevented multi-user.target from waiting for NM to start and it would continue to connect on background while my boot finishes.
However, after upgrade to networkmanager-0.9.10.0-2 that doesn't seem work any more.
If I remove the .service file from multi-user.target.wants/, NetworkManager doesn't start during boot at all.
enabling NetworkManager.service creates these symlinks:
# systemctl enable NetworkManager
Created symlink from /etc/systemd/system/dbus-org.freedesktop.NetworkManager.service to /usr/lib/systemd/system/NetworkManager.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/NetworkManager.service to /usr/lib/systemd/system/NetworkManager.service.
Created symlink from /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service to /usr/lib/systemd/system/NetworkManager-dispatcher.service.looks like enabling any other basic systemd unit links the .service file to multi-user.target.wants/ as well..
How can I enable NetworkManager.service during boot without multi-user.target.wants/, and get it to start on background again?
any ideas appreciated :)
Last edited by ooo (2014-08-03 12:13:28)
Offline
It already starts in the background. Systemd will only keep units that need NetworkManager (or the network.target) from starting until NetworkManager finishes. In other words, doing what you want could potentially result in broken services. If NetworkManager is too heavy for you (i.e. takes too long to start), you may want to switch to a lighter alternative (netctl, systemd-networkd, etc).
Offline
On my system GDM waits for NetworkManager before it starts. Except the latest update fixed a issue with polkit which caused NetworkManager to wait over a minute before it times out.
NetworkManager.service now spends 9 seconds on my system according to systemd-analyze blame.
Offline
Okay, looks like this can be resolved by simply changing the NetworkManager.service type from dbus to forking.
$ systemd-analyze blame
...
173ms NetworkManager.service
...Here's the modified service file if anyone's interested:
place it in /etc/systemd/system/NetworkManager.service
[Unit]
Description=Network Manager
Wants=network.target
Before=network.target
[Service]
Type=forking
PIDFile=/var/run/NetworkManager.pid
BusName=org.freedesktop.NetworkManager
ExecStart=/usr/bin/NetworkManager --pid-file=/var/run/NetworkManager.pid
# NM doesn't want systemd to kill its children for it
KillMode=process
[Install]
WantedBy=multi-user.target
Alias=dbus-org.freedesktop.NetworkManager.service
Also=NetworkManager-dispatcher.serviceYou need to disable NetworkManager.service before creating the file and enable it after so that systemd links the file from /etc/systemd instead of /usr/lib/systemd,
there may be simpler way but I can't be bothered to go through systemd manuals any more.
Note that this will probably break any systemd .service that actually requires network, although that was the case with my previous workaround as well.
I won't guarantee this will work for you and won't set your machine on fire. If you have issues, simply remove the file and re-enable to go back to default
Offline