owncloud-docker / server

Docker image for ownCloud community edition
MIT License
439 stars 127 forks source link

Server fails to write crash file #384

Open mybuntu-git2 opened 1 year ago

mybuntu-git2 commented 1 year ago

Thanks for your help I am really stuck at this point. I have an OC docker image (latest) with data folder mounted and permissions set to 777 and external redis and mariadb. I run it on an Odroid N2+ (arm) Ubuntu 22.04 headless as root. I start the container with docker-compose (details at the end) and the server starts correctly but then when attempting access it crashes due to permission to write php crash files.

docker log until crash:

root@odroid:/home/owncloud# docker logs owncloud_server
Creating volume folders...
Creating hook folders...
Waiting for MySQL...
services are ready!
Waiting for Redis...
services are ready!
Removing custom folder...
Linking custom folder...
Removing config folder...
Linking config folder...
Writing config file...
Fixing base perms...
Fixing data perms...
Fixing hook perms...
Upgrading server database...
Writing objectstore config...
Writing php config...
Updating htaccess config...
Writing apache config...
Enabling cron background...
Writing crontab file...
Touching cron configs...
Starting cron daemon...
Starting apache daemon...
[Sat Mar 25 07:41:34.713959 2023] [mpm_prefork:notice] [pid 122] AH00163: Apache/2.4.41 (Ubuntu) configured -- resuming normal operations
[Sat Mar 25 07:41:34.714055 2023] [core:notice] [pid 122] AH00094: Command line: '/usr/sbin/apache2 -f /etc/apache2/apache2.conf -D FOREGROUND'
127.0.0.1 - - [25/Mar/2023:07:42:00 +0000] "GET /status.php HTTP/1.1" 200 303 "-" "curl/7.68.0"
[Sat Mar 25 07:42:17.725423 2023] [php7:warn] [pid 123] [client 10.8.0.6:50858] PHP Warning:  file_put_contents(/var/www/owncloud/data/crash-2023-03-25.log): failed to open stream: No such file or directory in /var/www/owncloud/lib/base.php on line 1038
[Sat Mar 25 07:42:17.725523 2023] [php7:warn] [pid 123] [client 10.8.0.6:50858] PHP Warning:  file_put_contents(/var/www/owncloud/data/crash-2023-03-25.log): failed to open stream: No such file or directory in /var/www/owncloud/lib/base.php on line 1038
10.8.0.6 - - [25/Mar/2023:07:42:17 +0000] "GET / HTTP/1.1" 599 363 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 16_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Mobile/15E148 Safari/604.1"

this is the compose file:

version: "3"

services:
  owncloud:
    image: owncloud/server:latest
    deploy:
      resources:
        limits:
         cpus: '3'
         memory: 800M
    container_name: owncloud_server
    #restart: unless-stopped
    ports:
      - 8080:8080
    environment:
      - HTTP_PORT=8080
      - OWNCLOUD_DOMAIN=192.168.17.3
      - OWNCLOUD_TRUSTED_DOMAINS=localhost,192.168.17.1,192.168.100.1,192.168.1.1,10.8.0.1,0.0.0.0
      - OWNCLOUD_TRUSTED_PROXIES=192.168.17.3
      - OWNCLOUD_DB_TYPE=mysql
      - OWNCLOUD_DB_NAME=owncloud_docker_1
      - OWNCLOUD_DB_USERNAME=owncloud
      - OWNCLOUD_DB_PASSWORD=mypass
      - OWNCLOUD_DB_HOST=192.168.17.3
      - OWNCLOUD_ADMIN_USERNAME=myuser
      - OWNCLOUD_ADMIN_PASSWORD=mypassword
      - OWNCLOUD_MYSQL_UTF8MB4=true
      - OWNCLOUD_REDIS_ENABLED=true
      - OWNCLOUD_REDIS_HOST=192.168.17.3
    healthcheck:
      test: ["CMD", "/usr/bin/healthcheck"]
      interval: 30s
      timeout: 10s
      retries: 5
    volumes:
      - /home/owncloud/docker_mnt/data:/mnt/data

I verified and there is no crash file under data persistent folder, and I run the compose as root. As long as I do not attempt accessing the webui, the server is up and running.

mybuntu-git2 commented 1 year ago

Hi, I see there is a question label, let me know if I have to provide more information.

xoxys commented 1 year ago

As this is most likely a setup issue, please use the forum https://central.owncloud.org/ for general questions next time.

I'm not able to reproduce it. While using your compose file, I can use the Web UI as intended without any issue. Besides that, the crash file line in your log is just a warning and not an error. Do you get an error on the Web UI? Please also check the owncloud.log.

xoxys commented 1 year ago

Need to correct myself. During a server crash, the regular logger isn't used, and the UI might now show anything as well. Need to check with the engineering team.

xoxys commented 1 year ago

We still need to find a way to handle the crash log properly within the container, but as a workaround, can you add another mount to /var/www/owncloud/data/ to collect the crash log? I'm wondering why the server crashes at all.

mybuntu-git2 commented 1 year ago

Hi, I added another line

- /home/owncloud/docker_mnt_test:/var/www/owncloud/data

In the docker-compose and did chown 777 docker_mnt_test Now when I start with docker-compose up or docker-compose up -d, it crashes during startup.

xoxys commented 1 year ago

And whats the error?

mybuntu-git2 commented 1 year ago

I don’t have any crash file as before. The new mount is empty, the old one contains as usual apps, config, sessions, files

xoxys commented 1 year ago

Yes but if the container startup fails now there has to be something in the docker logs.

mybuntu-git2 commented 1 year ago

Ok, slight improvement after rerunning and reboot. The machine still crashes when I try to access the webui of owncloud after the latest changes, but I do have a log, and it ends like this: [Mon Apr 03 15:46:48.918551 2023] [mpm_prefork:notice] [pid 126] AH00163: Apache/2.4.41 (Ubuntu) configured -- resuming normal operations [Mon Apr 03 15:46:48.918625 2023] [core:notice] [pid 126] AH00094: Command line: '/usr/sbin/apache2 -f /etc/apache2/apache2.conf -D FOREGROUND' 127.0.0.1 - - [03/Apr/2023:15:47:14 +0000] "GET /status.php HTTP/1.1" 200 303 "-" "curl/7.68.0". still docker_mnt_test is empty.

xoxys commented 1 year ago

I don't know how to help further. The log snippet you have posted does not indicate any error, it's just a regular log of the ownCloud container. I'm still not able to reproduce any behavior. Mounting /var/www/owncloud/data works for me, and even forcing the server to crash works and creates an accessible crash log at /var/www/owncloud/data now.

mybuntu-git2 commented 1 year ago

Hi, are you testing the arm docker build?

xoxys commented 1 year ago

Tested arm64 on a Raspberry Pi, the arm (32 bit) image is discontinued and no longer maintained. However, I don't think the issue is related to the arch.