[How-To-Updated 2021] Installing AdGuardHome on OpenWrt [Manual and opkg method]

@brokenpipe
I also have AGH as my only DNS resolver. I installed the pkg from repo but then I overwrote the repo's binary with edge version, no problem with that. I can even upgrade AGH from its web interface "update" button.
I do occasional openwrt upgrades with "attended sysupgrade" in Lucy's interface and I do preserve settings, no issues there either. My backups do save the current binary, had it included in the "backup list".

@TriplEight When AGH service goes down it can be automatically restarted with "respawn" parameter (as @route66 mentioned). My /etc/init.d/AdGuardHome file has this:

procd_set_param env GOGC=30 GOMEMLIMIT=100MiB
procd_set_param command /usr/bin/AdGuardHome -c /etc/adguardhome.yaml -w /opt/AdGuardHome -s run
procd_set_param respawn 3600 60 0

The above line waits 60 seconds to restart and tries forever...
To preserve all this I have in the "save list":

/usr/bin/AdGuardHome
/etc/adguardhome.yaml
/etc/init.d/adguardhome

In my case, to avoid having AGH crashing I disabled automatic updating the blocklists, and scheduled a script that is running once a week and stops AGH, downloads my selected lists and restart AGH. Because AGH is very memory hungry depending on the selected lists, you may need to do several tests to find how many lists you can have without "out-of-RAM problems".

So im trying to update my r4s router to latest 23.05, but when i do, Adgaurd seems to be no longer installed web page isnt available and nothing can access the internet.

So i have reverted back to 22 which was working fine, adgaurd then said there was a update which i ran, but now no nothing has internet again

is it worth keeping this setup, or removing it, running upgrade image to 23.05, then installing the opkg version of adgaurd?

From my end it's working great. Install latest openwrt version and then adguardhome. Check your yaml file.

yeah I think before it was because adgaurd was installed when upgrade was done

so im thinking
remove this adgaurd
run upgrade on openwrt

then do i install this or adgaurd via opkg?

1 Like

That's exactly what I did

1 Like

Hi to all,

I'm facing some issues lately with AdGuard and would love to hear your feedback.
First of all, sorry if this got answered already, but I'm between houses and no time at all to check.

I was on the edge version of AdGuard, and always update throught the webpage without issues.
So I closed the router to move from the old house and after two months that I was able to actually fire up again my router (yeah also changed country...) I saw that a new version of AdGuard, was available, didn't think of it much since I never had issues and updated.
After that, no internet at all... (keep in mind I'm more than a year with that setup without issues.)
Deleted Adguard, reinstall it, all good. Next update, again no internet...
Deleted again and now I'm on v0.108.0-b.50 Beta version (Actually I can't find edge anywhere for download...)
Again no internet, and I just found out that if on fallback DNS I add for ex 9.9.9.9 then everything works as normal, and on dns leaktest all of my Upstream servers displayed. If I remove fallback dns, nothing works.

Is a new addition requiring fallback dns to be present in order for AdGuard to work?

Please let me know if you need my setup info...

Thank you and best regards.

I read the above posts that were written a while ago about installing adguard via cli
following relase of current version, i wonder that it can be done only via luci with no or minimal command line interface

I installed it via luci and it It is working on netgear r 7800.

Only follwoing steps I have done after choosing 8080 and 5353 ports for adguard home on LAN interface:

In luci's dns and DHCP luci settings I have redirected DNS to 192.168.1.1#5353 (adguard port).
I have unticked rebing DNS protection in luci DNS settings
I have unticked in wan interfaces to ignore ISP DNS

Moving further :

Should any more chnages with the DNSmasq settings inclduing such as changing ant paramets of dnsmasq such as size of DNS query cache (default is 1000 in luci's page).?
image

Also via the above steps has adguard dns taken completely the dns fucntions and does openwrt ignores dns masq DNS function ( to ensure that it is not going again via dnsmasq).?

As i installed via luci and not as above in the post- should I need to make any more changes to ensure optmised configuration of adguard home such as to move dnsmasq to port 54
`?

I read the above posts that were written a while ago about installing adguard via cli
following relase of current version, i wonder that it can be done only via luci with no or minimal command line interface

I installed it via luci and it It is working on netgear r 7800.

Only follwoing steps I have done after choosing 8080 and 5353 ports for adguard home on LAN interface:

In luci's dns and DHCP luci settings I have redirected DNS to 192.168.1.1#5353 (adguard port).
I have unticked rebing DNS protection in luci DNS settings
I have unticked in wan interfaces to ignore ISP DNS

Moving further :

Should any more chnages with the DNSmasq settings inclduing such as changing ant paramets of dnsmasq such as size of DNS query cache (default is 1000 in luci's page).?
image

Also via the above steps has adguard dns taken completely the dns fucntions and does openwrt ignores dns masq DNS function ( to ensure that it is not going again via dnsmasq).?

Should need to make any more changes to ensure optmised configuration of adguard home such as ?

Follwong the above install, when loading web pages , text seems to load first and later any photos on the pages. I have tried using only one adblock list and not using adguard security option with a view to speed up.
The resolution latency is around 20ms
without adguards pages load smoothly.
Is this delay in loading photos in webpages expected? what else could I do.

Hey everyone!

I have a question regarding backing up and restoring the leases.json file particularly with regard to persistence after sysupgrade, reboots, etc.

I have a cron job that backs up the leases.json file every 8 hours. It is all static leases only.

I want that leases.json file to be restored just prior to the adguardhome service init. As I understand it, rc.local would be too late in the process.

So I was thinking of adding it to the adguardhome init file but I just don't know exactly where.

Here is the standard adguardhome init file:

start_service() {
  config_load adguardhome
  config_get WORK_DIR config workdir

  [ -d "$WORK_DIR" ] || mkdir -m 0755 -p "$WORK_DIR"

  procd_open_instance
  procd_set_param command "$PROG" -c /etc/adguardhome.yaml -w "$WORK_DIR" --no-check-update
  procd_set_param stdout 1
  procd_set_param stderr 1
  procd_close_instance
}

Would I add it like this:

start_service() {
  cp /mnt/sda1/adguardhome/data/leases.json /etc/adguardhome/data/leases.json
  config_load adguardhome
  config_get WORK_DIR config workdir

  [ -d "$WORK_DIR" ] || mkdir -m 0755 -p "$WORK_DIR"

  procd_open_instance
  procd_set_param command "$PROG" -c /etc/adguardhome.yaml -w "$WORK_DIR" --no-check-update
  procd_set_param stdout 1
  procd_set_param stderr 1
  procd_close_instance
}

Would that work? Or would the cp command need to be used with procd_set_param command?

I am out of my element when it comes to init scripts.

Thank you.

EDIT : I ended up trying by adding that line to the init script and it worked successfully.

No problem from my end. Keep every setting simple. Post your yaml file if you can

1 Like

Just install AGH from opkg and don't try to manually update the module next time.

Hi @AlanDias17 thanks for your reply.

Could you please explain as to why this has to do with adguard working only if I also add a fallbackdns?
I suppose you tellink me this, in order to install the stable version.
But I don't think this is the answer to the latest problem I'm facing.

Adding a fallback dns = devices have internet access.
No fallback dns = no internet access.

Thank you for your time.

Are you talking about Upstream DNS server?

[/lan/]127.0.0.1:54
[//]127.0.0.1:54
[/pool.ntp.org/]1.1.1.1
[/pool.ntp.org/]1.0.0.1
[/pool.ntp.org/]8.8.8.8
[/pool.ntp.org/]8.8.4.4
https://dns.cloudflare.com/dns-query
https://dns.google/dns-query

These are the servers I use. If you don't add any then your device will have DNS unreachable issue.

No, my Upstream DNS Servers are the following.

https://dns.adguard-dns.com/dns-query
https://dns.quad9.net/dns-query
https://doh.mullvad.net/dns-query
[/lan/]127.0.0.1:5353
[//]127.0.0.1:5353
[/pool.ntp.org/]9.9.9.9

Then you have this option a little below,

Fallback DNS servers
List of fallback DNS servers used when upstream DNS servers are not responding. The syntax is the same as in the main upstreams field above.

If there I don't add for ex. 9.9.9.9 then on next update I don't have internet...
After adding this, fixes the problem...

1 Like

Bootstrap DNS servers are used to resolve IP addresses of the DoH/DoT resolvers you specify as upstreams.

Yeah these are needed in the first place. These DNS are first used to solve your Upstream DNS servers.

No I'm not talking about Bootstrap DNS but Fallback DNS.
Check the image below.

For bootstrap dns I use quad9 as usual, but until recept updates I didn't have to use also fallback dns.
Now it is like mandatory otherwise it will work without them until next update.

Very strange...

That is super weird. My AGH v0.107.36 doesn't say anything of Fallback DNS. Sorry I've no clue then :confused:

1 Like

Yeah no worries,

I suppose this is a Beta/Edge feature that maybe requires this to be used...
Anyway, thanks for your time!

I have "Fallback DNS servers" empty, and no issues like you describe...
But I use 7 different "Upstream DNS servers", it would be serious if all of them would fail...

Well the issue comes when a new version is up.

If I remove now the fallback dns, no issues with the internet.
But once a new version comes up and I install it, then if I don't add the fallback dns, I won't have internet, which is silly if you think about it, since my fallback dns are exactly the same as the upstreams...