# Script: Update AdGuard Home

**URL:** <https://forum.gl-inet.com/t/script-update-adguard-home/39398>\
**Category:** Router\
**Tags:** KB\
**Created:** [March 6, 2024, 9:05am UTC](https://forum.gl-inet.com/t/script-update-adguard-home/39398 "2024-03-06T09:05:47Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![admon](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/admon/32/32880_2.png) [@admon](https://forum.gl-inet.com/u/admon)\
**Post date:** [March 6, 2024, 9:05am UTC](https://forum.gl-inet.com/t/script-update-adguard-home/39398/1 "2024-03-06T09:05:47Z")

</div>

Hi there 👋

some people wonder how to update the AdGuard Home version on devices like the Flint or Flint2. For your convenience, I created a script to automate this process. **Make sure to read and understand this post before you go on!**

## Permanent feature

I added the option to make all changes permanent. The script therefore only needs to be executed once, the effects are then permanent. Even across firmware updates. On the downside, it _might_ create trouble when you flash a way older firmware.

If everything fails, [flashing using Uboot will fix it](https://docs.gl-inet.com/router/en/4/faq/debrick/).

## Dependencies

Currently, the update-process is only supported on devices using ARM64 or ARMv7 architecture.  
This should affect most routers like the Flint or Flint2. If you are not sure about the architecture, you can run `uname -m` to get the current one. It should say _aarch64_ or _armv7l_ to be able to run my script.

I added some checks in my script as well, so it _should_ be pretty safe to run. 🤞

## Download

You can find it in my repo located on GitHub:

> **[GitHub - admonstrator/glinet-adguard-updater: Enables and automates ACME (Let’s...](https://github.com/Admonstrator/glinet-adguard-updater)**
>
> Enables and automates ACME (Let’s Encrypt-compatible) certificate issuance and renewal on GL.iNet (OpenWrt-based) routers via a simple shell script.

## Quick run without downloading

You can run it without cloning the repository by using the following command:

```auto
wget -O update-adguardhome.sh https://get.admon.me/adguard && sh update-adguardhome.sh

```

## Running on devices with low free space

You can use `--ignore-free-space` to ignore the free space check. This is useful for devices with low free space like the AXT1800.

In that case, there will be no backup of the original files and the script will not check if there is enough free space to download the new files. Could potentially break your router if there is not enough free space.

## Enabling query logging

By default, AdGuard Home is not able to save the query log to a file. This is to prevent running out of space on the router and prevent wearing out the flash memory. This script can enable query logging to file by setting the `querylog` option in the AdGuard Home configuration file. You will asked if you want to enable query logging after the update.

If you want to enable query logging to file without updating AdGuard Home, you can run the following command:

```shell

sed -i '/^querylog:/,/^[^]/ s/^ file_enabled: .*/ file_enabled: true/' /etc/AdGuardHome/config.yaml

/etc/init.d/adguardhome restart

```

For disabling query logging to file, you can run the following command:

```shell

sed -i '/^querylog:/,/^[^]/ s/^ file_enabled: .*/ file_enabled: false/' /etc/AdGuardHome/config.yaml

/etc/init.d/adguardhome restart

```

## Selecting a release

By default, the script will install the latest stable release of AdGuard Home. You can use `--select-release` to select a specific release. The script will ask you which release you want to install.

## Disclaimer

This script is provided as is and without any warranty. Use it at your own risk.

**It may break your router, your computer, your network or anything else.  
It may even burn down your house 🔥 You have been warned!**

## Reverting

Since AdGuard Home is deeply integrated into the firmware, it is difficult to revert the changes. Right now there is no automatic way to revert them. Resetting the router to factory settings will **NOT** revert the changes if you choose to make the installation persistent!

How to revert the changes manually by SSH:

1. Remove the line `/usr/bin/enable-adguardhome-update-check` from `/etc/rc.local`.

2. Execute `rm /usr/bin/enable-adguardhome-update-check` to remove the script.

3. Remove the following lines from `/etc/sysupgrade.conf`:

4. Stop the AdGuard Home service by executing `/etc/init.d/adguardhome stop`.

5. Reset the AdGuard Home configuration by executing `rm -rf /etc/AdGuardHome` - this will remove all your settings and blocklists!

6. Start the AdGuard Home service by executing `/etc/init.d/adguardhome start`.

A backup of the original files is located in the `/root/` folder. The backup is named `AdGuardHome_backup.tar.gz`.

If you still encounter issues after doing these steps, you can reset AdGuard Home to its original state by flashing the firmware again.

---

<div class="post-metadata">

**Author:** ![admon](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/admon/32/32880_2.png) [@admon](https://forum.gl-inet.com/u/admon)\
**Post date:** [March 6, 2024, 11:19am UTC](https://forum.gl-inet.com/t/script-update-adguard-home/39398/2 "2024-03-06T11:19:16Z")

</div>

@slesar Maybe you want to give it a try? 😉

---

<div class="post-metadata">

**Author:** ![japa182](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@japa182](https://forum.gl-inet.com/u/japa182)\
**Post date:** [March 6, 2024, 11:57am UTC](https://forum.gl-inet.com/t/script-update-adguard-home/39398/3 "2024-03-06T11:57:41Z")

</div>

Does this procedure survive after updating the firmware?

---

<div class="post-metadata">

**Author:** ![admon](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/admon/32/32880_2.png) [@admon](https://forum.gl-inet.com/u/admon)\
**Post date:** [March 6, 2024, 11:57am UTC](https://forum.gl-inet.com/t/script-update-adguard-home/39398/4 "2024-03-06T11:57:53Z")

</div>

Yep, that's why I created it.

> [@admon](#):
>
> ## Permanent feature
> 
> I added the option to make all changes permanent. The script therefore only needs to be executed once, the effects are then permanent. Even across firmware updates. On the downside, it _might_ create trouble when you flash a way older firmware.
> 
> If everything fails, [flashing using Uboot will fix it](https://docs.gl-inet.com/router/en/4/faq/debrick/).

---

<div class="post-metadata">

**Author:** ![japa182](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@japa182](https://forum.gl-inet.com/u/japa182)\
**Post date:** [March 6, 2024, 12:00pm UTC](https://forum.gl-inet.com/t/script-update-adguard-home/39398/5 "2024-03-06T12:00:53Z")

</div>

Cool, I’ll be testing it here and giving feedback, the tailscale script works fine here on the MT6000, I saw that you have another one from Acme, do you have a post on how to use it?

---

<div class="post-metadata">

**Author:** ![admon](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/admon/32/32880_2.png) [@admon](https://forum.gl-inet.com/u/admon)\
**Post date:** [March 6, 2024, 12:02pm UTC](https://forum.gl-inet.com/t/script-update-adguard-home/39398/6 "2024-03-06T12:02:03Z")

</div>

> [@japa182](#):
>
> I saw that you have another one from Acme, do you have a post on how to use it?

Na, this one is pretty useless so far because I did not implement renewal of certificates (yet).  
I'll make a post about it as soon as it's ready for testing.

All of my scripts do have readme.md where everything is written down. [Same for the acme one](https://github.com/Admonstrator/glinet.forum/tree/main/scripts/enable-acme).

@japa182 or here:

> [@Is there a way to get a letsencrypt certificate for the factory DDNS on the MT6000?](https://forum.gl-inet.com/t/is-there-a-way-to-get-a-letsencrypt-certificate-for-the-factory-ddns-on-the-mt6000/36541/4):
>
> Well, the first answer is: It’s not possible - without manually hassle - to use LE with DDNS. The retrospective answer is: I’ve spent the last 3 hours writing a script that does exactly this job. It even works - to my own surprise. BUT: It’s really a dirty, first version of a script that has the potential to kill the entire router. I would not recommend anyone to run it - unless you have backups. It does not support renewing LE certs now, but I’ll add this feature in a few weeks. As I had no …

---

<div class="post-metadata">

**Author:** ![DUSTY](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/d/a183cd/32.png) [@DUSTY](https://forum.gl-inet.com/u/DUSTY)\
**Post date:** [March 6, 2024, 12:12pm UTC](https://forum.gl-inet.com/t/script-update-adguard-home/39398/7 "2024-03-06T12:12:25Z")

</div>

Can anyone post a video of how to do this update for newbe like me.

---

<div class="post-metadata">

**Author:** ![slesar](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/slesar/32/13581_2.png) [@slesar](https://forum.gl-inet.com/u/slesar)\
**Post date:** [March 6, 2024, 12:49pm UTC](https://forum.gl-inet.com/t/script-update-adguard-home/39398/8 "2024-03-06T12:49:38Z")

</div>

> [@DUSTY](#):
>
> Can anyone post a video of how to do this update for newbe like me

You need learn how to use shh console then follow guide 1st post.  
@admon maybe add paragraph about how to use shh with link? 🤔

I will do test after my work. Thanks for scripting. I recommend first backup “config.yaml” which saved setting for adguard home IP addresses and block list filters. Make sure last line has different version “scheme number”.

---

<div class="post-metadata">

**Author:** ![admon](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/admon/32/32880_2.png) [@admon](https://forum.gl-inet.com/u/admon)\
**Post date:** [March 6, 2024, 4:18pm UTC](https://forum.gl-inet.com/t/script-update-adguard-home/39398/9 "2024-03-06T16:18:26Z")

</div>

> [@slesar](#):
>
> I will do test after my work. Thanks for scripting. I recommend first backup “config.yaml” which saved setting for adguard home IP addresses and block list filters.

I am curious about your result.  
Backing up those files is already integrated. They will be backed up to `/root/AdGuardHome_Backup.tar.gz`

---

<div class="post-metadata">

**Author:** ![slesar](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/slesar/32/13581_2.png) [@slesar](https://forum.gl-inet.com/u/slesar)\
**Post date:** [March 6, 2024, 8:09pm UTC](https://forum.gl-inet.com/t/script-update-adguard-home/39398/10 "2024-03-06T20:09:40Z")

</div>

I tested and did not update the latest version of Adguard Home.  
Result console:

 ![image](https://forum-static.gl-inet.com/original/3X/8/d/8da25fbfed6b84a91e83a2949a90f670bfea8d5f.png)  
Still showing available to update:  
 ![image](https://forum-static.gl-inet.com/original/3X/1/1/11074046dcb6980b5753684b7efa14183eb7094e.png)

---

<div class="post-metadata">

**Author:** ![admon](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/admon/32/32880_2.png) [@admon](https://forum.gl-inet.com/u/admon)\
**Post date:** [March 6, 2024, 8:24pm UTC](https://forum.gl-inet.com/t/script-update-adguard-home/39398/11 "2024-03-06T20:24:44Z")

</div>

May you reboot your router once?

---

<div class="post-metadata">

**Author:** ![slesar](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/slesar/32/13581_2.png) [@slesar](https://forum.gl-inet.com/u/slesar)\
**Post date:** [March 6, 2024, 8:27pm UTC](https://forum.gl-inet.com/t/script-update-adguard-home/39398/12 "2024-03-06T20:27:27Z")

</div>

I did not reboot router 😅

 ![Screenshot_2024-03-06-20-25-56-932_xyz.goodcloud.glinet](https://forum-static.gl-inet.com/original/3X/8/5/851f4e06b8952112a82e5aca8c3233b8f3c09290.jpeg)  
22 days 🤯  
I don’t think to reboot. Let me try manual switch off adguard home in gl ui.

---

<div class="post-metadata">

**Author:** ![slesar](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/slesar/32/13581_2.png) [@slesar](https://forum.gl-inet.com/u/slesar)\
**Post date:** [March 6, 2024, 8:34pm UTC](https://forum.gl-inet.com/t/script-update-adguard-home/39398/13 "2024-03-06T20:34:10Z")

</div>

Yes, the manual does work. Toggle “Enable Adgaurd Home” then Apply.  
 ![image](https://forum-static.gl-inet.com/original/3X/b/d/bd63e11af5c6fecca0ff3bc69d53ab5108d0e494.png)  
So one script does not stop service Adguard Home

---

<div class="post-metadata">

**Author:** ![admon](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/admon/32/32880_2.png) [@admon](https://forum.gl-inet.com/u/admon)\
**Post date:** [March 7, 2024, 8:25am UTC](https://forum.gl-inet.com/t/script-update-adguard-home/39398/14 "2024-03-07T08:25:26Z")

</div>

Thanks, I added a command to make sure that AGH is killed for real now.

---

<div class="post-metadata">

**Author:** ![admon](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/admon/32/32880_2.png) [@admon](https://forum.gl-inet.com/u/admon)\
**Post date:** [March 14, 2024, 9:49am UTC](https://forum.gl-inet.com/t/script-update-adguard-home/39398/15 "2024-03-14T09:49:41Z")

</div>

12 posts were split to a new topic: [AdGuard Home - Upstream servers not reachable](https://forum.gl-inet.com/t/adguard-home-upstream-servers-not-reachable/39775)

---

<div class="post-metadata">

**Author:** ![spragues](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/s/71e660/32.png) [@spragues](https://forum.gl-inet.com/u/spragues)\
**Post date:** [March 13, 2024, 4:10pm UTC](https://forum.gl-inet.com/t/script-update-adguard-home/39398/16 "2024-03-13T16:10:15Z")

</div>

Tip of the hat to ya @admon. Works like a charm! I’m using a GL-MT2500.

---

<div class="post-metadata">

**Author:** ![fabjan](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/f/b2d939/32.png) [@fabjan](https://forum.gl-inet.com/u/fabjan)\
**Post date:** [March 13, 2024, 7:11pm UTC](https://forum.gl-inet.com/t/script-update-adguard-home/39398/23 "2024-03-13T19:11:59Z")

</div>

Hi, thanks for your work @admon. It worked on my GL-MT3000.

---

<div class="post-metadata">

**Author:** ![Renato](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/r/858c86/32.png) [@Renato](https://forum.gl-inet.com/u/Renato)\
**Post date:** [March 15, 2024, 1:11pm UTC](https://forum.gl-inet.com/t/script-update-adguard-home/39398/24 "2024-03-15T13:11:20Z")

</div>

The script worked well also on Brume2, thanks @admon

How the embedded softwares are handled by GL-inet?  
I mean, I noticed ADGuard on Brume2 was from March/2023. One year old.  
Since then, many [security updates](https://adguard.com/en/versions/home/release.html) were released, but none of them were applied by GL-inet?

---

<div class="post-metadata">

**Author:** ![admon](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/admon/32/32880_2.png) [@admon](https://forum.gl-inet.com/u/admon)\
**Post date:** [March 15, 2024, 1:23pm UTC](https://forum.gl-inet.com/t/script-update-adguard-home/39398/25 "2024-03-15T13:23:35Z")

</div>

> [@Renato](#):
>
> How the embedded softwares are handled by GL-inet?

The answer is: Not very well.

---

<div class="post-metadata">

**Author:** ![Renato](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/r/858c86/32.png) [@Renato](https://forum.gl-inet.com/u/Renato)\
**Post date:** [March 15, 2024, 1:34pm UTC](https://forum.gl-inet.com/t/script-update-adguard-home/39398/26 "2024-03-15T13:34:57Z")

</div>

> [@admon](#):
>
> The answer is: Not very well.

They should learn with you how to do, because it's a really concern to have many softwares out-of-date with no security patches applied.

If they don't like to update absolutely nothing, they should give an easy solution for all customers do that by themselves.

[Next page](https://forum.gl-inet.com/t/script-update-adguard-home/39398.md?page=2)
