You have disk space spare? df -h and check how much space you have left.
/opt/AdGuardHome/data check this folder and see how much is used there.
There was a bug with reloading the stats db (it would cause massive cpu usage reloading the database). Delete or rename everything in the /opt/AdGuardHome/data folder after stopping AGH. Then restart AGH and see if your cpu usage returns to normal.
So just for fun, I've attached an old $5 Pi Zero in ethernet gadget mode to my OpenWRT router's USB2 port, which provides both a USB ethernet NIC to the router and a client NIC to the Zero itself. The idea is that the Zero runs Adguard Home on its own CPU with its own memory and storage, which means that:
A) it does not consume those resources from the router, and
B) it survives a router upgrade without getting wiped or even affected
And it works brilliantly; I've even got the router host set to hand out the Zero's address for DNS, which in turn delegates resolution of the local domain back to the router: which means I cut out the middleman for most domains and it doesn't fork dnsmasq on every request.
So far the only problem is that they share a common uptime: if I reboot the Zero/Adguard gadget, the OpenWRT/router host doesn't reliably reinitialize the USB pseudo-NIC host when it comes back, and the only way out of it is to reboot the router. This is probably okay, because neiether of these platforms ever crashes, but it'd be nice to be able to reboot the Zero without rebooting the router.
[Edit: This is working fine now. The problem was I'd unset "Force link" on the host interface. It seems to work better with this checked.]
check your disk space. You may have run out and updated filters have not been downloaded.
Then restart AGH so it reloads its filters.
currently AGH uses 35mb of space for its binary. It then will use space for its query logs and database. Query logging is currently using 45mb of space on my router. Current log rotation setup means you will need double that space so 35mb x 2 (for AGH binary and its backup when it upgrades) and log space x2.
AGH also will crash with error messages once it it out of diskspace. Keeping an eye on your free diskspace is crucial. Once you have AGH up and running after an upgrade you can delete the /opt/AdGuardHome/agh-backup folder contents.
If you run out of space entirely?
Now delete the /opt/AdGuardHome/agh-backup contents. (this is your previous AGH binary and setup files. Copy it to your pc if you want but its safe to delete all of this)
The /opt/AdGuardHome/data folder contains the following.
root@OpenWrt:/opt/AdGuardHome/data# ll -h
drwxr-xr-x 3 root root 512 Oct 29 09:42 ./
drwxrwxrwx 4 root root 736 Oct 30 09:06 ../
drwxr-xr-x 2 root root 800 Nov 2 09:52 filters/
-rw-r--r-- 1 root root 45.4M Nov 2 20:42 querylog.json
-rw-r--r-- 1 root root 8.9M Oct 29 09:00 querylog.json.1
-rw-r--r-- 1 root root 32.0K Oct 30 05:28 sessions.db
-rw-r--r-- 1 root root 4.0M Nov 2 21:00 stats.db
Delete the querylog files. These are your DNS queries.
sessions.db are connections to AGH currently. This can be deleted as well
stats.db you can purge but you will lose your statistics data.
filters folder contains all your filter downloads. Purge if it is full but it will re-download your filters. If your filters are too large for your diskspace you will have to disable large filters and restrict their usage.
I suggest you purge the filters folder to force AGH to redownload good filters and start filtering again.
Now /etc/init.d/AdGuardHome start
Then logread -f and watch AGH start back up and watch for errors. Once it is fully loaded you can control C and exit your SSH session.
I haven't tried to be thorough about supporting topics like configuring AdGuard Home or writing an operating system to an SD card: these are separate issues and well-documented elsewhere. Mostly I've stuck to the parts that are distinctive about this application.
-c, --config VALUE Path to the config file.
-w, --work-dir VALUE Path to the working directory.
I suspect that will mean the data folder (and thus the filters folder below it) will end up on the /tmp.
Maybe someway to have configs for all of them? so keep stats and filters but logins and queries are /tmp and discarded?
Maybe worth filling an issue on AGH page to ask for it?
I pointed out on my filesystem checks bug i filed with them that some routers have limited space (it doesn't check for freespace before installing updates which is kinda bad)
cmd="/opt/AdGuardHome/AdGuardHome "-s" "run""
So adding in the working directory there should tweak things. Don't forget to reference the config file as well!
(edit 2) so having thought about this for bit. I think you would have to write some sort of script that would copy/dump the files you want saving to a folder and when you reboot it copies them to the /tmp folders in preperation for AGH starting (to prepopulate the filters and to restore the stats db if u wanted it kept) However if u willing to just dump it all on reboot. then redirecting the working folder to /tmp would work fine. Functionally wise AGH works. What we are asking for is modifications for limited router space issues. Thats most likely going to end up as a low priority feature request. My disk space checks for instance are aimed at the next point release. see here : https://github.com/AdguardTeam/AdGuardHome/issues/3801
That reminds me. i did write up my upgrade script but i posted it on the other thread. I've copied it here now as well.
Limited space routers.
AGH binary takes up 35mb and during its update it will download the new binary compressed, backup your old binary and then extract and replace the old binary with the new one. This means you require 35mb x2 and the compressed file space and extraction space.
To manually do this, do an upgrade from the control panel and look for what version it wants to upgrade to in your syslog. Make sure you use the version you installed. Don't blindly copy my config
AdGuardHome: 2021/11/10 16:03:30.149784 [info] Updating from v0.107.0-a.199+2fc10848 to v0.107.0-a.203+6fd9e72f. URL:https://static.adguard.com/adguardhome/edge/AdGuardHome_linux_mips_softfloat.tar.gz
SSH into your router and stop AGH.
download the new version to your routers /tmp area or to your laptop/pc. Then either unpack AGH binary from the compressed download over the existing binary or unpack the binary on your laptop/pc and copy it over the existing binary using something like WinSCP or equivalent.
Now restart AGH.
(Edit) commands to do this below.
#Grab updated AGH from server and save to /tmp
wget https://static.adguard.com/adguardhome/edge/AdGuardHome_linux_mips_softfloat.tar.gz -P /tmp
#unzip updated file over top of AGH in /opt
tar x -vzf /tmp/AdGuardHome_linux_mips_softfloat.tar.gz -C /opt
Just a heads up to everyone using AdGuardHome on OpenWRT on an issue I experienced a few days. I don't recall it being shared before in this topic or on AdGuardHome's GitHub page.
I had an issue the last few days where AGH would consume all available memory until the OOM killer stopped it. I was running on the most recent beta version on request of an issue I reported on AdGuardHome in GitHub's issue tracker. At first I thought there's a bug in the beta version so I rolled back to 2 previous versions (one was the stable release) and the problem persisted: start AGH, the web interface loaded but was continuously loading the dashboard, CPU usage and memory usage on OpenWRT kept on growing until the OOM killer did it's job. I also suspected a faulty USB stick that I use to run and store AGH query log's.
In the end it turned out to be a problem in a large DNS blocklist I used. I don't know what the problem was, the file itself is around 93MB on disk and head and tail seemed fine. I disabled that blocklist and AGH was running fine again. I emptied the contents ( > $ADGUARDHOME/data/filters/5.txt) and forced an update via AGH web interface and all was well again.
So, in case AGH goes berserk and you can't find an obvious reason, disable DNS blocklists to quick check that.