Nextcloudpi container fails to start on Raspberry Pi 2

Hi,

wanted to give the latest NextCloudPi container (ownyourbits/nextcloudpi-armhf) a spin on my Rpi2 .
However, it has some startup trouble with mysql:

2017-12-09T17:25:16.370107199Z AH00112: Warning: DocumentRoot [/var/www/nextcloud] does not exist
2017-12-09T17:25:16.370397146Z (2)No such file or directory: AH02291: Cannot access directory '/var/www/nextcloud/data/' for error log of vhost defined at /etc/apache2/sites-enabled/nextcloud.conf:2
2017-12-09T17:25:16.370884281Z AH00014: Configuration check failed
2017-12-09T17:25:18.650508966Z 2017-12-09 18:25:18 1996156928 [Note] mysqld (mysqld 10.1.26-MariaDB-0+deb9u1) starting as process 130 ...
2017-12-09T17:25:18.699885387Z 2017-12-09 18:25:18 1996156928 [Warning] Can't create test file /data/database/fb0f4f4fbaf9.lower-test
2017-12-09T17:25:18.700139866Z amysqld: Can't change dir to '/data/database/' (Errcode: 2 "No such file or directory")
2017-12-09T17:25:18.700236533Z 2017-12-09 18:25:18 1996156928 [ERROR] Aborting
2017-12-09T17:25:18.700314293Z 
2017-12-09T17:25:28.671813637Z ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111 "Connection refused")

In this situation the mounted volume only contains “etc” and “ncp” folders but not data folder.

I also have a different instance of mysql running in a separate container. This should not do any harm, right?

Thanks
Jochen

hi, what container did you pull?

you should use ownyourbits/nextcloudpi-armhf as explained here

https://ownyourbits.com/2017/11/15/nextcloudpi-dockers-for-x86-and-arm/

Hi @nachoparker,

that’s exactly the image I used (as you can see from my first post).
Does not start, though…

I created another container based on the nexcloud (not nextcloudpi) image mentioned in the post but it shows the same result:

STDOUT logs:

2017-12-12T18:31:24.322683818Z Starting PHP-fpm
2017-12-12T18:31:24.324249025Z Starting Apache
2017-12-12T18:31:24.769090726Z Action 'start' failed.
2017-12-12T18:31:24.769391715Z The Apache error log may have more information.
2017-12-12T18:31:24.797681528Z Starting Redis
2017-12-12T18:31:25.087002774Z Starting Cron
2017-12-12T18:31:25.119100864Z Starting Postfix
2017-12-12T18:31:27.354938836Z Uninitialized instance, running nc-init...
2017-12-12T18:31:27.378669174Z Activating nc-init
2017-12-12T18:31:27.397192175Z Setting up a clean Nextcloud instance... wait until message 'NC init done'
2017-12-12T18:31:27.397531445Z Setting up database...
2017-12-12T18:31:37.589622487Z Init done

STDERR logs

2017-12-12T18:31:24.755818136Z apache2: Syntax error on line 146 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/authnz_external.load: Cannot load /usr/lib/apache2/modules/mod_authnz_external.so into server: /usr/lib/apache2/modules/mod_authnz_external.so: cannot open shared object file: No such file or directory
2017-12-12T18:31:27.790830546Z 2017-12-12 19:31:27 1996120064 [Note] mysqld (mysqld 10.1.26-MariaDB-0+deb9u1) starting as process 141 ...
2017-12-12T18:31:27.929196905Z 2017-12-12 19:31:27 1996120064 [Warning] Can't create test file /data/database/faede952bfe4.lower-test
2017-12-12T18:31:27.929479718Z amysqld: Can't change dir to '/data/database/' (Errcode: 2 "No such file or directory")
2017-12-12T18:31:27.929591540Z 2017-12-12 19:31:27 1996120064 [ERROR] Aborting
2017-12-12T18:31:27.929674561Z 
2017-12-12T18:31:37.580374060Z ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111 "Connection refused")

well, I know that one works, so let’s try cleaning everything, including the volume (maybe you are using an old volume from the old image?)

docker stop nextcloudpi
docker rm nextcloudpi
docker volume rm ncdata              # or whatever the name is
#docker run again

Nope, that does not work as well.
I started from scratch with NextCloudPi anyway, so there are no residues…

I have a similar problem. Did you get any further?
For me on a RasPi 3 running Raspbian, I first installed the older Docker container nextcloudpi and then it got deleted when I installed docker-compose on top (it doesn’t tell you that your old containers and probably also volumes are discarded!).

Now I can’t get the nextcloudpi-armhf container to work.

Zusammenfassung
Starting PHP-fpm
Starting Apache
(2)No such file or directory: AH02291: Cannot access directory '/var/www/nextcloud/data/' for error log of vhost defined at /etc/apache2/sites-enabled/nextcloud.conf:2
AH00014: Configuration check failed
Action 'start' failed.
The Apache error log may have more information.
Starting Redis
Starting Cron
Starting Postfix
Uninitialized instance, running nc-init...
Activating nc-init
Setting up a clean Nextcloud instance... wait until message 'NC init done'
Setting up database...
2018-01-30 14:42:59 1995444224 [Note] mysqld (mysqld 10.1.26-MariaDB-0+deb9u1) starting as process 136 ...
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111 "Connection refused")
Init done

No, I tried it again in a rpi3 where MySQL wasnt installed anywhere -
neither on the host nor in another container. The result was the same.
Is it supposed to work just like that or does the host system need some
prerequisites? Or the docker installation? I’m using raspbian Jessie and
stretch as base currently.

1 Like

I completely removed everything, all images, containers, volumes and Docker (because the script that is accessed installs an older version of Docker, for a newer one you have to use test.docker.com instead of get.docker.com). Maybe that was the key, because after performing yet another install, NCP worked!

Interesting.

I have
Docker version 17.05.0-ce, build 89658be and
Docker version 18.01.0-ce, build 03596f5 on the two PIs.
So both are not really outdated.
However, both releases are from the “edge” release line, whatever that means.

I have not yet found out how to update the first Pi since I used the script to install docker in both Pis at different times.

I got the same error on Raspberry Pi 3 with a totally clean Raspbian lite system. Also tried many times with the script to install Nextcloudpi on Raspian lite, no way to get a stable solution. After a while, the pi cannot be accessed at all.

do you mean the “curl script”? did it work and after a while it stopped working?

yes, after configruation like added a new user, installed the desktop client and raspberry pi was gone.

this has not been reported before, so I am guessing the issue is rare. If you are willing to reproduce it would be great if you opened a github issue ( or here ) to try to debug it.

I’m trying the NextCloudPi image now, so maybe we debug it later.
In addition, after using the script to install the nextcloudpi, the default user is the same as used for the web panel (ncp instead of admin as stated in your post (https://ownyourbits.com/2017/02/13/nextcloud-ready-raspberry-pi-image/). And google.com is blocked here, so before using the script I had to edit /etc/hosts for google.com to by-pass the connection test. I’d be better to use a different domain for the connection test like 8.8.8.8?

Yes, we are in the process of using the same username/password everywhere, because it was confusing people. We will update the documentation once the new image comes out.

originally I was checking connectivity with github.com… then it seems like they blocked ping in Germany, so changed to google.com… I’ll consider just using 8.8.8.8 then.

thanks for the feedback

I am getting the same error as @jo-me. The error however only occurs, if I start the container with a mounted directory instead of a docker volume. @nachoparker I am using this on a fresh installed Raspbian, so no other docker volumes are present.

The following docker-compose file does not work:

version: '2'
services:
  nextcloudpi:
    image: ownyourbits/nextcloudpi-armhf
    command: ${IP}
    ports:
     - "80:80"
     - "443:443"
     - "4443:4443"
    volumes:
     - ./nextcloud:/data

If I change volumes to a docker volume (e.g. ncdata) everything is fine.

Output log after running IP=“192.168.0.20” docker-compose up

Recreating nextcloud_nextcloudpi_1
Attaching to nextcloud_nextcloudpi_1
nextcloudpi_1  | Starting PHP-fpm
nextcloudpi_1  | Starting Apache
nextcloudpi_1  | AH00112: Warning: DocumentRoot [/var/www/nextcloud] does not exist
nextcloudpi_1  | AH00112: Warning: DocumentRoot [/var/www/nextcloud] does not exist
nextcloudpi_1  | (2)No such file or directory: AH02291: Cannot access directory '/var/www/nextcloud/data/' for error log of vhost defined at /etc/apache2/sites-enabled/nextcloud.conf:2
nextcloudpi_1  | AH00014: Configuration check failed
nextcloudpi_1  | Action 'start' failed.
nextcloudpi_1  | The Apache error log may have more information.
nextcloudpi_1  | Starting Redis
nextcloudpi_1  | Starting Cron
nextcloudpi_1  | Starting Postfix
nextcloudpi_1  | Uninitialized instance, running nc-init...
nextcloudpi_1  | Activating nc-init
nextcloudpi_1  | Setting up a clean Nextcloud instance... wait until message 'NC init done'
nextcloudpi_1  | Setting up database...
nextcloudpi_1  | 2018-02-08  7:39:26 1995456512 [Note] mysqld (mysqld 10.1.26-MariaDB-0+deb9u1) starting as process 138 ...
nextcloudpi_1  | 2018-02-08  7:39:26 1995456512 [Warning] Can't create test file /data/database/77ec3c08cf83.lower-test
nextcloudpi_1  | mysqld: Can't change dir to '/data/database/' (Errcode: 2 "No such file or directory")
nextcloudpi_1  | 2018-02-08  7:39:26 1995456512 [ERROR] Aborting
nextcloudpi_1  | 
nextcloudpi_1  | ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111 "Connection refused")
nextcloudpi_1  | Init done

I am using docker version 18.02.0-ce, installed via test.docker.com script.

Any help would be highly appreciated.

@btobi

Ahh I see,

The reason is that the contents of /data are copied to the new named volume as it is created (the first time you run it).

I guess that out of the box, doing a folder mount is not supported. You could try mounting it in /data/data

I’ll think about this to improve it too

@nachoparker

I get no errors when mounting /data/data, but as I see this, my files are stored under /data/app/data/admin/files (if I am user admin), so i do not see any files if mounting /data/data. Mounting /data/app/data/admin/files I have again permission issues, and cannot store any data in nextcloud.

Also if I rerun docker-compose up then a new instance of nextcloud is created every time. I guess it’s important to persist the /data directory, not just the personal files.

My use case is, that I want to mount an external SSD to /data, to store all nextcloud related data not on the raspberry’s SD but on an external drive.