8

I am using Minibian(lightweight version of Raspbian) and if the Pi is not connected to a network it will wait a whole minute before finishing booting.

I noticed that if I commented out lines 3 and 4 in /etc/network/interfaces the Pi would boot in a normal amount of time. However, I then lost the ability to SSH into my Pi. When I want fast boots this is what my /etc/network/interfaces file looks like:

auto lo
iface lo inet loopback

#auto eth0
#iface eth0 inet dhcp

So I now I am in this awkward situation where I have to edit this file to alternate between fast boots and the ability to use SSH with my Pi.

Does anyone know how I can fix this, to satisfy both conditions?

2
  • I didn't get; is your RPi waiting ethernet connection ?
    – ahmetertem
    Apr 7, 2016 at 14:19
  • Yes, it says something to the effect of, a start process is running for LSB: waiting for network. It will wait for 1min and then finish booting.
    – NULL
    Apr 7, 2016 at 14:21

6 Answers 6

10

Create file (with subdirs)

/etc/systemd/system/networking.service.d/reduce-timeout.conf

with content:

[Service]
TimeoutStartSec=1

On my Pi model B (with Minibian) this solution resolved the problem. Pi boot time reduced to 15 sec, and network works.

1
  • Confirmed makes huge diff on rpi3 raspbian latest Aug 2017
    – ChrisAdmin
    Aug 24, 2017 at 3:46
5

Run sudo raspi-config and disable 4th option: Wait for Network at Boot.

3
  • 1
    I forgot to mention that I did that in my early troubleshooting and it does not help.
    – NULL
    Apr 7, 2016 at 14:36
  • I looked in the raspi-config script and when you select Fast boot-no wait, it removes the file: /etc/systemd/system/dhcpcd.service.d/wait.conf. I checked and that file is not on my system so whatever raspi-config does for network doesn't matter because the file it uses to wait is gone.
    – NULL
    Apr 7, 2016 at 14:42
  • 1
    It's now under the "Boot Options" menu in raspi-config Oct 13, 2020 at 17:32
2

I don't have the reputation to comment on the accepted answer yet. But just a quick update on the answer, for the latest Raspbian Linux raspberrypi 4.9.59-v7+ #1047 SMP Sun Oct 29 12:19:23 GMT 2017 armv7l GNU/Linux

The file you want to edit is:

/etc/systemd/system/network-online.target.wants/networking.service

It already exists,and you should edit the section already mentioned in the answer. In my case, from TimeoutStartSec=5min, to TimeoutStartSec=1 did the trick.

1
  • It isn't necessary to use that file. The method in the accepted answer is probably a more "best practice" solution since you are not editing a configuration which may get replaced on upgrade.
    – goldilocks
    Mar 9, 2018 at 22:22
2

I had no success applying the many other good solutions to my setup which involves having a macvlan interface on top of eth0. Install based on 2018-06-27-raspbian-stretch-lite. What works well for me:

Disable dhcpcd service.

systemctl disable dhcpcd

Reduce timeout in /etc/dhcp/dhclient.conf.

# Do not hold boot for default 60 seconds, give up faster
# but not too fast, see what work with your DHCP server
timeout 10;

# Retry faster
# This is after initial give up and dhclient went to background and boot proceeded without a lease
# Default 5 minutes is too long
retry 20;

# Consider backoff-cutoff setting as well

So now that waits at boot for up to 10 seconds, and if there is no DHCP lease the dhclient goes into background and boot continues without a lease.

Without dhcpcd I have the added benefit of being manually stop/start/restart wlan0 without having to hunt down wpa_supplicant started presumably by dhcpcd and which was refusing to stop with ifdown wlan0. Note: this might mean you might not be able to use rapsi-config to configure your wifi, and need to write config into /etc/network/interfaces, which is preferred for me anyway.

The otherwise neat solution by Evgeniy Chukanov using /etc/systemd/system/networking.service.d/reduce-timeout.conf to reduce timeout causes dhcpcd to NOT bring up my macvlan interface IF lease timeout on eth0 at boot gets reached.

Not that my macvlan config matters for OP, but it was the reason to come up with this solutions, so for completeness: In /etc/network/interfaces.d/macvlan1

auto macvlan1
iface macvlan1 inet static
    address .....
    netmask .....
    pre-up ip link add macvlan1 link eth0 type macvlan
    post-down ip link del macvlan1

I have since swapped eth0 and mavclan1, and I do static IPv4 on eth0 and DHCP client on macvlan1, which gets me further even using dhcpcd, interface gets created, but still does not re-try to obtain lease after initial timeout. I have not bothered to investigate further because my solution without dhcpcd works very well for me.

1

Does anyone know how I can fix this, to satisfy both conditions?

Perhaps, but not in a canonical way ("proper practice") way without examining the system (I've never used minibian), and learning more about how network configuration on GNU/Linux in general is supposed to work, because I've never used it properly.

All my debian style machines, including pis, have an /etc/network/interfaces that looks like your commented out version.

auto lo
iface lo inet loopback

Non "debian style" distros don't have this file at all -- although they'll have something roughly equivalent, which I'll also crudely disable. I do this because the whole if-up/down autoconfig system in my opinion causes more problems than it solves. However, part of my perspective includes the fact that I understand linux networking on a lower level well enough, and that I find scripting for this sort of thing and/or adding something to the init system myself fairly simple. But that's a perspective that took some years to acquire.

My recommendation here would be to leave that file as you have it (with everything but the first two lines commented out or removed) and try adding this to /etc/rc.local:

 (
     ip link set eth0 up
     dhclient -v eth0
 ) &> /var/log/ethernet.log

First make sure dhclient is installed (dhclient --version), and if not install it.

Also check the system for ifplugd: ps -C ifplugd. If it is in use, disable it.

There are some drawbacks to this:

  • It assumes you are only using the pi on a wire, i.e., you don't want it to prefer or fallback on wifi.

  • If you disconnect, you'll have to re-run those commands again or reboot.

If it doesn't work, have a look in /var/log/ethernet.log.

4
  • Thanks...but I am still curious why this would be a problem?... Rasbpian proper does not have this issue. Is there some more information I could give to help find out was is causing this?
    – NULL
    Apr 7, 2016 at 19:20
  • That's getting a bit on par with trying to help someone diagnose their engine problems over the phone -- not necessarily impossible but probably not worthwhile either. Ask the horse's mouth (i.e., the minibian creator) about it), which will probably mean email.
    – goldilocks
    Apr 7, 2016 at 19:28
  • True.. I was hoping someone here might be using Minibian and have resolved this issue.
    – NULL
    Apr 7, 2016 at 19:30
  • We don't even have a tag but I added one...
    – goldilocks
    Apr 7, 2016 at 19:35
0

I remove the static ip from /boot/cmdline.txt and that works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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