Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
Wifi adds 1min+ to boot time — how to connect in background?
Wifi adds 1min+ to boot time — how to connect in background?
As stated in a previous thread, I'm running a minimal installation of Debian 9.2. When I first booted off of a fresh installation, it took ~10s to reach the login prompt. Now that I have drivers for my wireless card installed and a connection configured through network-manager, the boot process takes upwards of one minute to complete.
Is there any way to initialize the wireless network in the background, so that the boot process doesn't have to wait on it, and it finishes in the background as I'm logging in?
Is there any way to initialize the wireless network in the background, so that the boot process doesn't have to wait on it, and it finishes in the background as I'm logging in?
-
- Posts: 1100
- Joined: 2016-01-07 12:25
- Has thanked: 5 times
- Been thanked: 16 times
Re: Wifi adds 1min+ to boot time — how to connect in backgro
You should start by finding out what is taking the time during boot-up, it might not be the wifi that is causing it, you could post the error that is displayed when booting.
Re: Wifi adds 1min+ to boot time — how to connect in backgro
One common delay is negotiating a dhcp lease. Debian has several dhcp clients - the default is dhclient(8).
If your delay is in obtaining the dhcp lease, there are several options
The other startup delay can be ntp
If your delay is in obtaining the dhcp lease, there are several options
You can also keep your /etc/resolv.conf file rather than re writing it on each boot.-nw
Become a daemon immediately (nowait) rather than waiting until an IP address has been acquired.
The other startup delay can be ntp
Re: Wifi adds 1min+ to boot time — how to connect in backgro
Dai_trying wrote:You should start by finding out what is taking the time during boot-up
Code: Select all
systemd-analyze blame
Re: Wifi adds 1min+ to boot time — how to connect in backgro
@debiman, thanks for the pointer. @Dai_trying, it's definitely the wifi:
@shep, that lead looks very promising. Any idea where I can learn more about where all the system init processes are stored/how they're configured?
Code: Select all
$ systemd-analyze blame
1min 14.858s networking.service
2.666s apt-daily.service
...
Re: Wifi adds 1min+ to boot time — how to connect in backgro
So I've been doing a little reading and now understand that the script I'm looking for is located at /etc/init.d/networking. I found one blog post (https://www.dotkam.com/2008/08/06/speed ... ackground/) which suggests directly modifying that file to launch a portion of it in the background (by moving the content of the 'start' branch of the case statement below into a dedicated function):
Someone on this LinuxQuestions thread (https://www.linuxquestions.org/question ... it-245156/) suggested a similar approach, but then had this to say about making changes to system init scripts:
Code: Select all
# adding this method so it can be run as a background process on the start up
start_on_boot () {
log_action_begin_msg "Configuring network interfaces"
type usplash_write >/dev/null 2>/dev/null && usplash_write "TIMEOUT 120" || true
if [ "$VERBOSE" != no ]; then
if ifup -a; then
log_action_end_msg $?
else
log_action_end_msg $?
fi
else
if ifup -a >/dev/null 2>&1; then
log_action_end_msg $?
else log_action_end_msg $?
fi
fi
type usplash_write >/dev/null 2>/dev/null && usplash_write "TIMEOUT 15" || true
}
case "$1" in
start)
# start networking on the background, so it does not slow down the boot time
start_on_boot &
;;
Is it true that software updates may overwrite changes I make to these files? If so, is there a way to configure DHCP to run in the background without modifying the init script directly?Normally I don't like editing these files, since your changes will not be preserved when the package is updated, but it should solve your problem.
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 132 times
Re: Wifi adds 1min+ to boot time — how to connect in backgro
No, APT should leave any modifications in /etc well alone, they are reserved for the sysadmin.rlue wrote:Is it true that software updates may overwrite changes I make to these files?
I really don't think backgrounding anything will speed up your connection, systemd already aggressively parallelises all processes anyway.
If DHCP is the problem then assign static addresses instead and disable DHCP.
For the record, I find that both ifupdown (/etc/network/interfaces) and systemd-networkd bring the connection up *much* faster than NetworkManager in Debian stretch.
deadbang
Re: Wifi adds 1min+ to boot time — how to connect in backgro
i'm a little surprised that on stretch, networking is still initiated by the old sysvinit and not systemd.
chances are, the script you edited is just a leftover from a bygone era, and will change exactly nothing.
additionally, i really like to use wiki.archlinux.org to get better knowledge, but i guess wiki.debian.org is also good.
services and such are in /etc/systemd and /usr/lib/systemd.
according to what was said earlier, you should leave /usr/lib alone.
if you want to edit one of the files there, copy it to /etc/systemd/system first.
chances are, the script you edited is just a leftover from a bygone era, and will change exactly nothing.
talking about systemd, it has good man pages for all commands and config files.rlue wrote:Any idea where I can learn more about where all the system init processes are stored/how they're configured?
additionally, i really like to use wiki.archlinux.org to get better knowledge, but i guess wiki.debian.org is also good.
services and such are in /etc/systemd and /usr/lib/systemd.
according to what was said earlier, you should leave /usr/lib alone.
if you want to edit one of the files there, copy it to /etc/systemd/system first.
Re: Wifi adds 1min+ to boot time — how to connect in backgro
Y'all were definitely right — it wasn't the wifi and it wasn't network-manager. I uninstalled network-manager and was still having the same problem.
Per this thread on the Unix StackExchange (https://unix.stackexchange.com/question ... ssies-boot), all I had to do was change my ethernet interface in /etc/network/interfaces from "auto" to "allow-hotplug" (the wireless interface was undefined and left up to network-manager to take care of):
I must have made this change around the same time I installed network-manager without paying much mind to it at all.
Thanks for all the insight!
Per this thread on the Unix StackExchange (https://unix.stackexchange.com/question ... ssies-boot), all I had to do was change my ethernet interface in /etc/network/interfaces from "auto" to "allow-hotplug" (the wireless interface was undefined and left up to network-manager to take care of):
Code: Select all
auto lo
iface lo inet loopback
allow-hotplug enp0s10 # this line used to begin with "auto", and was causing the 1min+ delay
iface enp0s10 inet dhcp
Thanks for all the insight!
Last edited by rlue on 2017-11-03 00:52, edited 1 time in total.
Re: Wifi adds 1min+ to boot time — how to connect in backgro
Also, re: @Head_on_a_Stick,
I haven't tried setting up systemd-networkd, but at least on my machine, raising a connection via network-manager is fast enough that I can't imagine it being appreciably faster.For the record, I find that both ifupdown (/etc/network/interfaces) and systemd-networkd bring the connection up *much* faster than NetworkManager in Debian stretch.