# Separate startup delay and the delay after reboot

**URL:** https://discourse.pi-hole.net/t/separate-startup-delay-and-the-delay-after-reboot/53427
**Category:** Implemented
**Tags:** core
**Created:** [February 8, 2022, 8:02am UTC](https://discourse.pi-hole.net/t/separate-startup-delay-and-the-delay-after-reboot/53427 "2022-02-08T08:02:30Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![sodawithoutsparkles](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/sodawithoutsparkles/32/12821_2.png) [@sodawithoutsparkles](https://discourse.pi-hole.net/u/sodawithoutsparkles)
#### Post date: [February 8, 2022, 8:02am UTC](https://discourse.pi-hole.net/t/separate-startup-delay-and-the-delay-after-reboot/53427/1 "2022-02-08T08:02:30Z")

</div>

TLDR: add a separate entry in the config to prevent FTL from starting too early before all of the network interfaces are ready.

Some users on Reddit (including myself) found that DNS is not responding when the pi reboots. Upon further investigation, it seems that the issue is caused by a "race condition". Pi-hole might start before the network interfaces are ready, so pihole does not accept the DNS queries received on those interfaces even if they are ready.

The current solution is to add a `DELAY_STARTUP=10` in the FTL config, which makes sure the interfaces are ready before FTL starts.

This works great, but the issue is FTL sleeps for that 10 seconds even when it was told to restart by admin page or cli, long after the reboot, waiting for an unnecessary 10 seconds.

I suggest adding a separate delay for the delay after boot. This could be achieved by setting a flag every time the pi shutdown. If the flag is there then wait for the additional delay.

---

<div class="post-metadata">

### Author: ![jfb](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jfb/32/4332_2.png) [@jfb](https://discourse.pi-hole.net/u/jfb)
#### Post date: [February 8, 2022, 4:57pm UTC](https://discourse.pi-hole.net/t/separate-startup-delay-and-the-delay-after-reboot/53427/2 "2022-02-08T16:57:30Z")

</div>

> [@sodawithoutsparkles](#):
>
> This works great, but the issue is FTL sleeps for that 10 seconds even when it was told to restart by admin page or cli, long after the reboot, waiting for an unnecessary 10 seconds.

It's not clear what you want to change. The startup delay specifically applies to FTL, which is why it is delaying startup per the settings you have applied.

---

<div class="post-metadata">

### Author: ![yubiuser](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/yubiuser/32/12100_2.png) [@yubiuser](https://discourse.pi-hole.net/u/yubiuser)
#### Post date: [February 8, 2022, 9:17pm UTC](https://discourse.pi-hole.net/t/separate-startup-delay-and-the-delay-after-reboot/53427/3 "2022-02-08T21:17:14Z")

</div>

How should FTL distinguish that it was started right after boot from "long after boot"?

---

<div class="post-metadata">

### Author: ![sodawithoutsparkles](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/sodawithoutsparkles/32/12821_2.png) [@sodawithoutsparkles](https://discourse.pi-hole.net/u/sodawithoutsparkles)
#### Post date: [February 9, 2022, 1:02pm UTC](https://discourse.pi-hole.net/t/separate-startup-delay-and-the-delay-after-reboot/53427/4 "2022-02-09T13:02:42Z")

</div>

TLDR: add a separate entry in the config to prevent FTL from starting too early before all of the network interfaces are ready.

The current one kicks in whenever FTL starts. The request is hoping to add a separate delay that ONLY kicks in during the first FTL startup after boot/reboot. Any startup/restart of FTL wont use that delay.

---

<div class="post-metadata">

### Author: ![sodawithoutsparkles](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/sodawithoutsparkles/32/12821_2.png) [@sodawithoutsparkles](https://discourse.pi-hole.net/u/sodawithoutsparkles)
#### Post date: [February 9, 2022, 1:12pm UTC](https://discourse.pi-hole.net/t/separate-startup-delay-and-the-delay-after-reboot/53427/5 "2022-02-09T13:12:21Z")

</div>

Set a flag in a directory where the OS will clear it every (re)boot?

If the flag is not present then use that delay and set the flag.

Or use the `uptime -p` command and check if it is in the first X minutes.

`cut -f1 -d. /proc/uptime` gives the uptime in seconds.

The X may be configurable

---

<div class="post-metadata">

### Author: ![DL6ER](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dl6er/32/281_2.png) [@DL6ER](https://discourse.pi-hole.net/u/DL6ER)
#### Post date: [February 9, 2022, 7:10pm UTC](https://discourse.pi-hole.net/t/separate-startup-delay-and-the-delay-after-reboot/53427/6 "2022-02-09T19:10:11Z")

</div>

All these suggestions seem really hacky and dirty.

> [@sodawithoutsparkles](#):
>
> before all of the network interfaces are ready.

This sparks another idea: We could maybe wait for a given (= one) interface to become ready and only delay if it isn't there. Just thinking out aloud, this may have other side-effects. Opinions welcome.

---

<div class="post-metadata">

### Author: ![sodawithoutsparkles](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/sodawithoutsparkles/32/12821_2.png) [@sodawithoutsparkles](https://discourse.pi-hole.net/u/sodawithoutsparkles)
#### Post date: [February 11, 2022, 3:52am UTC](https://discourse.pi-hole.net/t/separate-startup-delay-and-the-delay-after-reboot/53427/8 "2022-02-11T03:52:37Z")

</div>

This is also a good solution, but what if something went wrong and the interface never comes up?

For example, someone uses wifi to connect the pi. Now they replaces the router and got a free ethernet port, so they decided to use ethernet and block wlan0. If they forgot to change pihole config then FTL would never starts. Maybe add a timeout of 2 minutes?

Or, wait until it can ping the gateway? Or allow multiple interfaces to be monitored, any one comes up would pass the check?

---

<div class="post-metadata">

### Author: ![system](https://discourse.pi-hole.net/uploads/default/original/3X/7/c/7c8792f649eeb921c5d2b4c41564ffa873d9a2b8.png) [@system](https://discourse.pi-hole.net/u/system)
#### Post date: [August 10, 2022, 3:52am UTC](https://discourse.pi-hole.net/t/separate-startup-delay-and-the-delay-after-reboot/53427/9 "2022-08-10T03:52:39Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.

---

<div class="post-metadata">

### Author: ![yubiuser](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/yubiuser/32/12100_2.png) [@yubiuser](https://discourse.pi-hole.net/u/yubiuser)
#### Post date: [August 17, 2022, 9:49am UTC](https://discourse.pi-hole.net/t/separate-startup-delay-and-the-delay-after-reboot/53427/10 "2022-08-17T09:49:27Z")

</div>

Implemented with [DELAY\_STARTUP only when booting by DL6ER · Pull Request #1349 · pi-hole/FTL · GitHub](https://github.com/pi-hole/FTL/pull/1349)

Released with [Pi-hole FTL v5.16, Web v5.13 and Core v5.11.1 released](https://discourse.pi-hole.net/t/pi-hole-ftl-v5-16-web-v5-13-and-core-v5-11-1-released/56384/1)
