Portainer deployment failing on a Pi4

I’m trying to run the nextcloud stack on a Raspberry Pi4.
Now I’m on the initial landing page trying to set up the admin user but that fails with this error:

Error while trying to create admin user: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory

This is the container log:

Brought to you by linuxserver.io
-------------------------------------
To support LSIO projects visit:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------
User uid:    911
User gid:    911
-------------------------------------
[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 20-config: executing... 
[cont-init.d] 20-config: exited 0.
[cont-init.d] 30-keygen: executing... 
generating self-signed keys in /config/keys, you can replace these with your own keys if required
Generating a RSA private key
.................................+++++
...................................+++++
writing new private key to '/config/keys/cert.key'
-----
[cont-init.d] 30-keygen: exited 0.
[cont-init.d] 40-config: executing... 
[cont-init.d] 40-config: exited 0.
[cont-init.d] 50-install: executing... 
[cont-init.d] 50-install: exited 0.
[cont-init.d] 60-memcache: executing... 
[cont-init.d] 60-memcache: exited 0.
[cont-init.d] 70-aliases: executing... 
[cont-init.d] 70-aliases: exited 0.
[cont-init.d] 90-custom-folders: executing... 
[cont-init.d] 90-custom-folders: exited 0.
[cont-init.d] 99-custom-files: executing... 
[custom-init] no custom files found exiting...
[cont-init.d] 99-custom-files: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
Exception: Not installed in /config/www/nextcloud/lib/base.php:277
Stack trace:
#0 /config/www/nextcloud/lib/base.php(649): OC::checkInstalled()
#1 /config/www/nextcloud/lib/base.php(1083): OC::init()
#2 /config/www/nextcloud/cron.php(42): require_once('/config/www/nex...')
}

Any idea what might be wrong?
Thanks

To start, we dont support deploying any of our stuff with portainer. Portainer is bad, it causes problems. next, you didnt set PUID or PGID properly which is why you see 911 in the log.

i would guess you didnt set mariadb properly, but without seeing your compose (which you won’t have a trustworthy one because it’s portainer) i cant fathom what is missing. you also dont say which container log this is, you’re referring to 3 containers (some flavor of nginx, nextcloud, and mariadb) and only provide 1 docker log…

I would suggest deploying with docker compose and if you still have issues share your compose with us and the docker logs for all containers involved via pastebin. We have a great example (even though there’s a copy paste compose for every container) here

Hi, thanks for the info.
It’s a pitty that portainer is not supported any more. It delivers a nice overwiev of all running containers and management is easier without the need of a console.
I will read up how to set up the docker compose and see if I can get it running.

We love portainer for the overview and logs, we do NOT love it for deployment because it breaks things and causes numerous issues.

OK, understood.
I used the https://docs.linuxserver.io/images/docker-nextcloud instructions and set up the compose.yml like it is showed there. Of course I adapted the volume mappings but the rest seemed ok.

---
version: "2.1"
services:
   nextcloud:
    image: ghcr.io/linuxserver/nextcloud
    container_name: nextcloud
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Berlin
    volumes:
      - /media/usb2/Nextcloud/appdata:/config
      - /media/usb2/Nextcloud/data:/data
    ports:
      - 443:443
    restart: unless-stopped

This is the output of docker-compose up.
The terminal I ran the command from is still busy. Edit: I learned that I have to use option -d to run in background.

I connected to the webgui and tried to setup the admin account and the MySQL/MariaDB.
That throws the stack traces at the end of the log.
Do I have to set up a DB docker also - there is no step in the instructions but my little understanding tells me that I have to…???

By the way, as this is the same error I encountered with the deployment via portainer I think I should share my findings.
I opted for the SQLite database instead of the MySQL this afternoon and then the setup continued without error. Unfortunately the port mappings were odd and I didn’t know how to change them so I decided to follow your advice and set it up the docker-compose way.

But now back to this issue…here is the output of the terminal after running the “compose up”.

$ docker-compose up
Creating network "pi_default" with the default driver
Pulling nextcloud (ghcr.io/linuxserver/nextcloud:)...
latest: Pulling from linuxserver/nextcloud
Digest: sha256:a154ce36ba984967dfa9fbba65390db871b4ee9ced9b69c7f67826718775ae7c
Status: Downloaded newer image for ghcr.io/linuxserver/nextcloud:latest
Creating nextcloud ... done
Attaching to nextcloud
nextcloud    | [s6-init] making user provided files available at /var/run/s6/etc...exited 0.
nextcloud    | [s6-init] ensuring user provided files have correct perms...exited 0.
nextcloud    | [fix-attrs.d] applying ownership & permissions fixes...
nextcloud    | [fix-attrs.d] done.
nextcloud    | [cont-init.d] executing container initialization scripts...
nextcloud    | [cont-init.d] 01-envfile: executing...
nextcloud    | [cont-init.d] 01-envfile: exited 0.
nextcloud    | [cont-init.d] 10-adduser: executing...
nextcloud    |
nextcloud    | -------------------------------------
nextcloud    |           _         ()
nextcloud    |          | |  ___   _    __
nextcloud    |          | | / __| | |  /  \
nextcloud    |          | | \__ \ | | | () |
nextcloud    |          |_| |___/ |_|  \__/
nextcloud    |
nextcloud    |
nextcloud    | Brought to you by linuxserver.io
nextcloud    | -------------------------------------
nextcloud    |
nextcloud    | To support LSIO projects visit:
nextcloud    | https://www.linuxserver.io/donate/
nextcloud    | -------------------------------------
nextcloud    | GID/UID
nextcloud    | -------------------------------------
nextcloud    |
nextcloud    | User uid:    1000
nextcloud    | User gid:    1000
nextcloud    | -------------------------------------
nextcloud    |
nextcloud    | [cont-init.d] 10-adduser: exited 0.
nextcloud    | [cont-init.d] 20-config: executing...
nextcloud    | [cont-init.d] 20-config: exited 0.
nextcloud    | [cont-init.d] 30-keygen: executing...
nextcloud    | generating self-signed keys in /config/keys, you can replace these with your own keys if required
nextcloud    | Generating a RSA private key
nextcloud    | ..................+++++
nextcloud    | ...............+++++
nextcloud    | writing new private key to '/config/keys/cert.key'
nextcloud    | -----
nextcloud    | [cont-init.d] 30-keygen: exited 0.
nextcloud    | [cont-init.d] 40-config: executing...
nextcloud    | [cont-init.d] 40-config: exited 0.
nextcloud    | [cont-init.d] 50-install: executing...
nextcloud    | [cont-init.d] 50-install: exited 0.
nextcloud    | [cont-init.d] 60-memcache: executing...
nextcloud    | [cont-init.d] 60-memcache: exited 0.
nextcloud    | [cont-init.d] 70-aliases: executing...
nextcloud    | [cont-init.d] 70-aliases: exited 0.
nextcloud    | [cont-init.d] 90-custom-folders: executing...
nextcloud    | [cont-init.d] 90-custom-folders: exited 0.
nextcloud    | [cont-init.d] 99-custom-files: executing...
nextcloud    | [custom-init] no custom files found exiting...
nextcloud    | [cont-init.d] 99-custom-files: exited 0.
nextcloud    | [cont-init.d] done.
nextcloud    | [services.d] starting services
nextcloud    | [services.d] done.
nextcloud    | Exception: Not installed in /config/www/nextcloud/lib/base.php:277
nextcloud    | Stack trace:
nextcloud    | #0 /config/www/nextcloud/lib/base.php(649): OC::checkInstalled()
nextcloud    | #1 /config/www/nextcloud/lib/base.php(1083): OC::init()
nextcloud    | #2 /config/www/nextcloud/cron.php(42): require_once('/config/www/nex...')
nextcloud    | #3 {main}
nextcloud    | Exception: Not installed in /config/www/nextcloud/lib/base.php:277
nextcloud    | Stack trace:
nextcloud    | #0 /config/www/nextcloud/lib/base.php(649): OC::checkInstalled()
nextcloud    | #1 /config/www/nextcloud/lib/base.php(1083): OC::init()
nextcloud    | #2 /config/www/nextcloud/cron.php(42): require_once('/config/www/nex...')
nextcloud    | #3 {main}

I set up the maria_db docker.
The compose.yml looks like this now:

cat docker-compose.yml
---
version: "2.1"
services:
   nextcloud:
    image: ghcr.io/linuxserver/nextcloud
    container_name: nextcloud
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Berlin
    volumes:
      - /media/usb2/Nextcloud/appdata:/config
      - /media/usb2/Nextcloud/data:/data
    ports:
      - 443:443
    restart: unless-stopped
    depends_on:
      - nextcloud_db

   nextcloud_db:
    image: ghcr.io/linuxserver/mariadb
    container_name: nextcloud_db
    environment:
      - PUID=1000
      - PGID=1000
      - MYSQL_ROOT_PASSWORD=removed_this_password
      - TZ=Europe/Berlin
    volumes:
      - /media/usb2/Nextcloud:/config
    ports:
      - 3306:3306
    restart: unless-stopped

At the setup screen I’m seeing the same errors as in my first post.
Is “/data” the correct path?

I ran another compose.yml with this options included. The same errors when trying to connect…
MYSQL_DATABASE=USER_DB_NAME #optional
MYSQL_USER=MYSQL_USER #optional
MYSQL_PASSWORD=DATABASE_PASSWORD #optional

i gave you a link with a full compose with all the options… i’m not sure why you didnt use it. If you aren’t going to specify user/pw/db on creation of the container, you need to go into mariadb and build it. I would suggest using the link i provided to you above.

1 Like

Indeed, I had a look at your link but got confused by the SWAG thing.
Do you think your linked compose will work without the SWAG part?

yes, though im not sure why you would want nextcloud without protecting it with tls… :smiley:

Nextcloud shall be accessible only inside my home network.
I don’t need services exposed to the internet.
I think there is no need to make things complicated without reason.

I finally got it working.
The issue was the very last line on the screenshot above where it says “localhost:3306”.
The correct entry is the name of the database container name. In my case “nextcloud_db”.
Thanks for your support driz!

Yes, the link i gave you states that, but im glad you got it sorted :slight_smile:

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.