Very slow boot time ubuntu - A start job is running for Raise network interfaces

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

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.