AdguardTeam / AdGuardHome

Network-wide ads & trackers blocking DNS server
https://adguard.com/adguard-home.html
GNU General Public License v3.0
24.67k stars 1.78k forks source link

DHCP static leases not save once reboot router [Openwrt adguardhome 0.107.6-1 package] #4514

Closed sunindersingh closed 2 years ago

sunindersingh commented 2 years ago

Hello,

Once i install adguardhome 0.107.6-1 from Openwrt there two issues i had notice.

a) It not autostart the service, so i manually change the /etc/init.d/adguardhome. "Start from 21 to 99 and Stop 89 to 120" and it fix. b) Now second issue is after reboot it lost all DHCP static leases [Mac / IP / Hostname] entries.

In my router already overlay configure on USB stick so just wondering how to preserve the settings? Because all other settings are saved except "DHCP static leases'

Issue Details

root@OpenWrt:/# ./overlay/upper/usr/bin/AdGuardHome -v --version AdGuard Home Version: v0.107.6 Channel: release Go version: go1.18.1 Build time: 2022-04-15T05:11:18Z+0000 GOOS: linux GOARCH: mipsle Race: false Dependencies: github.com/AdguardTeam/dnsproxy@v0.41.4 (sum: h1:zA8BJmWBkSL5kp4b8CblQRgIrLGzJ4IUGQ7tA1255Cw=) github.com/AdguardTeam/golibs@v0.10.8 (sum: h1:diU9gP9qG1qeLbAkzIwfUerpHSqzR6zaBgzvRMR/m6Q=) github.com/AdguardTeam/urlfilter@v0.15.2 (sum: h1:LZGgrm4l4Ys9eAqB+UUmZfiC6vHlDlYFhx0WXqo6LtQ=) github.com/NYTimes/gziphandler@v1.1.1 (sum: h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I=) github.com/aead/chacha20@v0.0.0-20180709150244-8b13a72661da (sum: h1:KjTM2ks9d14ZYCvmHS9iAKVt9AyzRSqNU1qabPih5BY=) github.com/aead/poly1305@v0.0.0-20180717145839-3fee0db0b635 (sum: h1:52m0LGchQBBVqJRyYYufQuIbVqRawmubW3OFGqK1ekw=) github.com/ameshkov/dnscrypt/v2@v2.2.3 (sum: h1:X9UP5AHtwp46Ji+sGFfF/1Is6OPI/SjxLqhKpx0P5UI=) github.com/ameshkov/dnsstamps@v1.0.3 (sum: h1:Srzik+J9mivH1alRACTbys2xOxs0lRH9qnTA7Y1OYVo=) github.com/beefsack/go-rate@v0.0.0-20200827232406-6cde80facd47 (sum: h1:M57m0xQqZIhx7CEJgeLSvRFKEK1RjzRuIXiA3HfYU7g=) github.com/cheekybits/genny@v1.0.0 (sum: h1:uGGa4nei+j20rOSeDeP5Of12XVm7TGUd4dJA9RDitfE=) github.com/digineo/go-ipset/v2@v2.2.1 (sum: h1:k6skY+0fMqeUjjeWO/m5OuWPSZUAn7AucHMnQ1MX77g=) github.com/fsnotify/fsnotify@v1.5.1 (sum: h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=) github.com/go-ping/ping@v0.0.0-20211130115550-779d1e919534 (sum: h1:dhy9OQKGBh4zVXbjwbxxHjRxMJtLXj3zfgpBYQaR4Q4=) github.com/google/go-cmp@v0.5.6 (sum: h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=) github.com/google/gopacket@v1.1.19 (sum: h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8=) github.com/google/renameio@v1.0.1 (sum: h1:Lh/jXZmvZxb0BBeSY5VKEfidcbcbenKjZFzM/q0fSeU=) github.com/google/uuid@v1.3.0 (sum: h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=) github.com/insomniacslk/dhcp@v0.0.0-20211214070828-5297eed8f489 (sum: h1:jhdHqd7DxBrzfuFSoPxjD6nUVaV/1RIn9aHA0WCf/as=) github.com/josharian/native@v0.0.0-20200817173448-b6b71def0850 (sum: h1:uhL5Gw7BINiiPAo24A2sxkcDI0Jt/sqp1v5xQCniEFA=) github.com/kardianos/service@v1.2.0 (sum: h1:bGuZ/epo3vrt8IPC7mnKQolqFeYJb7Cs8Rk4PSOBB/g=) github.com/lucas-clemente/quic-go@v0.25.0 (sum: h1:K+X9Gvd7JXsOHtU0N2icZ2Nw3rx82uBej3mP4CLgibc=) github.com/marten-seemann/qtls-go1-18@v0.1.0-beta.1 (sum: h1:EnzzN9fPUkUck/1CuY1FlzBaIYMoiBsdwTNmNGkwUUM=) github.com/mdlayher/ethernet@v0.0.0-20190606142754-0394541c37b7 (sum: h1:lez6TS6aAau+8wXUP3G9I3TGlmPFEq2CTxBaRqY6AGE=) github.com/mdlayher/netlink@v1.5.0 (sum: h1:r4fa439+SsMarM0rMONU3iSshSV3ArVqJl6H/zjrhh4=) github.com/mdlayher/raw@v0.0.0-20211126142749-4eae47f3d54b (sum: h1:MHcTarUMC4sFA7eiyR8IEJ6j2PgmgXR+B9X2IIMjh7A=) github.com/mdlayher/socket@v0.1.1 (sum: h1:q3uOGirUPfAV2MUoaC7BavjQ154J7+JOkTWyiV+intI=) github.com/ainar-g/dns@v1.1.49-0.20220411125901-8a162bbc18d8 (sum: h1:Hp2waLwK989ui3bDkFpedlIHfyWdZ77gynvd+GPEqXY=) github.com/patrickmn/go-cache@v2.1.0+incompatible (sum: h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=) github.com/pkg/errors@v0.9.1 (sum: h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=) github.com/satori/go.uuid@v1.2.0 (sum: h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=) github.com/ti-mo/netfilter@v0.4.0 (sum: h1:rTN1nBYULDmMfDeBHZpKuNKX/bWEXQUhe02a/10orzg=) github.com/u-root/uio@v0.0.0-20210528151154-e40b768296a7 (sum: h1:XMAtQHwKjWHIRwg+8Nj/rzUomQY1q6cM3ncA0wP8GU4=) go.etcd.io/bbolt@v1.3.6 (sum: h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU=) golang.org/x/crypto@v0.0.0-20211215153901-e495a2d5b3d3 (sum: h1:0es+/5331RGQPcXlMfP+WrnIIS6dNnNRe0WB02W0F4M=) golang.org/x/net@v0.0.0-20220403103023-749bd193bc2b (sum: h1:vI32FkLJNAWtGD4BwkThwEy6XS7ZLLMHkSkYfF8M0W0=) golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c (sum: h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=) golang.org/x/sys@v0.0.0-20220406163625-3f8b81556e12 (sum: h1:QyVthZKMsyaQwBTJE04jdNN0Pp5Fn9Qga0mrgxyERQM=) golang.org/x/text@v0.3.7 (sum: h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=) gopkg.in/natefinch/lumberjack.v2@v2.0.0 (sum: h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=) gopkg.in/yaml.v2@v2.4.0 (sum: h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=) howett.net/plist@v1.0.0 (sum: h1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM=)

jumpsmm7 commented 2 years ago

Hello,

Once i install adguardhome 0.107.6-1 from Openwrt there two issues i had notice.

a) It not autostart the service, so i manually change the /etc/init.d/adguardhome. "Start from 21 to 99 and Stop 89 to 120" and it fix. b) Now second issue is after reboot it lost all DHCP static leases [Mac / IP / Hostname] entries.

In my router already overlay configure on USB stick so just wondering how to preserve the settings? Because all other settings are saved except "DHCP static leases'

Issue Details

root@OpenWrt:/# ./overlay/upper/usr/bin/AdGuardHome -v --version AdGuard Home Version: v0.107.6 Channel: release Go version: go1.18.1 Build time: 2022-04-15T05:11:18Z+0000 GOOS: linux GOARCH: mipsle Race: false Dependencies: github.com/AdguardTeam/dnsproxy@v0.41.4 (sum: h1:zA8BJmWBkSL5kp4b8CblQRgIrLGzJ4IUGQ7tA1255Cw=) github.com/AdguardTeam/golibs@v0.10.8 (sum: h1:diU9gP9qG1qeLbAkzIwfUerpHSqzR6zaBgzvRMR/m6Q=) github.com/AdguardTeam/urlfilter@v0.15.2 (sum: h1:LZGgrm4l4Ys9eAqB+UUmZfiC6vHlDlYFhx0WXqo6LtQ=) github.com/NYTimes/gziphandler@v1.1.1 (sum: h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I=) github.com/aead/chacha20@v0.0.0-20180709150244-8b13a72661da (sum: h1:KjTM2ks9d14ZYCvmHS9iAKVt9AyzRSqNU1qabPih5BY=) github.com/aead/poly1305@v0.0.0-20180717145839-3fee0db0b635 (sum: h1:52m0LGchQBBVqJRyYYufQuIbVqRawmubW3OFGqK1ekw=) github.com/ameshkov/dnscrypt/v2@v2.2.3 (sum: h1:X9UP5AHtwp46Ji+sGFfF/1Is6OPI/SjxLqhKpx0P5UI=) github.com/ameshkov/dnsstamps@v1.0.3 (sum: h1:Srzik+J9mivH1alRACTbys2xOxs0lRH9qnTA7Y1OYVo=) github.com/beefsack/go-rate@v0.0.0-20200827232406-6cde80facd47 (sum: h1:M57m0xQqZIhx7CEJgeLSvRFKEK1RjzRuIXiA3HfYU7g=) github.com/cheekybits/genny@v1.0.0 (sum: h1:uGGa4nei+j20rOSeDeP5Of12XVm7TGUd4dJA9RDitfE=) github.com/digineo/go-ipset/v2@v2.2.1 (sum: h1:k6skY+0fMqeUjjeWO/m5OuWPSZUAn7AucHMnQ1MX77g=) github.com/fsnotify/fsnotify@v1.5.1 (sum: h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=) github.com/go-ping/ping@v0.0.0-20211130115550-779d1e919534 (sum: h1:dhy9OQKGBh4zVXbjwbxxHjRxMJtLXj3zfgpBYQaR4Q4=) github.com/google/go-cmp@v0.5.6 (sum: h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=) github.com/google/gopacket@v1.1.19 (sum: h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8=) github.com/google/renameio@v1.0.1 (sum: h1:Lh/jXZmvZxb0BBeSY5VKEfidcbcbenKjZFzM/q0fSeU=) github.com/google/uuid@v1.3.0 (sum: h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=) github.com/insomniacslk/dhcp@v0.0.0-20211214070828-5297eed8f489 (sum: h1:jhdHqd7DxBrzfuFSoPxjD6nUVaV/1RIn9aHA0WCf/as=) github.com/josharian/native@v0.0.0-20200817173448-b6b71def0850 (sum: h1:uhL5Gw7BINiiPAo24A2sxkcDI0Jt/sqp1v5xQCniEFA=) github.com/kardianos/service@v1.2.0 (sum: h1:bGuZ/epo3vrt8IPC7mnKQolqFeYJb7Cs8Rk4PSOBB/g=) github.com/lucas-clemente/quic-go@v0.25.0 (sum: h1:K+X9Gvd7JXsOHtU0N2icZ2Nw3rx82uBej3mP4CLgibc=) github.com/marten-seemann/qtls-go1-18@v0.1.0-beta.1 (sum: h1:EnzzN9fPUkUck/1CuY1FlzBaIYMoiBsdwTNmNGkwUUM=) github.com/mdlayher/ethernet@v0.0.0-20190606142754-0394541c37b7 (sum: h1:lez6TS6aAau+8wXUP3G9I3TGlmPFEq2CTxBaRqY6AGE=) github.com/mdlayher/netlink@v1.5.0 (sum: h1:r4fa439+SsMarM0rMONU3iSshSV3ArVqJl6H/zjrhh4=) github.com/mdlayher/raw@v0.0.0-20211126142749-4eae47f3d54b (sum: h1:MHcTarUMC4sFA7eiyR8IEJ6j2PgmgXR+B9X2IIMjh7A=) github.com/mdlayher/socket@v0.1.1 (sum: h1:q3uOGirUPfAV2MUoaC7BavjQ154J7+JOkTWyiV+intI=) github.com/ainar-g/dns@v1.1.49-0.20220411125901-8a162bbc18d8 (sum: h1:Hp2waLwK989ui3bDkFpedlIHfyWdZ77gynvd+GPEqXY=) github.com/patrickmn/go-cache@v2.1.0+incompatible (sum: h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=) github.com/pkg/errors@v0.9.1 (sum: h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=) github.com/satori/go.uuid@v1.2.0 (sum: h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=) github.com/ti-mo/netfilter@v0.4.0 (sum: h1:rTN1nBYULDmMfDeBHZpKuNKX/bWEXQUhe02a/10orzg=) github.com/u-root/uio@v0.0.0-20210528151154-e40b768296a7 (sum: h1:XMAtQHwKjWHIRwg+8Nj/rzUomQY1q6cM3ncA0wP8GU4=) go.etcd.io/bbolt@v1.3.6 (sum: h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU=) golang.org/x/crypto@v0.0.0-20211215153901-e495a2d5b3d3 (sum: h1:0es+/5331RGQPcXlMfP+WrnIIS6dNnNRe0WB02W0F4M=) golang.org/x/net@v0.0.0-20220403103023-749bd193bc2b (sum: h1:vI32FkLJNAWtGD4BwkThwEy6XS7ZLLMHkSkYfF8M0W0=) golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c (sum: h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=) golang.org/x/sys@v0.0.0-20220406163625-3f8b81556e12 (sum: h1:QyVthZKMsyaQwBTJE04jdNN0Pp5Fn9Qga0mrgxyERQM=) golang.org/x/text@v0.3.7 (sum: h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=) gopkg.in/natefinch/lumberjack.v2@v2.0.0 (sum: h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=) gopkg.in/yaml.v2@v2.4.0 (sum: h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=) howett.net/plist@v1.0.0 (sum: h1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM=)

* **Version of AdGuard Home server:**

  *

* **How did you install AdGuard Home:**

  *

* **How did you setup DNS configuration:**

  *

* **If it's a router or IoT, please write device model:**

  *

* **CPU architecture:**

  *

* **Operating system and version:**

  *

Sounds like some parts of your AdGuardHome directory particularly the data part may be store on volatile memory portions such as /tmp, thus it would be erased on reboots.

sunindersingh commented 2 years ago

Sounds like some parts of your AdGuardHome directory particularly the data part may be store on volatile memory portions such as /tmp, thus it would be erased on reboots.

Can you please confirm at where DHCP settings save? If it save at adguardhome.yaml then it should be there, because all other settings still saved in that file even if I reboot the router.

jumpsmm7 commented 2 years ago

Sounds like some parts of your AdGuardHome directory particularly the data part may be store on volatile memory portions such as /tmp, thus it would be erased on reboots.

Can you please confirm at where DHCP settings save? If it save at adguardhome.yaml then it should be there, because all other settings still saved in that file even if I reboot the router.

IIRC it depends on where your adguardhome data folder is getting store, not the .yaml file. I don't know how old your AdGuardHome settings are but here is the lastest guide

https://openwrt.org/docs/guide-user/services/dns/adguard-home

maybe it has more details.

Before this release you are using with openwrt, they did not have an actual persistant place to store the data folder.

https://github.com/openwrt/packages/commit/f7973fc7afc6c05cbb535439249ce5587fad4f80

Here is the commit that shows the new addition of it. you may actually have to uninstall and reinstall your adguardhome to ensure you get the full setup of their latest commits.

In the previous version, they recently stored the working directory in the /tmp region, which was volatile (meaning it gets deleted on reboots.

WORK_DIR=/tmp/adguardhome

now it should be stored at

/var/adguardhome

where it gets symbolically linked back to the /tmp directory.

Also, it depends on how openwrt kills/stops adguardhome process.

If the process itself is being killed or stopped without a signal to INIT, you should plan to lose a lot of data because adguardhome will not do its proper cleanup processes before shutdown.

While I don't run openwrt anymore, when I did I tried their AdGuardHome package and found experienced similar issues as your post.

Right now I currently Maintain the installation script for AdGuardHome on asuswrt routers running @RMerl Firmware.

Here is my github:

https://github.com/jumpsmm7/Asuswrt-Merlin-AdGuardHome-Installer

I took many aspects from the way entware handles packages and optimally configured AdGuardHome for use on Asuswrt-Merlin Routers.

I think your best resolution might reside with reaching out to the Openwrt Package handler devs and ask them if there may be something you need to do (or they need to do) to fix the way this situation is occurring for you.

sunindersingh commented 2 years ago

Before this release you are using with openwrt, they did not have an actual persistant place to store the data folder.

I am using latest build of both as i believe.

a) Openwrt SNAPSHOT r19481-a5ac8ad0ba [Installed on 16 Apr 2022 latest build] b) adguardhome 0.107.6-1 [AdGuard Home v0.107.6 this is the current build]

So overall its all fresh setup and is it not possible to set the WORK_DIR=/tmp/adguardhome to /var/adguardhome after installation?

And how to connect with "Openwrt Package handler devs", should I open issue in Openwrt ticket system for this issue?

Ty.

sunindersingh commented 2 years ago

Right now I currently Maintain the installation script for AdGuardHome on asuswrt routers running @RMerl Firmware.

Can you please confirm one more thing, If you save one "DHCP static leases" in your AdGuardHome configuration, then where it store that settings?

jumpsmm7 commented 2 years ago

Before this release you are using with openwrt, they did not have an actual persistant place to store the data folder.

I am using latest build of both as i believe.

a) Openwrt SNAPSHOT r19481-a5ac8ad0ba [Installed on 16 Apr 2022 latest build] b) adguardhome 0.107.6-1 [AdGuard Home v0.107.6 this is the current build]

So overall its all fresh setup and is it not possible to set the WORK_DIR=/tmp/adguardhome to /var/adguardhome after installation?

And how to connect with "Openwrt Package handler devs", should I open issue in Openwrt ticket system for this issue?

Ty.

Yes, open a ticket referencing your issues similar to how you have layed out the details here. If you have to you could send the details here.

Here is where you should open the issue : https://github.com/openwrt/packages/issues

use the https://github.com/openwrt/packages/commit/f7973fc7afc6c05cbb535439249ce5587fad4f80 link to refer to the most recent commit. Ask if there may be a need to investigate the problem more, or if there is something you might be missing.

jumpsmm7 commented 2 years ago

then where it

Should be stored in your /var/adguardhome/data folder under one of the .db files I believe and partly in the .yaml file under

dhcp: enabled: false interface_name: "" local_domain_name: lan dhcpv4: gateway_ip: "" subnet_mask: "" range_start: "" range_end: "" lease_duration: 86400 icmp_timeout_msec: 1000 options: [] dhcpv6: range_start: "" lease_duration: 86400 ra_slaac_only: false ra_allow_slaac: false clients: []

sunindersingh commented 2 years ago

.db files I believe

Is there anyway to check if its storing/writing in .db file?

I got following location of files. : -

root@OpenWrt:~# find / -iname adg* /etc/config/adguardhome /etc/init.d/adguardhome /etc/adguardhome.yaml /lib/upgrade/keep.d/adguardhome /overlay/upper/etc/config/adguardhome /overlay/upper/etc/adguardhome.yaml /overlay/upper/etc/init.d/adguardhome /overlay/upper/lib/upgrade/keep.d/adguardhome /overlay/upper/usr/bin/AdGuardHome /overlay/upper/usr/lib/opkg/info/adguardhome.conffiles /overlay/upper/usr/lib/opkg/info/adguardhome.control /overlay/upper/usr/lib/opkg/info/adguardhome.prerm /overlay/upper/usr/lib/opkg/info/adguardhome.postinst /overlay/upper/usr/lib/opkg/info/adguardhome.list /sys/fs/cgroup/services/adguardhome /tmp/adguardhome /usr/bin/AdGuardHome /usr/lib/opkg/info/adguardhome.conffiles /usr/lib/opkg/info/adguardhome.control /usr/lib/opkg/info/adguardhome.prerm /usr/lib/opkg/info/adguardhome.postinst /usr/lib/opkg/info/adguardhome.list

jumpsmm7 commented 2 years ago

I would have Openwrt investigate first to ensure the way the package is handled is done so with the proper respect to how AdGuardHome requires. For example, my reference to how adguardhome is stop or start. I know if adguardhome does not properly stop, then the query log is cleared and the client list is emptied.

sunindersingh commented 2 years ago

I would have Openwrt investigate Yes as you suggested I have create ticket there as well "DHCP static leases not save once reboot router [Openwrt adguardhome 0.107.6-1 package] #18345"

jamesmacwhite commented 2 years ago

Hi, I'm not the main maintainer of the AdGuard Home package in OpenWrt, but have been working with it and kept it updated more recently. I noticed the issue was also raised: https://github.com/openwrt/packages/issues/18345 and I have responded, but I'll post here for just general developer oversight for the AGH team

In terms of the issues raised regarding the OpenWrt package.

We have have a start value in the init script that is much more early than the one AdGuard Home ships, the reason being that if AGH is the primary DNS resolver, having it set to START=99 means DNS is not available until very late in the boot process. That's even later than any custom commands in the /etc/rc.local file, which is not ideal. I assume the reason for using START=99 is because you likely discovered there are various potential race conditions possible that can lead to AdGuard Home not being able to startup. This has been noted before and it's basically due to different network configurations. The main culprits for this to happen are usually:

  1. Interface/bind addresses not being able at the startup time
  2. ipset chains not being available
  3. Possible issues with NTP i.e. not having the correct time if using DNS over HTTPS/TLS

I'd highly recommend investigating the reason for AdGuard Home not starting, by reading the syslog logread -e adguardhome

In terms of where the adguardhome package stores data. By default it's /var/adguardhome, var is a symlink to /tmp. This is the default because any other location would be the flash space without USB or exroot and hence could wear out the flash storage quite quickly.

This is configurable by changing the workdir value in /etc/config/adguardhome.

Hope this helps.

sunindersingh commented 2 years ago

In terms of where the adguardhome package stores data. By default it's /var/adguardhome, var is a symlink to /tmp. This is the default because any other location would be the flash space without USB or exroot and hence could wear out the flash storage quite quickly.

This is configurable by changing the workdir value in /etc/config/adguardhome.

Just would like to know based on following scenario : - a) New router flashed with Openwrt firmware. b) Format and attached USB Stick and mapper Overlay folder to USB disk.

Now in future if any software package if we install from Openwrt software interface/opkg then by default will it pick folder structure of USB or still store into default router directory?

If its store at router directory instead of USB stick then is it possible or workaround to set some path/variable to change the location once for all so in future it auto use USB stick [As long as it mounted as overlay]? Thanks

jumpsmm7 commented 2 years ago

In terms of where the adguardhome package stores data. By default it's /var/adguardhome, var is a symlink to /tmp. This is the default because any other location would be the flash space without USB or exroot and hence could wear out the flash storage quite quickly. This is configurable by changing the workdir value in /etc/config/adguardhome.

Just would like to know based on following scenario : - a) New router flashed with Openwrt firmware. b) Format and attached USB Stick and mapper Overlay folder to USB disk.

Now in future if any software package if we install from Openwrt software interface/opkg then by default will it pick folder structure of USB or still store into default router directory?

If its store at router directory instead of USB stick then is it possible or workaround to set some path/variable to change the location once for all so in future it auto use USB stick [As long as it mounted as overlay]? Thanks

Per openwrts documentation there is a file the init.d files read for the location of the adguardhome directory per user specification. /etc/config/adguardhome You must move your working directory to the "usb" location and follow the openwrts guides on where this file you need to modify is.

Hint the file you need to edit is here:

/etc/config/adguardhome

For future reference, the adgaurd home devs are not the foremost experts on how openwrt package handlers derive adguard home on their setup. Typically one does not open an issue tracker for an application, if it does not relate to the maintainers of the application. Hence, openwrt forums or openwrt github discussion platform is the more appropriate place to have open this issue or brought up this question.

jumpsmm7 commented 2 years ago

Hi, I'm not the main maintainer of the AdGuard Home package in OpenWrt, but have been working with it and kept it updated more recently. I noticed the issue was also raised: openwrt/packages#18345 and I have responded, but I'll post here for just general developer oversight for the AGH team

In terms of the issues raised regarding the OpenWrt package.

We have have a start value in the init script that is much more early than the one AdGuard Home ships, the reason being that if AGH is the primary DNS resolver, having it set to START=99 means DNS is not available until very late in the boot process. That's even later than any custom commands in the /etc/rc.local file, which is not ideal. I assume the reason for using START=99 is because you likely discovered there are various potential race conditions possible that can lead to AdGuard Home not being able to startup. This has been noted before and it's basically due to different network configurations. The main culprits for this to happen are usually:

1. Interface/bind addresses not being able at the startup time

2. ipset chains not being available

3. Possible issues with NTP i.e. not having the correct time if using DNS over HTTPS/TLS

I'd highly recommend investigating the reason for AdGuard Home not starting, by reading the syslog logread -e adguardhome

In terms of where the adguardhome package stores data. By default it's /var/adguardhome, var is a symlink to /tmp. This is the default because any other location would be the flash space without USB or exroot and hence could wear out the flash storage quite quickly.

This is configurable by changing the workdir value in /etc/config/adguardhome.

Hope this helps.

@jamesmacwhite , Adguardhome could start later on in the boot process, if you have an early source of dns configured for applicable router functions. (like the read of entries from /etc/resolv.conf for example.) After the processes have started, you can then modify this pathway however you need to suite the need of AdGuardHome.