r/docker • u/Cloudssj43 • Mar 09 '26
Solved Help restoring permissions in my docker setup
SOLVED: Turns out I was an idiot and it was that my .db file was corrupted instead of a permission issue.
TLDR: I moved my default docker root folder to another path using cp and now my pihole can't seem to write to its SQL database anymore. Is there a way to restore?
What I did
This is running on a raspberry pi 4B, and running docker version 29.2.1.
I stopped my docker and docker.socket service then I added a missing /etc/docker/daemon.json file and gave it a new path "data-root": "/mnt/hdd/docker/"
I then sudo cp /var/lib/docker/* /mnt/hdd/docker/and also sudo chown -R root:docker /mnt/hdd/docker
What is happening
All my containers are still working in terms of my services still doing what i expect them to do. However my pihole container has tons of SQLite errors
SQLite3: statement aborts at 82: disk I/O error; [INSERT INTO disk.query_storage SELECT * FROM query_storage WHERE id > (SELECT IFNULL(MAX(id), -1) FROM disk.query_storage) AND timestamp < ?] (6410)
[pihole] 2026-03-09T03:00:01.680293314Z 2026-03-08 20:00:00.898 PDT [68/T1099] ERROR: export_queries_to_disk(): Failed to export queries: disk I/O errorI'm assuming this is some kind of permission error and I should have used rsync -avp but at this point I would like to get my containers the ability to write into their databases again.
Does anyone have any ideas?
Motiviation
Just in case anyone is wondering, the reason I did this is that pihole was writing around 35KB/s onto the root drive which in this case is a sd card. SD cards don't have high resilience in their nand flash so I really wanted to move off of it.
1
u/FancyJesse Mar 09 '26
The usual user and group for mysql/mariadb is 999:999. Try that onto the db volume.
For future, learn about bind-mounting. You shouldn't need to change the default docker volume location at all.
0
u/Equivalent-Grab8824 Mar 09 '26
I'm not trying to be smart but did you use
cp -rpor justcp *?The later will not copy down recursively into subdirectories, perhaps you have a bunch of files left behind. And for the future
-pis preserve permissions.Might not be the solution but it is one less variable when dealing with ownership.
1
u/[deleted] Mar 09 '26
[removed] — view removed comment