[GH-ISSUE #1118] SQLITE_CANTOPEN: unable to open database file / RPI 4 #921

Closed
opened 2026-02-26 06:34:58 +03:00 by kerem · 10 comments
Owner

Originally created by @Karatekid2407 on GitHub (May 23, 2021).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1118

Checklist

  • Have you pulled and found the error with jc21/nginx-proxy-manager:latest docker image?
    • Yes / No
  • Are you sure you're not using someone else's docker image?
    • Yes / No
  • Have you searched for similar issues (both open and closed)?
    • Yes / No

Describe the bug

With option DB_SQLITE_FILE enabled the system gets a failure and the Login got Bad Gateway.

[5/23/2021] [7:48:28 PM] [Global ] › ✖ error SQLITE_CANTOPEN: unable to open database file

Nginx Proxy Manager Version

2.9.3

To Reproduce

Docker-Compose

    container_name: Proxy-Manager
    image: jc21/nginx-proxy-manager:latest
    restart: always
    environment:
        - DB_SQLITE_FILE="/data/npm.sqlite"
    volumes:
        - ./data:/data
        - ./letsencrypt:/etc/letsencrypt
    networks:
        internal:
            ipv4_address: XXX.XXX.XXX.7
        br0:
            ipv4_address: XXX.XXX.XXX.9
    ports:
        - 443:443
        - 80:80
        - 81:81

Expected behavior

System should work.

Operating System

Raspberry PI 4 8GB

Additional context

I was reading for hours now but don't find a solution which is working for me.
Coming from jlesage/nginx-proxy-manager but is not working on RPI.

I don't want a additional DB externally.

Originally created by @Karatekid2407 on GitHub (May 23, 2021). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1118 <!-- Are you in the right place? - If you are looking for support on how to get your upstream server forwarding, please consider asking the community on Reddit. - If you are writing code changes to contribute and need to ask about the internals of the software, Gitter is the best place to ask. - If you think you found a bug with NPM (not Nginx, or your upstream server or MySql) then you are in the *right place.* --> **Checklist** - Have you pulled and found the error with `jc21/nginx-proxy-manager:latest` docker image? - **Yes** / No - Are you sure you're not using someone else's docker image? - **Yes** / No - Have you searched for similar issues (both open and closed)? - **Yes** / No **Describe the bug** <!-- A clear and concise description of what the bug is. --> With option DB_SQLITE_FILE enabled the system gets a failure and the Login got Bad Gateway. [5/23/2021] [7:48:28 PM] [Global ] › ✖ error SQLITE_CANTOPEN: unable to open database file **Nginx Proxy Manager Version** <!-- What version of Nginx Proxy Manager is reported on the login page? --> 2.9.3 **To Reproduce** Docker-Compose container_name: Proxy-Manager image: jc21/nginx-proxy-manager:latest restart: always environment: - DB_SQLITE_FILE="/data/npm.sqlite" volumes: - ./data:/data - ./letsencrypt:/etc/letsencrypt networks: internal: ipv4_address: XXX.XXX.XXX.7 br0: ipv4_address: XXX.XXX.XXX.9 ports: - 443:443 - 80:80 - 81:81 **Expected behavior** <!-- A clear and concise description of what you expected to happen. --> System should work. **Operating System** <!-- Please specify if using a Rpi, Mac, orchestration tool or any other setups that might affect the reproduction of this error. --> Raspberry PI 4 8GB **Additional context** <!-- Add any other context about the problem here, docker version, browser version, logs if applicable to the problem. Too much info is better than too little. --> I was reading for hours now but don't find a solution which is working for me. Coming from jlesage/nginx-proxy-manager but is not working on RPI. I don't want a additional DB externally.
kerem 2026-02-26 06:34:58 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@dberrocal-git commented on GitHub (May 23, 2021):

I have a similar problem, I updated a few days ago to the latest version of nginx and alpine-mariadb, result :

✖ error connect ECONNREFUSED IP:port ( thy IP:port is the alpine-mariadb)

<!-- gh-comment-id:846630072 --> @dberrocal-git commented on GitHub (May 23, 2021): I have a similar problem, I updated a few days ago to the latest version of nginx and alpine-mariadb, result : ✖ error connect ECONNREFUSED IP:port ( thy IP:port is the alpine-mariadb)
Author
Owner

@chaptergy commented on GitHub (May 25, 2021):

@dabm-git Your problem is entirely different from the original issue, since you are using a mariaDB and this issue is about an SQLite database.

@Karatekid2407 Can you check if the file /data/npm.sqlite exists? And what the permissions of this file are? You can connect inside the container and execute the command ls -la inside the /data directory, and paste the line containing npm.sqlite here.

<!-- gh-comment-id:847660610 --> @chaptergy commented on GitHub (May 25, 2021): @dabm-git Your problem is entirely different from the original issue, since you are using a mariaDB and this issue is about an SQLite database. @Karatekid2407 Can you check if the file `/data/npm.sqlite` exists? And what the permissions of this file are? You can connect inside the container and execute the command `ls -la` inside the `/data` directory, and paste the line containing `npm.sqlite` here.
Author
Owner

@Karatekid2407 commented on GitHub (May 25, 2021):

When I create the container there will be no sqlite file created.
I tried it to add it from my previous container on Unraid with "jlesage/nginx-proxy-manager" BUT this does also not work.

chmod and chown was added with 777 and root:root

Will be add a screenshot afterwards.

<!-- gh-comment-id:847668243 --> @Karatekid2407 commented on GitHub (May 25, 2021): When I create the container there will be no sqlite file created. I tried it to add it from my previous container on Unraid with "jlesage/nginx-proxy-manager" BUT this does also not work. chmod and chown was added with 777 and root:root Will be add a screenshot afterwards.
Author
Owner

@chaptergy commented on GitHub (May 25, 2021):

Could you check if /app/config/production.json file is created successfully? Is there anything else in the log which could have to do with this issue?

<!-- gh-comment-id:847694065 --> @chaptergy commented on GitHub (May 25, 2021): Could you check if `/app/config/production.json` file is created successfully? Is there anything else in the log which could have to do with this issue?
Author
Owner

@Karatekid2407 commented on GitHub (May 25, 2021):

Yes its generated. The log which I get in Docker.

Log from Docker

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 01_s6-secret-init.sh: executing... 
[cont-init.d] 01_s6-secret-init.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
❯ Enabling IPV6 in hosts: /etc/nginx/conf.d
  ❯ /etc/nginx/conf.d/include/proxy.conf
  ❯ /etc/nginx/conf.d/include/block-exploits.conf
  ❯ /etc/nginx/conf.d/include/letsencrypt-acme-challenge.conf
  ❯ /etc/nginx/conf.d/include/ssl-ciphers.conf
  ❯ /etc/nginx/conf.d/include/assets.conf
  ❯ /etc/nginx/conf.d/include/ip_ranges.conf
  ❯ /etc/nginx/conf.d/include/force-ssl.conf
  ❯ /etc/nginx/conf.d/include/resolvers.conf
  ❯ /etc/nginx/conf.d/production.conf
  ❯ /etc/nginx/conf.d/default.conf
❯ Enabling IPV6 in hosts: /data/nginx
sqlite does not support inserting default values. Set the `useNullAsDefault` flag to hide this warning. (see docs http://knexjs.org/#Builder-insert).
[5/25/2021] [11:04:19 AM] [Global   ] › ✖  error     SQLITE_CANTOPEN: unable to open database file

Bildschirmfoto 2021-05-25 um 13 01 39

<!-- gh-comment-id:847774777 --> @Karatekid2407 commented on GitHub (May 25, 2021): Yes its generated. The log which I get in Docker. Log from Docker ``` [s6-init] making user provided files available at /var/run/s6/etc...exited 0. [s6-init] ensuring user provided files have correct perms...exited 0. [fix-attrs.d] applying ownership & permissions fixes... [fix-attrs.d] done. [cont-init.d] executing container initialization scripts... [cont-init.d] 01_s6-secret-init.sh: executing... [cont-init.d] 01_s6-secret-init.sh: exited 0. [cont-init.d] done. [services.d] starting services [services.d] done. ❯ Enabling IPV6 in hosts: /etc/nginx/conf.d ❯ /etc/nginx/conf.d/include/proxy.conf ❯ /etc/nginx/conf.d/include/block-exploits.conf ❯ /etc/nginx/conf.d/include/letsencrypt-acme-challenge.conf ❯ /etc/nginx/conf.d/include/ssl-ciphers.conf ❯ /etc/nginx/conf.d/include/assets.conf ❯ /etc/nginx/conf.d/include/ip_ranges.conf ❯ /etc/nginx/conf.d/include/force-ssl.conf ❯ /etc/nginx/conf.d/include/resolvers.conf ❯ /etc/nginx/conf.d/production.conf ❯ /etc/nginx/conf.d/default.conf ❯ Enabling IPV6 in hosts: /data/nginx sqlite does not support inserting default values. Set the `useNullAsDefault` flag to hide this warning. (see docs http://knexjs.org/#Builder-insert). [5/25/2021] [11:04:19 AM] [Global ] › ✖ error SQLITE_CANTOPEN: unable to open database file ``` ![Bildschirmfoto 2021-05-25 um 13 01 39](https://user-images.githubusercontent.com/38478308/119487242-6a69f500-bd59-11eb-9234-c875c171e6ac.jpg)
Author
Owner

@chaptergy commented on GitHub (May 25, 2021):

Maybe it has to do something with https://github.com/jc21/nginx-proxy-manager/issues/700. You can try to create your own production.json with the content as in the aforementioned issue including the useNullAsDefault line. Have a look at the documentation for information on how to mount it into the container

<!-- gh-comment-id:847781792 --> @chaptergy commented on GitHub (May 25, 2021): Maybe it has to do something with https://github.com/jc21/nginx-proxy-manager/issues/700. You can try to create your own `production.json` with the content as in the aforementioned issue including the `useNullAsDefault` line. Have a look at the [documentation](https://nginxproxymanager.com/setup/#configuration-file) for information on how to mount it into the container
Author
Owner

@Karatekid2407 commented on GitHub (May 25, 2021):

You are right. This fixed the Issue! Can you insert the fix in the repo?

<!-- gh-comment-id:847793110 --> @Karatekid2407 commented on GitHub (May 25, 2021): You are right. This fixed the Issue! Can you insert the fix in the repo?
Author
Owner

@chaptergy commented on GitHub (May 25, 2021):

Sure, but I will close this in favor of https://github.com/jc21/nginx-proxy-manager/issues/700.

<!-- gh-comment-id:847793996 --> @chaptergy commented on GitHub (May 25, 2021): Sure, but I will close this in favor of https://github.com/jc21/nginx-proxy-manager/issues/700.
Author
Owner

@Karatekid2407 commented on GitHub (May 13, 2023):

Problem started again and fix from above now did not work anymore.
Tried multiple versions and did not find any solution.
Config is working and websites are visible but admin panels says bad gateway

<!-- gh-comment-id:1546711031 --> @Karatekid2407 commented on GitHub (May 13, 2023): Problem started again and fix from above now did not work anymore. Tried multiple versions and did not find any solution. Config is working and websites are visible but admin panels says bad gateway
Author
Owner

@Karatekid2407 commented on GitHub (May 13, 2023):

Fixed by delete

- DB_SQLITE_FILE="/data/database.sqlite"
<!-- gh-comment-id:1546727474 --> @Karatekid2407 commented on GitHub (May 13, 2023): Fixed by delete ``` - DB_SQLITE_FILE="/data/database.sqlite" ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#921
No description provided.