Ubuntu 15.04 network manager causing slow boot

47,983

Solution 1

You can change the timeout of nm-online to something like 10:

Edit /lib/systemd/system/NetworkManager-wait-online.service as root or using sudo.

Look for the lines:

[Service]
Type=oneshot
ExecStart=/usr/bin/nm-online -s -q --timeout=30

Change 30 to whatever you like. 10 worked well for me.

But beware this may break services that depend on it.

Source

Solution 2

I faced the same problem before, NetworkManager taking about 8 seconds. There are three ways to solve this problem:

  1. Disable connecting automatically for your connection

    edit connections > select your connection > edit and disable connecting automatically

    enter image description here

  2. You can simply disable Enable networking from network indicator.

  3. You can disable the service by running this command

    systemctl disable NetworkManager-wait-online.service
    

Solution 3

Disable dhcp on eth0 interface.

If you have dhcp configured on eth0, and the wire is not connected, the system will keep looking for an ip address to assign your device, until the request for ip address times out, before the boot continues.

To verify if this would solve your problem, do sudo /etc/init.d/networking restart and take note of how long it takes for this service to restart.

The service will restart in no time, if there's no issues around eth0 interface, else, a long delay and timeout will be presented.

Share:
47,983

Related videos on Youtube

alx.balmus
Author by

alx.balmus

Embedded Software Engineer

Updated on September 18, 2022

Comments

  • alx.balmus
    alx.balmus almost 2 years

    Since upgrading from 14.10 to 15.04 a few days ago the boot time, grub OS screen to login screen, has increased from 12 seconds to about 40. This is my systemd-analyze critical-chain output:

    The time after the unit is active or started is printed after the "@" character.
    The time the unit takes to start is printed after the "+" character.
    
        graphical.target @37.433s
        └─multi-user.target @37.433s
          └─getty.target @37.432s
            └─[email protected] @37.432s
              └─systemd-user-sessions.service @35.906s +9ms
                └─remote-fs.target @35.904s
                  └─media-XalnasStorage.mount @35.849s +53ms
                    └─network-online.target @35.846s
                      └─network.target @11.636s
                        └─NetworkManager.service @11.502s +132ms
                          └─basic.target @11.487s
                            └─sockets.target @11.487s
                              └─avahi-daemon.socket @11.487s
                                └─sysinit.target @11.485s
                                  └─networking.service @11.333s +65ms
                                    └─apparmor.service @11.269s +63ms
                                      └─local-fs.target @11.268s
                                        └─media-TStore1.mount @10.331s +936ms
                                          └─local-fs-pre.target @10.328s
                                            └─systemd-remount-fs.service @10.320s +6ms
                                              └─systemd-fsck-root.service @10.303s +15ms
                                                └─systemd-journald.socket @151ms
                                                  └─-.slice @150ms
    

    There seems to be a problem with the network manager service.

    The top of the systemd-analyze blame log looks like this:

         24.209s NetworkManager-wait-online.service
         10.056s systemd-udev-settle.service
          1.499s plymouth-quit-wait.service
           936ms media-TStore1.mount
           487ms dev-disk-by\x2duuid-920a92b0\x2d6e65\x2d4a7a\x2d855d\x2d81cb436cd85f.device
           425ms [email protected]
           421ms [email protected]
           407ms media-TStore2.mount
           267ms gpu-manager.service
           215ms plymouth-read-write.service
           209ms [email protected]
           132ms NetworkManager.service
            83ms ModemManager.service
    

    The complete version can be seen here.

    Also the systemd-analyze plot output can be seen here.

    Thanks for your time.

    • Suraj Jain
      Suraj Jain over 7 years
      Atleast mark the answer as best answer.
    • Sandeep C
      Sandeep C over 6 years
      What is the use of this service?
    • DrGorilla.eth
      DrGorilla.eth about 6 years
      @SandeepC Wait for the network to goes online, in case networking is needed for booting (so not realy needed for most of the desktop users;) see askubuntu.com/questions/1018576/…
  • alx.balmus
    alx.balmus about 9 years
    This answer greatly improved the boot time on my system. The top of the systemd-analyze blame output now looks like this: 9.861s systemd-udev-settle.service 6.920s NetworkManager-wait-online.service The boot time is still bigger than on the previous version of Ubuntu though. I edited your answer because mentioned file is in a different location in Ubuntu 15.04.
  • alx.balmus
    alx.balmus about 9 years
    One side effect of decreasing the timeout value is that the network manager indicator shows up while the login screen is displayed or if you login very fast it shows after you have logged in. This happened in Ubuntu 14.10 and older. This is just a "cosmetic" side effect. I have not found any functional unwanted side effects.
  • Tobu
    Tobu almost 9 years
    You should use something like systemctl edit NetworkManager-wait-online.service or /etc/systemd/system/NetworkManager-wait-online.service.d/ove‌​rride.conf, otherwise the changes won't persist.
  • guntbert
    guntbert over 8 years
    Why would that help?
  • WinEunuuchs2Unix
    WinEunuuchs2Unix almost 7 years
    Third one worked for me too with no ill-effects (so far).
  • Sandeep C
    Sandeep C over 6 years
    What is the use of this service?
  • Rochdi Boudjehem
    Rochdi Boudjehem about 6 years
    Third one worked for me (18.04 upgraded from clean 17.10).
  • Rochdi Boudjehem
    Rochdi Boudjehem about 6 years
    Didn't work for me, Instead of that disabling the service with systemctl disable NetworkManager-wait-online.service worked well.
  • Mad Man
    Mad Man almost 6 years
    #3 worked for me on 18.04.1, no issues after disabling.