2

for my project I need two WiFi interfaces connected to a Raspberry Pi Zero W running Kali Linux (not Raspbian – anyway both are based on Debian). The onboard interface wlan0 shall not connect to any WiFi network (it is dedicated to scan the air in monitor mode). Instead I want another USB WiFi Adapter Edimax EW-7811Un to be used as interface wlan1 to connect to my home WiFi network.

My network interfaces configuration looks as simple as the following few lines:

auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet dhcp

auto wlan1
iface wlan1 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Now the problem is, that the networking service fails to start with a timeout during boot time. See the service status:

Job for networking.service failed because a timeout was exceeded.
See "systemctl status networking.service" and "journalctl -xe" for details.
root@kali:~# cat networking-status.txt 
● networking.service - Raise network interfaces
     Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
     Active: failed (Result: timeout) since Mon 2020-05-11 10:40:47 CEST; 3min 17s ago
       Docs: man:interfaces(5)
    Process: 326 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
   Main PID: 326 (code=exited, status=1/FAILURE)

May 11 10:40:44 kali wpa_supplicant[408]: Successfully initialized wpa_supplicant
May 11 10:40:47 kali wpa_supplicant[411]: wlan1: CTRL-EVENT-REGDOM-CHANGE init=USER type=COUNTRY alpha2=DE
May 11 10:40:47 kali systemd[1]: networking.service: start operation timed out. Terminating.
May 11 10:40:47 kali ifup[326]: Got signal Terminated, terminating...
May 11 10:40:47 kali ifup[326]: ifup: failed to bring up wlan1
May 11 10:40:47 kali wpa_supplicant[411]: nl80211: deinit ifname=wlan1 disabled_11b_rates=0
May 11 10:40:47 kali systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
May 11 10:40:47 kali wpa_supplicant[411]: wlan1: CTRL-EVENT-TERMINATING
May 11 10:40:47 kali systemd[1]: networking.service: Failed with result 'timeout'.
May 11 10:40:47 kali systemd[1]: Failed to start Raise network interfaces.

I figured out, that I need to restart the networking service afterwards twice, to bring it finally up (obviously, this is a show stopper in a headless setup):

systemctl restart networking.service
systemctl restart networking.service

Unfortunately, I need to do that after each reboot, which is pretty annoying… So, my question is: Why does it come to a timeout during the networking service startup and how can I solve this?

Thanks in advance and
best regards

2

Upon writing my question, the answer came to me. I want to share it right away, so it shall help anyone else who stumbles over a similar issue.

First, I took a look at the networking service unit to get a clue, what it is doing, at all.

less /lib/systemd/system/networking.service
[Unit]
Description=Raise network interfaces
Documentation=man:interfaces(5)
DefaultDependencies=no
Requires=ifupdown-pre.service
Wants=network.target
After=local-fs.target network-pre.target apparmor.service systemd-sysctl.service systemd-modules-load.service ifupdown-pre.service
Before=network.target shutdown.target network-online.target
Conflicts=shutdown.target

[Install]
WantedBy=multi-user.target
WantedBy=network-online.target

[Service]
Type=oneshot
EnvironmentFile=-/etc/default/networking
ExecStart=/sbin/ifup -a --read-environment
ExecStop=/sbin/ifdown -a --read-environment --exclude=lo
RemainAfterExit=true
TimeoutStartSec=15

In the [Service] section I noticed the key value entry TimoutStartSec=15 -__-
So I just gave it a try and doubled the value to 30 seconds.

systemctl edit networking.service

The command above does not edit the original unit file located at /lib/systemd/system/networking.service. Instead it overrides just the lines you want within a newly created file located at /etc/systemd/system/networking.service.d/override.conf.

[Service]
TimeoutStartSec=30

And that was the trick! The WiFi interface wlan1 is now starting up successfully after each reboot.

| improve this answer | |
  • Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year. – Ingo May 14 at 9:17
  • Done. Thanks for the hint, @Ingo. – mrkskwsnck May 15 at 8:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.