# Adguardhome - invalid database

**URL:** <https://dietpi.com/forum/t/adguardhome-invalid-database/15786>\
**Category:** General Discussion\
**Tags:** services\
**Created:** [30 January 2023 18:53 UTC](https://dietpi.com/forum/t/adguardhome-invalid-database/15786 "2023-01-30T18:53:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Black\_Dynamit3](https://dietpi.com/forum/user_avatar/dietpi.com/black_dynamit3/32/2942_2.png) [@Black\_Dynamit3](https://dietpi.com/forum/u/Black_Dynamit3)\
**Post date:** [30 January 2023 18:53 UTC](https://dietpi.com/forum/t/adguardhome-invalid-database/15786/1 "2023-01-30T18:53:00Z")

</div>

Hello everyone !

I had adguardhome running for a long time (even across reboot) and I noticed today the service couldnt start at boot like before due to the database :

```auto
Jan 30 19:32:15 DietPi systemd[1]: adguardhome.service: Scheduled restart job, restart counter is at 4.
Jan 30 19:32:15 DietPi systemd[1]: Stopped AdGuard Home (DietPi).
Jan 30 19:32:15 DietPi systemd[1]: Started AdGuard Home (DietPi).
Jan 30 19:32:15 DietPi AdGuardHome[3114]: 2023/01/30 19:32:15.621091 [info] AdGuard Home, version v0.107.21
Jan 30 19:32:15 DietPi AdGuardHome[3114]: 2023/01/30 19:32:15.706490 [info] tls: using default ciphers
Jan 30 19:32:15 DietPi AdGuardHome[3114]: 2023/01/30 19:32:15.783215 [info] Initializing auth module: /mnt/dietpi_userdata/adguardhome/data/sessions.db
Jan 30 19:32:15 DietPi AdGuardHome[3114]: 2023/01/30 19:32:15.786372 [info] auth: initialized. users:1 sessions:2
Jan 30 19:32:15 DietPi AdGuardHome[3114]: 2023/01/30 19:32:15.790263 [info] web: initializing
Jan 30 19:32:15 DietPi AdGuardHome[3114]: 2023/01/30 19:32:15.794974 [fatal] init stats: opening database: invalid database
Jan 30 19:32:15 DietPi systemd[1]: adguardhome.service: Main process exited, code=exited, status=1/FAILURE
Jan 30 19:32:15 DietPi systemd[1]: adguardhome.service: Failed with result 'exit-code'.
Jan 30 19:32:20 DietPi systemd[1]: adguardhome.service: Scheduled restart job, restart counter is at 5.
Jan 30 19:32:20 DietPi systemd[1]: Stopped AdGuard Home (DietPi).
Jan 30 19:32:20 DietPi systemd[1]: adguardhome.service: Start request repeated too quickly.
Jan 30 19:32:20 DietPi systemd[1]: adguardhome.service: Failed with result 'exit-code'.
Jan 30 19:32:20 DietPi systemd[1]: Failed to start AdGuard Home (DietPi).

```

I didn’t change anything. Maybe the last update 8.13.2 but i can’t really remember.

What’s the best to do before reinstalling adguard ?

---

<div class="post-metadata">

**Author:** ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)\
**Post date:** [30 January 2023 19:49 UTC](https://dietpi.com/forum/t/adguardhome-invalid-database/15786/2 "2023-01-30T19:49:14Z")

</div>

> [@Black\_Dynamit3](#):
>
> `/mnt/dietpi_userdata/adguardhome/data/sessions.db`

you could try to remove that database file. It should be recreated on service start automatically.

```auto
systemctl stop adguardhome.service
mv /mnt/dietpi_userdata/adguardhome/data/sessions.db /mnt/dietpi_userdata/adguardhome/data/sessions.db.save
systemctl start adguardhome.service
journalctl -u adguardhome.service

```

---

<div class="post-metadata">

**Author:** ![Black\_Dynamit3](https://dietpi.com/forum/user_avatar/dietpi.com/black_dynamit3/32/2942_2.png) [@Black\_Dynamit3](https://dietpi.com/forum/u/Black_Dynamit3)\
**Post date:** [1 February 2023 12:06 UTC](https://dietpi.com/forum/t/adguardhome-invalid-database/15786/3 "2023-02-01T12:06:08Z")

</div>

Hello Joulinar, thanks again 🙂 !!  
I tried :

```auto
sudo rm /mnt/dietpi_userdata/adguardhome/data/sessions.db
sudo reboot

```

After reboot i still have the same issue.

Here is the actual content of the folder :

```auto
dietpi@DietPi:~$ cd /mnt/dietpi_userdata/adguardhome/data
dietpi@DietPi:/mnt/dietpi_userdata/adguardhome/data$ ls
filters querylog.json	querylog.json.1 sessions.db stats.db

```

And same message when I try to restart service :

```auto
Feb 01 12:51:07 DietPi AdGuardHome[20061]: 2023/02/01 12:51:07.931134 [info] auth: initialized. users:1 sessions:0

Feb 01 12:51:07 DietPi AdGuardHome[20061]: 2023/02/01 12:51:07.933013 [info] web: initializing

Feb 01 12:51:07 DietPi AdGuardHome[20061]: 2023/02/01 12:51:07.938118 [fatal] init stats: opening database: invalid database

Feb 01 12:51:07 DietPi systemd[1]: **adguardhome.service: Main process exited, code=exited, status=1/FAILURE**

Feb 01 12:51:07 DietPi systemd[1]: **adguardhome.service: Failed with result 'exit-code'.**

Feb 01 12:51:13 DietPi systemd[1]: adguardhome.service: Scheduled restart job, restart counter is at 5.

Feb 01 12:51:13 DietPi systemd[1]: Stopped AdGuard Home (DietPi).

Feb 01 12:51:13 DietPi systemd[1]: **adguardhome.service: Start request repeated too quickly.**

Feb 01 12:51:13 DietPi systemd[1]: **adguardhome.service: Failed with result 'exit-code'.**

Feb 01 12:51:13 DietPi systemd[1]: **Failed to start AdGuard Home (DietPi).**

```

I wonder what could be the problem i litteraly changed nothing. Im on 32 bit version if that may help. I should post something on the adguard forum maybe ?

EDIT : ok i’m a mess i forgot to also delete stats.db… Thanks Joulinar you did the trick again !!! Always a pleasure

Here’s the command to run:

```auto
sudo rm /mnt/dietpi_userdata/adguardhome/data/sessions.db
sudo rm /mnt/dietpi_userdata/adguardhome/data/stats.db
sudo systemctl restart adguardhome

```

---

<div class="post-metadata">

**Author:** ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)\
**Post date:** [1 February 2023 12:46 UTC](https://dietpi.com/forum/t/adguardhome-invalid-database/15786/4 "2023-02-01T12:46:42Z")

</div>

Thx for sharing. Good you found a solution. Honestly, I’m not sure what could lead to such data corruption. Maybe AGH guys can answer. You could have a look to kernel error messages if there is anything related to disk errors.

```auto
dmesg -l err,crit,alert,emerg

```
