21

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.

Jealie
  • 312

4 Answers4

17

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
7

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.

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
  • this solution worked for me too. The accepted one did not. – Moritz Aug 14 '16 at 14:46
  • AFAIK /lib/systemd/... is intended for original scripts, and /etc/systemd/... for local overriding, so I'm not sure why it doesn't work for you. I'm also on Jessie. – DuBistKomisch Nov 24 '16 at 15:47
  • /lib/systemd/system/networking.service contained in stretch a timeout of 5min!! – Philippe Gachoud Nov 26 '18 at 11:47
  • @Proctoru2 Maybe you needed to run systemctl daemon-reload, see https://unix.stackexchange.com/questions/364782/what-does-systemctl-daemon-reload-do#:~:text=After%20installing%20new%20generators%20or,(1)%20for%20more%20information. – Gen.Stack Jan 22 '22 at 17:50
6

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
tshepang
  • 65,642
  • this worked well for my Asus P5Q board which has four NICs (it's hard to know which one of the four is assigned as eth0). I changed auto eth0 to allow-hotplug eth0 \n allow-hotplug eth1 \n allow-hotplug eth2 \n allow-hotplug eth3 – Cauterite May 13 '17 at 16:15
1

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.

intelfx
  • 5,365
  • Thank you intelfx for your response. Any lead as to how to configure the timeout in systemd in the Debian-specific scripts? Any pointer toward some kind of solution would be much appreciated! (I spent lots of time googling and empirically messing with options with no success so far) – Jealie Feb 23 '15 at 23:06
  • @Jealie: I have never used Debian or any of its derivatives, so I can't help you here, sorry. It would be better if you added a "debian" tag to your question, but you have rejected my edit which suggested exactly that change... – intelfx Feb 24 '15 at 00:25
  • @Jealle: Ah, hm, I must've misread something then... sorry. – intelfx Feb 24 '15 at 02:10