15

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
        └─getty@tty1.service @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 systemd-rfkill@rfkill2.service
       421ms systemd-rfkill@rfkill0.service
       407ms media-TStore2.mount
       267ms gpu-manager.service
       215ms plymouth-read-write.service
       209ms systemd-rfkill@rfkill1.service
       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.

3 Answers3

16

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
    
Zanna
  • 70,465
Mohamed Slama
  • 1,849
  • 1
  • 17
  • 37
14

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

billgates
  • 156
  • 1
  • 2
  • 4
    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 May 02 '15 at 11:03
  • 2
    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. – alx.balmus May 02 '15 at 11:13
  • 11
    You should use something like systemctl edit NetworkManager-wait-online.service or /etc/systemd/system/NetworkManager-wait-online.service.d/override.conf, otherwise the changes won't persist. – Tobu Jul 10 '15 at 18:35
  • 2
    What is the use of this service? – Sandeep C Mar 23 '18 at 14:30
  • Didn't work for me, Instead of that disabling the service with systemctl disable NetworkManager-wait-online.service worked well. – Rochdi Boudjehem Apr 29 '18 at 20:42
4

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.

Peter
  • 1,638