[SOLVED] NetworkManager-wait-online.service holding up boot

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
Post Reply
User avatar
majpooper
Level 6
Level 6
Posts: 1208
Joined: Thu May 09, 2013 1:56 pm
Location: North Carolina, USA

[SOLVED] NetworkManager-wait-online.service holding up boot

Post by majpooper »

Boot time is about 12.5 seconds but just over 5.6 seconds is NetworkManager-wait-online.service
What is this service and how can I reduce the time?

Code: Select all

majpooper@1150z:~$ systemd-analyze
Startup finished in 4.461s (kernel) + 8.046s (userspace) = 12.507s

Code: Select all

majpooper@1150z:~$ systemd-analyze blame
          5.614s NetworkManager-wait-online.service
           590ms vboxdrv.service
           583ms apt-daily-upgrade.service
           575ms apt-daily.service
           404ms systemd-udev-settle.service
           306ms dev-sdb1.device
           274ms debian-system-adjustments.service
           239ms lightdm.service
           234ms plymouth-quit.service
           234ms plymouth-quit-wait.service
           228ms networking.service
           209ms upower.service
           193ms systemd-timesyncd.service
           184ms ufw.service
           164ms ModemManager.service
           122ms rsyslog.service
           122ms udisks2.service
           121ms teamviewerd.service
           114ms keyboard-setup.service
           105ms NetworkManager.service
           100ms rtkit-daemon.service
           100ms avahi-daemon.service
            97ms accounts-daemon.service
            94ms systemd-journald.service
            80ms systemd-udevd.service
            79ms systemd-udev-trigger.service
            74ms lvm2-monitor.service
            61ms packagekit.service
            60ms thermald.service
            55ms acpi-support.service
            50ms polkit.service
            50ms user@1000.service
            48ms speech-dispatcher.service
            48ms systemd-rfkill.service
            48ms brltty.service
            48ms colord.service
            45ms systemd-modules-load.service
            45ms systemd-logind.service
            42ms systemd-tmpfiles-setup-dev.service
            37ms dns-clean.service
            33ms systemd-tmpfiles-setup.service
            31ms wpa_supplicant.service
            31ms hddtemp.service
            20ms pppd-dns.service
            20ms lm-sensors.service
            19ms alsa-restore.service
            18ms plymouth-start.service
lines 1-47

Code: Select all

majpooper@1150z:~$ sys
System:    Host: 1150z Kernel: 4.9.0-8-amd64 x86_64 (64 bit gcc: 6.3.0) Desktop: Cinnamon 3.8.9 (Gtk 3.22.11-1)
           Distro: LMDE 3 (cindy)
Machine:   Device: desktop System: Hewlett-Packard product: h8-1150z
           Mobo: Gigabyte model: 2AC8 v: 1.2 BIOS: AMI v: Ang_713 date: 12/29/2011
CPU:       Octa core AMD FX-8150 Eight-Core (-MCP-) cache: 16384 KB
           flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm) bmips: 57453
           clock speeds: max: 3600 MHz 1: 1400 MHz 2: 1400 MHz 3: 1400 MHz 4: 2700 MHz 5: 1400 MHz 6: 1400 MHz
           7: 3300 MHz 8: 1400 MHz
Graphics:  Card: Advanced Micro Devices [AMD/ATI] Turks PRO [Radeon HD 6570/7570/8550] bus-ID: 01:00.0
           Display Server: X.Org 1.19.2 driver: N/A
           Resolution: 1680x1050@59.88hz, 1920x1080@60.00hz, 1920x1080@60.00hz
           GLX Renderer: Gallium 0.4 on AMD TURKS (DRM 2.49.0 / 4.9.0-8-amd64, LLVM 3.9.1)
           GLX Version: 3.0 Mesa 13.0.6 Direct Rendering: Yes
Audio:     Card-1 Advanced Micro Devices [AMD/ATI] Turks HDMI Audio [Radeon HD 6500/6600 / 6700M Series]
           driver: snd_hda_intel bus-ID: 01:00.1
           Card-2 Advanced Micro Devices [AMD/ATI] SBx00 Azalia (Intel HDA)
           driver: snd_hda_intel bus-ID: 00:14.2
           Sound: Advanced Linux Sound Architecture v: k4.9.0-8-amd64
Network:   Card-1: Ralink RT5390 Wireless 802.11n 1T/1R PCIe driver: rt2800pci v: 2.3.0 bus-ID: 06:00.0
           IF: wlp6s0 state: down mac: <filter>
           Card-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
           driver: r8169 v: 2.3LK-NAPI port: d000 bus-ID: 07:00.0
           IF: enp7s0 state: up speed: 100 Mbps duplex: full mac: <filter>
Drives:    HDD Total Size: 320.3GB (38.2% used)
           ID-1: /dev/sda model: INTEL_SSDSA2BW16 size: 160.0GB
           ID-2: /dev/sdb model: INTEL_SSDSA2BW16 size: 160.0GB
           ID-3: USB /dev/sdg model: Flash_Disk size: 0.3GB
Partition: ID-1: / size: 146G used: 114G (83%) fs: ext4 dev: /dev/sdb1
Sensors:   System Temperatures: cpu: 26.2C mobo: N/A gpu: 50.5
           Fan Speeds (in rpm): cpu: N/A
Info:      Processes: 246 Uptime: 3 days Memory: 2233.3/16019.8MB Init: systemd runlevel: 5 Gcc sys: 6.3.0
           Client: Shell (bash 4.4.121) inxi: 2.3.5 
Last edited by majpooper on Thu Nov 29, 2018 6:06 pm, edited 1 time in total.

rene
Level 16
Level 16
Posts: 6189
Joined: Sun Mar 27, 2016 6:58 pm

Re: NetworkManager-wait-online.service holding up boot

Post by rene »

NetworkManager-wait-online.service waits for NetworkManager to report an active connection (or for a 30 second timeout to expire); for the system "to be online". This is so as to guarantee that the remainder of the startup sequence finds itself capable of communicating over the network; with, say, the NFS server with your home directory, or...

Can't say to be sure how effectively the startup is parallelised around that, but I as a test just now disabled the service with

Code: Select all

systemctl disable NetworkManager-wait-online.service
(on Mint 19 that seems enough; google results indicate that others may need "mask" additionally to "disable") and this did not in fact do anything for my wall-clock boot time. Which is to say that it seems effectively parallelised.

Disabling also doesn't break anything here but generally mileage may and will vary; be sure to check actual wall-clock boot time when/if you decide to disable the service, since it doesn't in fact seem to matter any -- and certainly there's potential for breakage.

User avatar
majpooper
Level 6
Level 6
Posts: 1208
Joined: Thu May 09, 2013 1:56 pm
Location: North Carolina, USA

Re: [SOLVED] NetworkManager-wait-online.service holding up boot

Post by majpooper »

THX rene

For what ever reason this would not remain persistent - the service would restart on every boot

Code: Select all

sudo systemctl disable NetworkManager-wait-online.service
However following up on you post I found this - almost the same but disables the service from starting at boot.

Code: Select all

sudo systemctl mask NetworkManager-wait-online.service
This cut my boot time in half with no ill effects.
NOW:

Code: Select all

majpooper@1150z:~$ systemd-analyze
Startup finished in 4.540s (kernel) + 1.435s (userspace) = 5.975s
BEFORE:

Code: Select all

majpooper@1150z:~$ systemd-analyze
Startup finished in 4.461s (kernel) + 8.046s (userspace) = 12.507s

rene
Level 16
Level 16
Posts: 6189
Joined: Sun Mar 27, 2016 6:58 pm

Re: [SOLVED] NetworkManager-wait-online.service holding up boot

Post by rene »

Yes, I commented on that "mask" thing; was in fact expecting it would be necessary (it disables dbus based invocation as well) but it definitely wasn't here; Mint 19 Xfce. Not sure what's going on there...

In any case:
majpooper wrote:
Thu Nov 29, 2018 6:14 pm
This cut my boot time in half with no ill effects.
I am quite certain it did not and nearly certain it didn't gain you anything. What was cut in half was the time systemd-analyze prints but that number is just the time systemd knows about. When systemd through NetworkManager-wait-online.service explicitly waits for NetworkManager to report being online clearly it knows about that bit and adds it to the reported figure. But while not having it explicitly wait hides those seconds from systemd it is not the case that your startup doesn't still do everything it did before, including bringing the network online, and does as such not necessarily mean anything real.

As such my insistence on wall-clock boot time above. That is, grab a stopwatch and time your boot from BIOS to, say, the desktop welcome sound playing with it. I expect you'll find there to be no difference whatsoever with or without NetworkManager-wait-online enabled. In which case I as commented would definitely advise to re-enable it.

To re-enable for testing or definitively:

Code: Select all

$ systemctl unmask NetworkManager-wait-online.service
$ systemctl enable NetworkManager-wait-online.service

User avatar
smurphos
Level 16
Level 16
Posts: 6742
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: [SOLVED] NetworkManager-wait-online.service holding up boot

Post by smurphos »

If you happen to mount network shares in /etc/fstab you need the service enabled.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.

User avatar
majpooper
Level 6
Level 6
Posts: 1208
Joined: Thu May 09, 2013 1:56 pm
Location: North Carolina, USA

Re: [SOLVED] NetworkManager-wait-online.service holding up boot

Post by majpooper »

rene wrote:
Thu Nov 29, 2018 6:38 pm
Yes, I commented on that "mask" thing; was in fact expecting it would be necessary (it disables dbus based invocation as well) but it definitely wasn't here; Mint 19 Xfce. Not sure what's going on there...

In any case:
majpooper wrote:
Thu Nov 29, 2018 6:14 pm
This cut my boot time in half with no ill effects.
I am quite certain it did not and nearly certain it didn't gain you anything. What was cut in half was the time systemd-analyze prints but that number is just the time systemd knows about. When systemd through NetworkManager-wait-online.service explicitly waits for NetworkManager to report being online clearly it knows about that bit and adds it to the reported figure. But while not having it explicitly wait hides those seconds from systemd it is not the case that your startup doesn't still do everything it did before, including bringing the network online, and does as such not necessarily mean anything real.

As such my insistence on wall-clock boot time above. That is, grab a stopwatch and time your boot from BIOS to, say, the desktop welcome sound playing with it. I expect you'll find there to be no difference whatsoever with or without NetworkManager-wait-online enabled. In which case I as commented would definitely advise to re-enable it.

To re-enable for testing or definitively:

Code: Select all

$ systemctl unmask NetworkManager-wait-online.service
$ systemctl enable NetworkManager-wait-online.service
THX rene - you are right you did mention mask - I just did not realize how it was implemented on the command line - turns out it is too easy. .

I did the wall clock test exactly as you suggested - BUMMER - absolutely no difference in actual boot time- just the output in systemd-analyze gets cut in half - yep in reality no gain - RATZ.

rene
Level 16
Level 16
Posts: 6189
Joined: Sun Mar 27, 2016 6:58 pm

Re: [SOLVED] NetworkManager-wait-online.service holding up boot

Post by rene »

If you google the issue you'll note to not be the only to have gotten excited about that displayed number --- and I do believe many of them are still unaware it's only the displayed number...

Anyway, little over 12 seconds is quite alright. I'd as mentioned advise to re-enable NetworkManager-wait-online.service; your bootup is going to be racy without it, even if it may at this point be okay.

gm10
Level 20
Level 20
Posts: 10999
Joined: Thu Jun 21, 2018 5:11 pm

Re: [SOLVED] NetworkManager-wait-online.service holding up boot

Post by gm10 »

rene wrote:
Fri Nov 30, 2018 5:10 pm
If you google the issue you'll note to not be the only to have gotten excited about that displayed number --- and I do believe many of them are still unaware it's only the displayed number...
Well, depends. The service itself doesn't hold anything up, it's used for establishing systemd's network-online.target. But what can theoretically hold up the boot are services that are configured to wait for that network-online.target.

However, and more importantly, I believe the systemd-analyze blame numbers are commonly misunderstood around here. Those numbers do not show how long a service held up the boot. They show how long a service took from being spawned to reporting initialization complete. If the wait-online.service has a high value in your blame output that simply means that your network is slow to come online, nothing more, nothing less.

As mentioned above, only if you've got services that require network-online.target will their start be delayed. And only the start of those services, not necessarily of your overall boot process. The system will start any number of services in parallel unless they depend on each other.

Post Reply

Return to “Installation & Boot”