Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB location is not valid, please enter correct path #30

Closed
zetneteork opened this issue Feb 11, 2019 · 24 comments
Closed

DB location is not valid, please enter correct path #30

zetneteork opened this issue Feb 11, 2019 · 24 comments

Comments

@zetneteork
Copy link

zetneteork commented Feb 11, 2019

Run:

docker run -dit \
  --restart unless-stopped \
  --name=calibre-web \
  -v /data/docker/calibre-web/config:/config \
  -v /data/docker/calibre-web/books:/books \
  -e PGID=1248 -e PUID=1248  \
  -p 8083:8083 \
  linuxserver/calibre-web

Error:

DB location is not valid, please enter correct path

ref: https://github.com/linuxserver/docker-calibre-web#setting-up-the-application

I've checked similar issue Initial setup /books error #28. It doesn't seems like file permission error, checked inside container and also outside on mounted volume.

@aptalca
Copy link
Member

aptalca commented Feb 11, 2019

What is the output of docker exec -it calibre-web ls -la /books/metadata.db while the container is running?

@zetneteork
Copy link
Author

docker exec -it calibre-web ls -la /books/metadata.db
ls: cannot access '/books/metadata.db': No such file or directory
docker exec -it calibre-web ls -lah /books
total 8.0K
drwxrwxrwx 2 root root 4.0K Feb 11 18:53 .
drwxr-xr-x 1 root root 4.0K Feb 11 18:55 ..
root@rpi3:/data/docker# docker exec -it calibre-web ls -lah /config
total 64K
docker exec -it calibre-web ls -lah /config
total 64K
drwxrwxrwx 2 root root 4.0K Feb 11 18:56 .
drwxr-xr-x 1 root root 4.0K Feb 11 18:55 ..
-rw-r--r-- 1 root root  52K Feb 11 18:56 app.db
-rw-r--r-- 1 root root  183 Feb 11 18:57 calibre-web.log

@aptalca
Copy link
Member

aptalca commented Feb 11, 2019

This app requires you to have an existing calibre database at the /books location: https://github.com/janeczku/calibre-web/blob/master/readme.md#about

@aptalca aptalca closed this as completed Feb 11, 2019
@zetneteork
Copy link
Author

@aptalca My fault, sorry

@aptalca
Copy link
Member

aptalca commented Feb 11, 2019

no worries ;) it's a common mistake and that's why I asked for the ls for the database

@gabrielruiu
Copy link

how does one generate a fresh metadata.db file ?

@tobbenb
Copy link
Member

tobbenb commented Mar 31, 2019

Using calibre.

@jmicrobe
Copy link

Is it possible to have my metadata.db file in another location, such as /mnt/library/books? I have my books in a mounted hard drive on my raspberry pi server.

@indistinctTalk
Copy link

@gabrielruiu Here's a freshly generated, empty, metadata.db.

@LivingWithHippos
Copy link

Thanks it works (related to the sadly closed janeczku/calibre-web#269).

I just want to add that uploading a book I got a permission error
Failed to update model. (OperationalError) attempt to write a readonly database

and had to change the permissions on metadata.db

chmod a+w metadata.db

(I didn' t have the patience to find out which user was needed, maybe docker:docker?)

@iot-resister
Copy link

iot-resister commented Aug 27, 2020

anyone wanna do a pr where the file is baked in?

@RicLund
Copy link

RicLund commented Oct 2, 2020

anyone wanna do a pr where the file is baked in?

Yeah that would be nice. Many new users must run into this, I did.

@aptalca
Copy link
Member

aptalca commented Oct 2, 2020

Only if upstream project supports/promotes it. Otherwise it's too hacky for my taste

@LivingWithHippos
Copy link

LivingWithHippos commented Nov 4, 2020

So today I got an idea and tried it and it kinda works, I just need some help.
I checked if calibre has a cli and indeed it has several, we can create a new, empty database via cli using calibredb.

I bash'ed into the linuxserver calibre-web container and there are all the calibre files, calibredb is under /app/calibre/bin/ so we could use docker exec to generate it.

INSTRUCTIONS

  1. bring up your new container
  2. get the container id with docker ps | grep calibre
  3. run docker exec -it CONTAINER_ID /bin/bash -c "cd /app/calibre/bin && calibredb restore_database --really-do-it --with-library /books"

ISSUES:

I had to fix my permission issues with chmod a+w metadata.db and also by using chown my_user:my_user books/ on the local /books. The first made the database usable during the setup and the second lets me upload books.

WHAT TO IMPLEMENT (my opinion):

Option 1: add a variable to the docker-compose.yml file like CREATE_NEW_DATABASE

    environment:
      - PUID=1000
      - PGID=1000
      - CREATE_NEW_DATABASE = true

add an option in the Dockerfile to check this value

if CREATE_NEW_DATABASE==true -> cd /app/calibre/bin && calibredb restore_database --really-do-it --with-library /books

EDIT: I forgot that the Dockerfile is used during builds and not when running from docker compose. It needs to be added to the startup code

Option 2: check if metadata.db exists in /books and if not create it. This way there is no need to add a variable

For option 1 and 2: Permissions: add metadata.db and /books folder permissions from the Dockerfile, I don't know about those so help me here

Option 3: edit the docker compose file adding a commented out line to remind people that this file is needed

    volumes:
      - <path to data>:/config
      # A metadata.db file in this folder is needed, then use /books as configuration path during the setup
      - <path to calibre library>:/books

Option 4:
Create a docker mod that just copies and paste and empty metadata.db file under /books and set its permissions

Pro: metadata.db is not baked into the image, if it stops working just remove the mod line from the docker-compose file
Cons: file is static, mod needs to be created and managed

Temporary alternative (not working)

We could create our own Dockerfile

FROM ghcr.io/linuxserver/calibre-web

WORKDIR /app/calibre/bin
RUN calibredb restore_database --really-do-it --with-library /books

and then use it in our docker-compose.yml

---
version: "2.1"
services:
  calibre-web:
    build: .
    container_name: calibre-web
    environment:
      - PUID=1000
      ...

build . will run our Dockerfile. The problem is that it does not work since calibre is not available in the container under /app when this gets called. Only calibre-web is available. That's normal since the original Dockerfile does not git it. I don't know where it is coming from in the final container at this point (edit: may be coming from the mod)

@LivingWithHippos
Copy link

LivingWithHippos commented Nov 4, 2020

After some tests I have a working and acceptable solution, but not integrated with the image. Since linuxserver.io allows us to run scripts when the container starts, we can just do that.

  1. create a custom-cont-init.d folder under the config folder on your machine, the one you'll mount on the container under /config
  2. add this script inside it with any name such as metadata_generator.sh
#!/bin/bash

FILE=/books/metadata.db
PUID=1000
PGID=1000

if test -f "$FILE"; then
    echo "$FILE already exists, skipping generation."
else
    echo "$FILE does not exists, generating..."
    cd /app/calibre/bin
    calibredb restore_database --really-do-it --with-library /books
    echo "$FILE created, setting permissions..."
    chmod a+w $FILE
    # this is needed for uploads, you can remove it if you don't want to allow uploads
    chown $PUID:$PGID /books
    echo "Permissions fixed, use /books as library path"
fi
  1. ????
  2. profit

The script is run at every container start but it's so small I wouldn't even remove it. calibredb also creates a copy of metadata.db before overwriting it so if there is an issue with it you can recover it (once)

@mfw78
Copy link

mfw78 commented Jan 9, 2021

For those that have come across this issue when deploying on Kubernetes, it may be simpler to use an initContainer to facilitate the creation of the database. The way I solved the problem was:

  1. Create a blank database from the latest version of Calibre
  2. Compress the database with GZIP
  3. Base64 encode the compressed database to reduce filesize in the manifests (compresses from around 380kb down to 14kb).
  4. Adapt the shell script from @LivingWithHippos for use in an initContainer as follows:
      initContainers:
        - name: {{ .Chart.Name}}-init
          image: "alpine:3.12"
          env:
{{ toYaml .Values.env | indent 12 }}
          volumeMounts:
            - name: books
              mountPath: "/books"
          command: [ "sh", "-c" ]
          args:
            - |
              FILE=/books/metadata.db

              if test -f "$FILE"; then
                  echo "$FILE already exists, skipping generation."
              else
                  echo "$FILE does not exists, generating..."
                  echo 'H4sICI8M+V8CA21ldGFkYXRhLmRiAOzcW2wbV3rAcVIXUqYvjJMoE9vJeixvInEl2aJl2VYc7y7NMLJiWUpkKo4bBOyIHEkTkRyFM5TtuG4h2Wnz0BZ9ah9aoO1DH7pPCyzaoi26C7RPfVigaIt2UaAvi6ILFAGKAouixT60Z2Z4mSGHoi4u6kz+v1gU+Z25nPOdMxdqZnL7vTnNVOUVvVJSTHky9FwoHA59W5ZDodBh8ZMPNW2Inz7X57D4eTm0s8Ohczd/o1+8ORT/O+uzEv9Z/D/j/xH/Iv6T+I/j/xz/kRMGAAAAAAB79/O/JF5y98TL7aJ4SX8gXq7fEC+ptHgZnRYvg2fFy/Pxo9bkz5ExAAAAAACCLMb3fwAAAAAAAo/r/wAAAAAA8P0fAAAAAADw/R8AAAAAADz7eP4fAAAAAIDg4/o/AAAAAADBx/V/AAAAAACCj+v/AAAAAAAEH9f/AQAAAAAIPq7/AwAAAAAQfFz/BwAAAAAg+Lj+DwAAAABA8HH9HwAAAACA4OP6PwAAAAAAwcf1fwAAAAAAgu9o/L9C8dD3Qscexv869r2YMvCXsVci/zTwoP/X+t/p/aL393tmenpE8UYoKf6zDDyI/OEB1idWlz5glbfn4lHp/Pnwkx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515CSxM3x0exjvpE/yo1DRp8AlMqnzOZqRZN/8kzsujdta3kHPYlBu5m+R3uiF2e3gMOnTX0CQezxSYfJH1TNzDuYQpoblMj/bmZk0xaHcL3NiS7GsJDNvvy0f8WbI5w2QXy7htxOwq0qazD/8fJUKGqwAwBgA=' | base64 -d | gzip -d - > $FILE
                  echo "$FILE created, setting permissions..."
                  chmod a+w $FILE
                  # this is needed for uploads, you can remove it if you don't want to allow uploads
                  chown $PUID:$PGID /books
                  echo "Permissions fixed, use /books as library path"
              fi

Note: From my understanding, the compressed line must not have any line breaks which unfortunately reduces the readability, however placing line breaks will cause corruption. Additionally, the environmental variables used in the shell script for the initContainer are declared in a Helm chart that I wrote, otherwise you would have to explicitly declare the environment variables in the initContainer spec.

Warning: The database schema above is created using Calibre 5.9.0. Database schema changes will render the aforementioned invalid. To create a new base64 encoded database:

cd name-of-directory-containing-calibre-library
gzip -c9 metadata.db | base64 > compressed-base64-encoded.db

The file compressed-base64-encoded.db will contain the string that would be inserted in the echo statement in the initContainer.

Hope this helps people!

@Kanon1982
Copy link

@gabrielruiu Here's a freshly generated, empty, metadata.db.
#Thanks...Guy

@hhinde
Copy link

hhinde commented May 24, 2022

I'm still stumped on this issue. I have created a new metadata.db with calibre and changed the permissions and calibre-web still tells me DB Location is not Valid.

@unix0r
Copy link

unix0r commented May 29, 2022

I'm still stumped on this issue. I have created a new metadata.db with calibre and changed the permissions and calibre-web still tells me DB Location is not Valid.

For me, the generated metadata.db did not have read permissions after creating it with calibredb.

Get the correct PUID and PGID of a user with sufficient permissions for the provided /config and /books folders (not 1000).
You can also try to correct the owner and group from within the container of /books to the correct PUID etc. and check the read and write permissions of the database.

@ThePrankMonkey
Copy link

Hey, I've been having this issue and was able to resolve it by ensuring the full path from my data storage to the metadata.db was appropriate. I ended up using 755 and it worked. I'd have thought that 644 was enough to read/write to the DB file, but I guess not. You might also want to ensure that your user:group has rights to the full path.

ItsASine added a commit to ItsASine/fluffy-octo-spork that referenced this issue Dec 21, 2022
@tikg
Copy link

tikg commented Jan 4, 2023

Sorry for this crude fix in advance, but here's my quick one

metadata.db (calibre-web) fix on CapRover

Download this fresh metadata.db file on your host. Credits to iJebus
Create /books folder on your container and chmod

docker exec -it CONTAINER_ID mkdir /books
docker exec -it CONTAINER_ID chmod a+w /books

Place the metadata.db file on the /books path and modifty to be writeable

docker cp /path/METADATA.DB.FILE CONTAINER_ID:/books/
docker exec -it CONTAINER_ID chmod a+w /books/METADATA.DB.FILE

Verify

docker exec -it CONTAINER_ID ls -lah /books

Use /books/ as Location and Click save. Worked like a charm for me!
image

@Janokisu
Copy link

You can download a fresh metadata.db file from the main project

@jojo-gfx
Copy link

Have also found it in e.g. Runtipi and would think also other one-click-platforms have this failure. For not linuxers it leads to 100% to a non usable app. :(
It is absolutely necessary to have the db available after install and also the correct path preconfigured.

@AngryJKirk

This comment was marked as off-topic.

@linuxserver linuxserver locked as off-topic and limited conversation to collaborators Dec 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests