10

I am running ubuntu 16.04 and since few days it takes around 5 min to boot up. I looked related questions but I could not find how to troubleshoot my problem. When I run:

systemd-analyze blame

I get this utput:

5min 2.242s networking.service
     21.128s vboxdrv.service
      5.637s NetworkManager-wait-online.service
      3.436s apt-daily.service
       592ms dev-sda1.device
       462ms lightdm.service
       442ms plymouth-quit-wait.service
       389ms libvirt-guests.service

So I guess networking.service is causing the problem. Can somebody help me to fix that? thank you

dufte
  • 13,272
  • 5
  • 39
  • 43
diegus
  • 487
  • It might be worth disabling the boot splash/quiet setting to see the actual boot process. Most likely you'll see a timeout there regarding your networking-setup – dufte Oct 24 '16 at 07:31
  • @dufte I disabled the boot splash/quite setting (http://askubuntu.com/questions/477821/how-can-i-permanently-remove-the-boot-option-quiet-splash) and I see the follow: A start job is running for Raise network interfaces (5 min 2 s)... – diegus Oct 24 '16 at 07:46
  • This post seems to describe your problem: https://ubuntuforums.org/showthread.php?t=2323253 – dufte Oct 24 '16 at 08:15
  • @dufte see the answer and thanks for your help – diegus Oct 24 '16 at 08:18

3 Answers3

12

Maybe it is a workaround but I could reduce the boot up time following the answer at https://ubuntuforums.org/showthread.php?t=2323253, i.e. by editing the file:

sudo vim /etc/systemd/system/network-online.targets.wants/networking.service

And changing the following line at the end of the file:

TimeoutStartSec=5min

to:

TimeoutStartSec=30sec

I have then rebooted the system and it works fine.

If you dont want to reboot the system again, just reboot the daemon by:

sudo systemctl daemon-reload
diegus
  • 487
  • 2
    This is editing a package-provided file, so changes may be lost on upgrades. See my answer for an alternative. – Thomas May 14 '18 at 08:52
3

The answer by diegus is risky, because the file /etc/systemd/system/network-online.targets.wants/networking.service is a symlink to /lib/systemd/system/networking.service. This is owned by the ifupdown package and should not be modified: changes will be overwritten on the next upgrade of this package.

Better is to create a systemd override file:

/etc/systemd/system/networking.service.d/override.conf

[Service]
TimeoutStartSec=30sec

The easiest way to create this file is through systemctl itself:

$ sudo systemctl edit networking.service

This will automatically also reload the file. Use systemctl cat networking.service to see if it worked.

Thomas
  • 428
0

The solutions above did not help me as my USB WLAN adapter stopped working after that.

But setting sudo nano /etc/network/interfaces under Ubuntu 18.04

#from
auto lo br0
iface lo inet loopback

# to 
auto lo
allow-hotplug br0
iface lo inet loopback

helped, as suggested here: https://askubuntu.com/a/1061852/650800

The slow startup occurred after following this tutorial to install KVM.

hb0
  • 221