How to change network interface connection timeout in systemctl

When I boot my Debian system, its startup hangs for approximately 2 minutes on the line:

Loading, please wait...
[    5.191043] systemd-fsck[129]: /dev/mmcblk0p2: clean, 234192/873120 files, 2335263/3491328 blocks
[    6.645242] intel_rapl: no valid rapl domains found in package 0
[    6.643682] systemd-fsck[222]: fsck.fat 3.0.27 (2014-11-12)
[    6.664844] intel_rapl: no valid rapl domains found in package 0
[    6.660702] systemd-fsck[222]: /dev/mmcblk0p1: 3 files, 33/130812 clusters
[    **] A start job is running for LSB: Raise network interf...38s / no limit)

Eventually, it gives up on raising the network interface and continues booting.

Question: How can I change the timeout used in systemctl, so that after 15 seconds it stops trying to raise the network interface?

Additional info: the source of the problem is the use of a wifi USB dongle on this machine. Sometimes the dongle is there, sometimes it’s not. When the dongle is not plugged in, I expect the network interface to not be raised, and I just don’t want to wait for too long.

Asked By: Jealie

||

This is a problem in the Debian’s networking scripts — they apparently wait for all interfaces to appear and do not have a notion of “dynamically appearing” interfaces (like systemd-networkd does).

You have two solutions. The first solution is to reduce the configuration timeout. However, as can be seen from the output you have posted (...38s / no limit), systemd does not impose any timeouts on the network startup. So this is something you need to configure in the Debian-specific scripts themselves.

The second solution is to use more modern tools to configure your network (like NetworkManager) which support dynamically appearing interfaces. Note that systemd-networkd won’t be of much use here because it has no integrated support for WLAN networks.

Answered By: intelfx

I had a similar problem and was scratching my head over the lack of Google results (after ending up at this page a few times), so I decided to just read up on how systemd works here.

Eventually I figured out that networking is actually a SysV init script (/etc/init.d/networking), which is converted to a systemd service at runtime (/run/systemd/generator.late/networking.service), so you can’t just modify an existing script.

Instead you have to override it with a file at e.g. /etc/systemd/system/networking.service.d/reduce-timeout.conf, in your case containing:

[Service]
TimeoutStartSec=15
Answered By: DuBistKomisch

On a system running Debian Jessie, I was able to append the following code to the file located at /lib/systemd/system/networking.service.d/network-pre.conf

[Service]
TimeoutStartSec=15

This changed ‘no limit’ to a limit of 15 seconds, making the system boot much faster if network is disconnected.

Creating a file in /etc/systemd/system/networking.service.d/ did not have any effect on this system, so I edited the existing file in the /lib/systemd/system/networking.service.d/. If this directory is empty, creating a new .conf file with the code above should work.

Not sure why this is different or if it’s even the correct way to configure such a thing.

Answered By: Proctoru2

I had a similar problem, and it turns out my system was trying to connect to Wi-Fi. My solution involved changing this line in /etc/network/interfaces:

auto wlan0

to:

allow-hotplug wlan0
Answered By: tshepang
Categories: Answers Tags: , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.