Nc-init timeout when downloading calendar app, causes infinite initialization

Hi there

I’m trying to install nextcloudpi on my Raspberry Pi 3B with Docker Compose and it’s causing me grief. I managed to sucessfully install it once somehow but I haven’t been able to deleting the volume and starting over.

What happens is I run docker-compose up -d and then it installs everything (see logs below) but fails with installing the calendar application due to a libcurl timeout (see ncp-report output below). I have a suspicion that this causes it not to be installed properly. I am able to activate it, however after activation it just takes me back to a screen that says “Initializing NextCloudPi for the first time Please wait…”.

Here is my docker-compose.yml:

version: '3'

networks:
    default:
        external:
            name: nginx-proxy

services:
nextcloudpi:
    image: ownyourbits/nextcloudpi
    command: "my.domain.tld"
    expose:
    - 443
    - 80
    volumes:
    - /mnt/external_1/ncdata:/data
    - /etc/localtime:/etc/localtime:ro
    container_name: nextcloud

docker-compose up -d output:
pi@raspberrypi:~/nextcloud $ docker-compose logs -f
Attaching to nextcloud
nextcloud | Initializing empty volume…
nextcloud | Making /usr/local/etc/ncp-config.d persistent …
nextcloud | Making /etc/services-enabled.d persistent …
nextcloud | Making /etc/letsencrypt persistent …
nextcloud | Making /etc/shadow persistent …
nextcloud | Making /etc/cron.d persistent …
nextcloud | Making /etc/cron.daily persistent …
nextcloud | Making /etc/cron.hourly persistent …
nextcloud | Making /etc/cron.weekly persistent …
nextcloud | Making /usr/local/bin persistent …
nextcloud | Making /etc/apache2 persistent …
nextcloud | Starting PHP-fpm
nextcloud | Starting Apache
nextcloud | Starting mariaDB
nextcloud | 2020-04-28 1:13:09 0 [Note] mysqld (mysqld 10.3.22-MariaDB-0+deb10u1) starting as process 195 …
nextcloud | Starting Redis
nextcloud | Starting Cron
nextcloud | Starting Postfix
nextcloud | Uninitialized instance, running nc-init…
nextcloud | Running nc-init
nextcloud | Setting up a clean Nextcloud instance… wait until message ‘NC init done’
nextcloud | Setting up database…
nextcloud | Setting up Nextcloud…
nextcloud | Nextcloud was successfully installed
nextcloud | Set mode for background jobs to ‘cron’
nextcloud | System config value tempdirectory set to string /var/www/nextcloud/data/tmp
nextcloud | System config value mysql.utf8mb4 set to boolean true
nextcloud | System config value trusted_domains => 11 set to string 197.94.76.190
nextcloud | System config value trusted_domains => 1 set to string 172.21.0.3
nextcloud | System config value trusted_domains => 5 set to string nextcloudpi.local
nextcloud | System config value trusted_domains => 7 set to string nextcloudpi
nextcloud | System config value trusted_domains => 8 set to string nextcloudpi.lan
nextcloud | System config value mail_smtpmode set to string sendmail
nextcloud | System config value mail_smtpauthtype set to string LOGIN
nextcloud | System config value mail_from_address set to string admin
nextcloud | System config value mail_domain set to string ownyourbits.com
nextcloud | nextcloudpi enabled
nextcloud | Error: Could not download app calendar
nextcloud | Init done

ncp-report output

<--! Paste this in GitHub report -->

<details>
<summary>NextCloudPi diagnostics</summary>

```

NextCloudPi version  v1.24.0
NextCloudPi image    NextCloudPi_docker_04-06-20
distribution         Debian GNU/Linux 10 \n \l
automount            no
USB devices          sda
datadir              /data/nextcloud/data
data in SD           no
data filesystem      ext2/ext3
data disk usage      549M/55G
rootfs usage         6.2G/7.2G
swapfile             /var/swap
dbdir                /data/database
Nextcloud check      ok
Nextcloud version    18.0.3.0
HTTPD service        up
PHP service          up
MariaDB service      up
Redis service        up
Postfix service      up
internet check       ok
port check 80        closed
port check 443       closed
IP                   ***REMOVED SENSITIVE VALUE***
gateway              ***REMOVED SENSITIVE VALUE***
interface            eth0
certificates         ***REMOVED SENSITIVE VALUE***
NAT loopback         no
uptime               2:20

```
</details>


<details>
<summary>Nextcloud configuration</summary>

```

{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": {
            "0": "localhost",
            "11": "197.94.76.190",
            "1": "172.21.0.3",
            "5": "nextcloudpi.local",
            "7": "nextcloudpi",
            "8": "nextcloudpi.lan"
        },
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "18.0.3.0",
        "overwrite.cli.url": "http:\/\/localhost",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "memcache.local": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0,
            "password": "***REMOVED SENSITIVE VALUE***"
        },
        "tempdirectory": "\/var\/www\/nextcloud\/data\/tmp",
        "mail_smtpmode": "sendmail",
        "mail_smtpauthtype": "LOGIN",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***"
    }
}

```
</details>


<details>
<summary>HTTPd logs</summary>

```

[Tue Apr 28 01:13:08.295677 2020] [ssl:error] [pid 98:tid 1995849136] AH02217: ssl_stapling_init_cert: can't retrieve issuer certificate! [subject: CN=localhost / issuer: CN=localhost / serial: 230E6FEDC48A5981C4496B06D88B6B8B1A4D7F88 / notbefore: Apr  6 05:22:36 2020 GMT / notafter: Apr  4 05:22:36 2030 GMT]
[Tue Apr 28 01:13:08.296111 2020] [ssl:error] [pid 98:tid 1995849136] AH02604: Unable to configure certificate localhost:443:0 for stapling
[Tue Apr 28 01:13:08.346978 2020] [ssl:error] [pid 99:tid 1995849136] AH02217: ssl_stapling_init_cert: can't retrieve issuer certificate! [subject: CN=localhost / issuer: CN=localhost / serial: 230E6FEDC48A5981C4496B06D88B6B8B1A4D7F88 / notbefore: Apr  6 05:22:36 2020 GMT / notafter: Apr  4 05:22:36 2030 GMT]
[Tue Apr 28 01:13:08.347047 2020] [ssl:error] [pid 99:tid 1995849136] AH02604: Unable to configure certificate localhost:443:0 for stapling
[Tue Apr 28 01:13:08.352037 2020] [mpm_event:notice] [pid 99:tid 1995849136] AH00489: Apache/2.4.38 (Debian) OpenSSL/1.1.1d configured -- resuming normal operations
[Tue Apr 28 01:13:08.352149 2020] [core:notice] [pid 99:tid 1995849136] AH00094: Command line: '/usr/sbin/apache2'

```
</details>


<details>
<summary>Database logs</summary>

```

2020-04-28  1:13:09 0 [Note] InnoDB: Uses event mutexes
2020-04-28  1:13:09 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-04-28  1:13:09 0 [Note] InnoDB: Number of pools: 1
2020-04-28  1:13:09 0 [Note] InnoDB: Using generic crc32 instructions
2020-04-28  1:13:09 0 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M
2020-04-28  1:13:09 0 [Note] InnoDB: Completed initialization of buffer pool
2020-04-28  1:13:09 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-04-28  1:13:09 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2020-04-28  1:13:09 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-04-28  1:13:09 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-04-28  1:13:09 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-04-28  1:13:09 0 [Note] InnoDB: 10.3.22 started; log sequence number 1626133; transaction id 21
2020-04-28  1:13:09 0 [Note] InnoDB: Loading buffer pool(s) from /data/database/ib_buffer_pool
2020-04-28  1:13:09 0 [Note] Plugin 'FEEDBACK' is disabled.
2020-04-28  1:13:09 0 [Note] InnoDB: Buffer pool(s) load completed at 200428  1:13:09
2020-04-28  1:13:10 0 [Note] Server socket created on IP: '127.0.0.1'.
2020-04-28  1:13:10 0 [Note] Reading of all Master_info entries succeeded
2020-04-28  1:13:10 0 [Note] Added new Master_info '' to hash table
2020-04-28  1:13:10 0 [Note] mysqld: ready for connections.
Version: '10.3.22-MariaDB-0+deb10u1'  socket: '/run/mysqld/mysqld.sock'  port: 3306  Debian 10

```
</details>


<details>
<summary>Nextcloud logs</summary>

```

{"reqId":"mOI5D4Pjd2T2nCwkqSMR","level":2,"time":"2020-04-28T01:15:03+00:00","remoteAddr":"","user":"--","app":"appstoreFetcher","method":"","url":"--","message":"Could not connect to appstore: cURL error 28: Operation timed out after 10004 milliseconds with 2760704 out of 4765474 bytes received (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)","userAgent":"--","version":"18.0.3.0"}
{"reqId":"rbUCBQLs7upyUQg5wpvh","level":2,"time":"2020-04-28T01:15:23+00:00","remoteAddr":"","user":"--","app":"appstoreFetcher","method":"","url":"--","message":"Could not connect to appstore: cURL error 28: Operation timed out after 10000 milliseconds with 2449408 out of 4765474 bytes received (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)","userAgent":"--","version":"18.0.3.0"}

```
</details>

I’ve been scavenging the docs, this forum and every resource that would show up with no luck. Anyone have any ideas?

Just tried setting up NextCloudPi today, and I’m getting the same error. I’m going to try troubleshooting now. Are you still having this issue, or did you manage to resolve it?

I ended up using linuxserver’s image and it worked. Eventually I had to manually increase the timeouts for some of the responses but besides that I was actually able to visit the site. https://docs.linuxserver.io/images/docker-nextcloud

Ok, so it is completely random as to when the NextCloudPi container with work or not. Currently, my NextCloudPi container is working, but if I were to delete the persistent volume and start a new container, it will not work.

I’d like to document my findings here in hopes that there will be a solution discovered some day :innocent:

Firstly, I am using a Raspberry Pi 3B+ with Raspberry Pi OS (32-bit) Lite (Minimal image based on Debian Buster), and here is my docker-compose.yml:

version: '3'
services:
  nextcloudpi:
    image: "ownyourbits/nextcloudpi-armhf:v1.24.0"
    command: "10.0.0.50"
    hostname: ncvonawesome
    ports:
      - "80:80"
      - "443:443"
      - "4443:4443"
    # Volumes store your data between container upgrades
    volumes:
      - "./ncdata:/data"
      - "/etc/localtime:/etc/localtime:ro"
    container_name: ncpvonawesome
    restart: unless-stopped

When I run docker-compose up -d, and the container creation is successful, this is the output from docker logs -f ncpvonawesome:

Starting PHP-fpm
Starting Apache
Starting mariaDB
2020-05-31 23:29:55 0 [Note] mysqld (mysqld 10.3.22-MariaDB-0+deb10u1) starting as process 184 ...
Starting Redis
Starting Cron
Starting Postfix
System config value trusted_domains => 1 set to string 172.21.0.2
System config value trusted_domains => 6 set to string 10.0.0.50
Provisioning
Provisioning Redis password
Updating NextCloud config with Redis password
Provisioning MariaDB password
Updating NextCloud config with MariaDB password
Running nc-limits
Using 728279040B for PHP
Using 4 PHP threads
Using 388415488 memory for the database
Stopping MariaDB database server: mysqld.
Starting MariaDB database server: mysqld.
Stopping redis-server: redis-server.
Starting redis-server: redis-server.
Init done

This line appears to be the “tell” that everything is working: System config value trusted_domains => 6 set to string 10.0.0.50. That is the internal IP of my Raspberry Pi device.

Here is the output from docker logs -f ncpvonawesome when the container does not successfully initialize:

Initializing empty volume..
Making /usr/local/etc/ncp-config.d persistent ...
Making /etc/services-enabled.d persistent ...
Making /etc/letsencrypt persistent ...
Making /etc/shadow persistent ...
Making /etc/cron.d persistent ...
Making /etc/cron.daily persistent ...
Making /etc/cron.hourly persistent ...
Making /etc/cron.weekly persistent ...
Making /usr/local/bin persistent ...
Making /etc/apache2 persistent ...
Starting PHP-fpm
Starting Apache
Starting mariaDB
2020-05-31 23:45:45 0 [Note] mysqld (mysqld 10.3.22-MariaDB-0+deb10u1) starting as process 197 ...
Starting Redis
Starting Cron
Starting Postfix
Uninitialized instance, running nc-init...
Running nc-init
Setting up a clean Nextcloud instance... wait until message 'NC init done'
Setting up database...
Setting up Nextcloud...
Nextcloud was successfully installed
Set mode for background jobs to 'cron'
System config value tempdirectory set to string /var/www/nextcloud/data/tmp
System config value mysql.utf8mb4 set to boolean true
System config value trusted_domains => 11 set to string 55.10.16.42
System config value trusted_domains => 1 set to string 172.23.0.2
System config value trusted_domains => 5 set to string nextcloudpi.local
System config value trusted_domains => 7 set to string nextcloudpi
System config value trusted_domains => 8 set to string nextcloudpi.lan
System config value mail_smtpmode set to string sendmail
System config value mail_smtpauthtype set to string LOGIN
System config value mail_from_address set to string admin
System config value mail_domain set to string ownyourbits.com
nextcloudpi enabled
Error: Could not download app calendar
Init done

You’ll notice in the “trusted_domains”, that the internal address of my Pi (10.0.0.50) is not listed:

System config value trusted_domains => 11 set to string 55.10.16.42
System config value trusted_domains => 1 set to string 172.23.0.2
System config value trusted_domains => 5 set to string nextcloudpi.local
System config value trusted_domains => 7 set to string nextcloudpi
System config value trusted_domains => 8 set to string nextcloudpi.lan

Note: The line System config value trusted_domains => 11 set to string 55.10.16.42 is the external IP of my router (which I have change for this post).

I have tried using various versions of the NextCloudPi docker image:

  • image: “ownyourbits/nextcloudpi-armhf:v1.24.0”
  • image: “ownyourbits/nextcloudpi-armhf:v1.23.1”
  • image: “ownyourbits/nextcloudpi-armhf:v1.19.1”

All ended up with the same error:
Error: Could not download app calendar

And then because of the error NextCloud is not functional, i.e. I cannot access NextCloud via the Web UI.

So having typed all of that, I’m not any closer to having the NextCloudPi Docker image work consistently. Right now it’s working, but I would be worried to update the image, or if I need to restore the persistent data from a backup. So, I believe I will look into the standard NextCloud Docker image, but I’m really bummed that NextCloudPi image does not work :frowning:

Perhaps others may be able to shine some light on this issue?

Hopefully, this added information can help solve the mystery.