Closed bphenriques closed 4 months ago
Ok, noticed taht the stacktrace points to line 20: https://github.com/sissbruecker/linkding/blob/master/bookmarks/management/commands/backup.py#L20
~Perhaps the error occurs because there is no file which is expected as we are in the process of creating a new one?~ looked online and the API creates a new file allegedly
Found the error, The /etc/linkding
folder (the default path for backups) is always owned by the root
inside the container. However, for users that are not running the docker as root, we should actually have permissions to the /etc/linkding/data
as part of the volume mounting process.
Having that said the following commands are now working:
$ docker exec -it linkding python manage.py backup /etc/linkding/data/backup.sqlite3
Copied 50 of 74 pages...
Copied 74 of 74 pages...
Backup created at /etc/linkding/data/backup.sqlite3
$ docker cp linkding:/etc/linkding/data/backup.sqlite3 "${target_dir}/linkding/backup.sqlite3"
Successfully copied 305kB to /tmp/tmp.uBybe7ECaH.restic-backup/linkding/backup.sqlite3
Suggestion: add a note to the documentation for users running docker without root
Hello,
Short
I am facing a
sqlite3.OperationalError: unable to open database file
error when running:I have followed the official guide. I thought it was permissions problem but does not seem to be the case. See below the longer response.
Longer
I have a local environment where I am testing a backup solution using
docker-compose.yml
:And I created the script that boils down to
docker exec -u "${PUID}:${PGID}" -it linkding python manage.py backup backup.sqlite3
.PUID
andPGID
prints to 1000 and 100, respectively.Leading to:
My first impressions were permissions issues, but then I added the
-u
flag to be consistent with thedocker-compose.yml
file with no success. I then entered the container and checked permissions and it seems fine:On the container:
On my host:
Thank you :bow:
Edit: for this local test environment I added a single bookmark so there is something in the db.