Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On upgrade: Warning: /var/www/html/config/….config.php differs from the latest version of this image at /usr/src/nextcloud/config/….config.php #2266

Closed
rugk opened this issue Jul 19, 2024 · 10 comments

Comments

@rugk
Copy link
Contributor

rugk commented Jul 19, 2024

When upgrading from Nextcloud 28 to Nextcloud 29 I got these warnings. As they relate to stuff inside of the image and no plugins or configs, which are thought to be adjusted, I thought this might be wrong (or it would not be a warning, would it?):

Jul 19 01:46:44 *********** nextcloud_nc_1[16123]: Initializing finished
Jul 19 01:46:44 *********** nextcloud_nc_1[16123]: Warning: /var/www/html/config/apcu.config.php differs from the latest version of this image at /usr/src/nextcloud/config/apcu.config.php
Jul 19 01:46:44 *********** nextcloud_nc_1[16123]: Warning: /var/www/html/config/apps.config.php differs from the latest version of this image at /usr/src/nextcloud/config/apps.config.php
Jul 19 01:46:44 *********** nextcloud_nc_1[16123]: Warning: /var/www/html/config/autoconfig.php differs from the latest version of this image at /usr/src/nextcloud/config/autoconfig.php
Jul 19 01:46:44 *********** nextcloud_nc_1[16123]: Warning: /var/www/html/config/redis.config.php differs from the latest version of this image at /usr/src/nextcloud/config/redis.config.php
Jul 19 01:46:44 *********** nextcloud_nc_1[16123]: Warning: /var/www/html/config/reverse-proxy.config.php differs from the latest version of this image at /usr/src/nextcloud/config/reverse-proxy.config.php
Jul 19 01:46:44 *********** nextcloud_nc_1[16123]: Warning: /var/www/html/config/s3.config.php differs from the latest version of this image at /usr/src/nextcloud/config/s3.config.php
Jul 19 01:46:44 *********** nextcloud_nc_1[16123]: Warning: /var/www/html/config/smtp.config.php differs from the latest version of this image at /usr/src/nextcloud/config/smtp.config.php
Jul 19 01:46:44 *********** nextcloud_nc_1[16123]: Warning: /var/www/html/config/swift.config.php differs from the latest version of this image at /usr/src/nextcloud/config/swift.config.php
Jul 19 01:46:44 *********** nextcloud_nc_1[16123]: Warning: /var/www/html/config/upgrade-disable-web.config.php differs from the latest version of this image at /usr/src/nextcloud/config/upgrade-disable-web.config.php
Jul 19 01:46:44 *********** nextcloud_nc_1[16123]: => Searching for scripts (*.sh) to run, located in the folder: /docker-entrypoint-hooks.d/before-starting

Compose file (with podman-compose):

version: '3.7'
services:

  caddy:
    image: docker.io/caddy
    restart: unless-stopped
    ports:
      - "1001:80"
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile:ro,z
      - caddy_data:/data
      - caddy_config:/config
      - nc_data:/var/www/html
    networks:
      - caddynet
    depends_on:
      - nc
    healthcheck:
      # https://stackoverflow.com/a/47722899/5008962
      test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost/status.php", "||", "exit", "1"]
      interval: 1m30s
      timeout: 30s
      retries: 3
      start_period: 40s
    labels:
      - io.containers.autoupdate=registry

  nc:
    image: docker.io/nextcloud:29-fpm
    restart: unless-stopped
    volumes: &nextcloud_volumes
      - nc_data:/var/www/html
      # better tmp fs for better performance, see https://github.com/nextcloud/recognize#tmp
      - type: tmpfs
        target: /tmp:exec
      - type: bind
        source: /var/mnt/external/@/nextcloud
        target: /var/mnt/userdata:z
      - type: bind
        source: ${HOME:?HOME variable missing}/nextcloud_config
        target: /var/www/html/config:z
      # workaround for php-fpm issue https://github.com/nextcloud/docker/pull/1766
      - type: bind
        source: ./php-fpm-config/zz-prevent-servererror-onload.conf
        target: /usr/local/etc/php-fpm.d/zz-prevent-servererror-onload.conf:z
    networks:
      - caddynet
      - redisnet
      - dbnet
    environment: &nextcloud_environment
      - REDIS_HOST=redis
      - REDIS_HOST_PASSWORD=${REDIS_HOST_PASSWORD:?REDIS_HOST_PASSWORD variable missing}
      - MYSQL_HOST=db
    env_file: &nextcloud_env_file
      - db-shared.env
    depends_on: &nextcloud_depends_on
      - db
      - redis
    expose:
      - 9000
    labels:
      - io.containers.autoupdate=registry

  redis:
    image: docker.io/redis:alpine
    command: redis-server --requirepass ${REDIS_HOST_PASSWORD:?REDIS_HOST_PASSWORD variable missing}
    restart: unless-stopped
    networks:
      - redisnet
    expose:
      - 6379
    labels:
      - io.containers.autoupdate=registry

  cron:
    image: docker.io/nextcloud:29-fpm
    restart: unless-stopped
    volumes: *nextcloud_volumes
    entrypoint: /cron.sh
    networks:
    - redisnet
    - dbnet
    environment: *nextcloud_environment
    env_file: *nextcloud_env_file
    depends_on: *nextcloud_depends_on
    labels:
      - io.containers.autoupdate=registry

  db:
    image: docker.io/mariadb:10.6
    command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
    restart: unless-stopped
    volumes:
      - db_data:/var/lib/mysql
      # workaround for "Too many connections"
      - type: bind
        source: ./mariadb-config/increase-active-connections.cnf
        target: /etc/mysql/conf.d/increase-active-connections.cnf:z
    networks:
      - dbnet
    environment:
      - MARIADB_AUTO_UPGRADE=1
      - MARIADB_DISABLE_UPGRADE_BACKUP=1
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:?MYSQL_ROOT_PASSWORD variable missing}
    env_file:
      - db-shared.env
    expose:
      - 3306
    labels:
      - io.containers.autoupdate=registry

volumes:
  db_data:
  nc_data:
  caddy_data:
  caddy_config:

networks:
  caddynet:
  dbnet:
  redisnet:

Startup command for testing is: podman-compose -p nextcloud down&&podman-compose --in-pod=0 -p nextcloud up -d

Config

{
    "system": {
        "memcache.local": "\\OC\\Memcache\\Redis",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        # ...
        "app_install_overwrite": [
            "ransomware_protection",
            "bookmarks_fulltextsearch",
            "news"
        ],
        "maintenance_window_start": 1
    }
}

Images used

$ podman ps -a
CONTAINER ID  IMAGE                                    COMMAND               CREATED         STATUS                    PORTS                                                     NAMES
[…]
1b9b98b17158  docker.io/library/redis:alpine           redis-server --re...  18 minutes ago  Up 18 minutes             6379/tcp                                                  nextcloud_redis_1
e3b3df7d8cd7  docker.io/library/mariadb:10.6           --transaction-iso...  18 minutes ago  Up 18 minutes             3306/tcp                                                  nextcloud_db_1
20ca0cfb875e  docker.io/library/nextcloud:29-fpm       php-fpm               18 minutes ago  Up 18 minutes             9000/tcp                                                  nextcloud_nc_1
e91d4a1132e1  docker.io/library/nextcloud:29-fpm                             18 minutes ago  Up 17 minutes             9000/tcp                                                  nextcloud_cron_1
2beaab8b3406  docker.io/library/caddy:latest           caddy run --confi...  17 minutes ago  Up 17 minutes (healthy)   0.0.0.0:1001->80/tcp, 80/tcp, 443/udp, 443/tcp, 2019/tcp  nextcloud_caddy_1
$ podman inspect nextcloud_nc_1
[
     {
          "Id": "20ca0cfb875e2f068c24c50167b9b74ddc18c3dd400ae4ca7093b4f97c144f58",
          "Created": "2024-07-19T01:43:08.855975341+02:00",
          "Path": "/entrypoint.sh",
          "Args": [
               "php-fpm"
          ],
          "State": {
               "OciVersion": "1.2.0",
               "Status": "running",
               "Running": true,
               "Paused": false,
               "Restarting": false,
               "OOMKilled": false,
               "Dead": false,
               "Pid": 16125,
               "ConmonPid": 16123,
               "ExitCode": 0,
               "Error": "",
               "StartedAt": "2024-07-19T01:43:20.167168212+02:00",
               "FinishedAt": "0001-01-01T00:00:00Z",
               "CgroupPath": "/user.slice/user-1002.slice/[email protected]/user.slice/libpod-20ca0cfb875e2f068c24c50167b9b74ddc18c3dd400ae4ca7093b4f97c144f58.scope",
               "CheckpointedAt": "0001-01-01T00:00:00Z",
               "RestoredAt": "0001-01-01T00:00:00Z"
          },
          "Image": "ef280332235c73485674637060ffbe0154d3d60a7da345114e0424dca9da15e6",
          "ImageDigest": "sha256:d2dc74b2ce5fc6b06e1bf454320bb6388817757b41314a0214af4eac278a3c42",
          "ImageName": "docker.io/library/nextcloud:29-fpm",
[…]

System

$ podman --version
podman version 5.1.1
$ podman-compose --version
podman-compose version 1.2.0
podman version 5.1.1
$ rpm-ostree status -b
[…]
● fedora:fedora/x86_64/coreos/stable
                  Version: 40.20240701.3.0 (2024-07-16T16:03:29Z)
               BaseCommit: 45982eca152d020f23a547813538939e9bfdcfefc8c059e88970d1bbf4ada0bb
             GPGSignature: Valid signature by 115DF9AEF857853EE8445D0A0727707EA15B79CC
          LayeredPackages: ***

Fedora CoreOS 40

Expected result

IMHO no warnings about such a file should be issued if I am using an official container image. In such an image, I expect all files to pass the validity check for obvious reasons… this warning is thus somewhat disturbing.

Current result

Warning, see above

@ralfi
Copy link

ralfi commented Jul 19, 2024

Same here, and upgrade scripts to 29.0.4 will not work.

@ralfi
Copy link

ralfi commented Jul 19, 2024

Sorry, my mistake. Not changig to the latest image tag... Now upgrade scripts are working but warnings still appears

@joshtrichards
Copy link
Member

joshtrichards commented Jul 19, 2024

As they relate to stuff inside of the image and no plugins or configs,

It's referencing your configs stored on persistent storage, not something in the image.

Docs w/ explanation: https://github.com/nextcloud/docker?tab=readme-ov-file#auto-configuration-and-nextcloud-updates

Additional references:

@joshtrichards joshtrichards pinned this issue Jul 19, 2024
@joshtrichards joshtrichards closed this as not planned Won't fix, can't repro, duplicate, stale Jul 19, 2024
@rugk
Copy link
Contributor Author

rugk commented Jul 28, 2024

Ah, would be great if the error message could link to the description or so or otherwise make it clear, that one can copy the files from the target to the source to fix this.

As I've never modified the multiple files, and I actually also, as aah… as far as I see now, I never even had copied the original files. I still have only one config.php file in there, how it used to be in dunno… many, many versions ago:

$ podman-compose exec nc sh
# cd /var/www/html/config
# ls -la
total 12
drwxrwxr-x. 1 www-data www-data  100 Jan 24  2022 .
drwxr-xr-x. 1 www-data www-data  554 Jul 25 09:23 ..
-rw-r-----. 1 www-data www-data 2787 Jul 25 09:24 config.php
-rw-r--r--. 1 www-data www-data  319 Feb 29 11:56 mimetypealiases.json
-rw-r--r--. 1 www-data www-data  439 Feb 29 11:56 mimetypemapping.json

Is there any good upgrade migration/path/recommendation on how to split the file, apparently?

Also the JSON files are apparently created by Nextcloud or by me for some extension (OnlyOffice or Nextcloud Office maybe?):

# cat mimetypealiases.json
{
    "": "x-office/document",
    "application/vnd.openxmlformats-officedocument.wordprocessingml.document.docxf": "x-office/document",
    "application/vnd.openxmlformats-officedocument.wordprocessingml.document.oform": "x-office/document",
    "application/x-ownpad": "pad",
    "application/x-ownpad-calc": "calc"
}# cat mimetypemapping.json
{
    "pad": [
        "application/x-ownpad"
    ],
    "calc": [
        "application/x-ownpad-calc"
    ],
    "maps": [
        "application/x-nextcloud-maps"
    ],
    "noindex": [
        "application/x-nextcloud-noindex"
    ],
    "nomedia": [
        "application/x-nextcloud-nomedia"
    ],
    "noimage": [
        "application/x-nextcloud-noimage"
    ],
    "notrack": [
        "application/x-nextcloud-maps-notrack"
    ]

@joshtrichards
Copy link
Member

Ah, would be great if the error message could link to the description or so or otherwise make it clear, that one can copy the files from the target to the source to fix this.

I think we did have a link in the warning at one point during development but removed it to streamline things. Oops. 🤣

Is there any good upgrade migration/path/recommendation on how to split the file, apparently?

You shouldn't have to split anything. Basically just add the additional files and leave your existing config.php in place.

Also the JSON files are apparently created by Nextcloud or by me for some extension (OnlyOffice or Nextcloud Office maybe?):

Those can stay in place.

Essentially anything you have is fine. The additional files are for supporting all the documented Docker auto-configuration stuff (mostly) and a few other requirements like disabling the web updater (which is never to be used with the Docker image).

@rugk
Copy link
Contributor Author

rugk commented Jul 31, 2024

I think we did have a link in the warning at one point during development but removed it to streamline things. Oops. 🤣

I am unsure what streamlining would mean in that context and how removing such a link helps there, but if you want then well… re-add it?

Also the Readme says:

Keep in mind that once set, removing these environment variables won't remove these values from the configuration file, due to how Nextcloud merges configuration files together.

This is not true anymore, is it? The config PHP's always read the env via getenv, so updates should be processed? The PHP files itself are not ovrwritten/changed, after all?

@joshtrichards joshtrichards changed the title On upgrade warnigs about PHP files differing are issued: "Warning: /var/www/html/config/….config.php differs from the latest version of this image at /usr/src/nextcloud/config/….config.php" On upgrade: Warning: /var/www/html/config/….config.php differs from the latest version of this image at /usr/src/nextcloud/config/….config.php Aug 27, 2024
@hufhend
Copy link

hufhend commented Aug 30, 2024

The exact same thing happened to me. I run on K8s and upgraded a few months back via helm and major release. Step by step.
A bit awkward is that in the mounted repository the files are newer (today's) than in the image.

Which is weird. However, I replaced them all on the remote server with the version from the image and it didn't help.

Error:

Warning: /var/www/html/config/apache-pretty-urls.config.php differs from the latest version of this image at /usr/src/nextcloud/config/apache-pretty-urls.config.php
Warning: /var/www/html/config/apcu.config.php differs from the latest version of this image at /usr/src/nextcloud/config/apcu.config.php
Warning: /var/www/html/config/apps.config.php differs from the latest version of this image at /usr/src/nextcloud/config/apps.config.php
Warning: /var/www/html/config/autoconfig.php differs from the latest version of this image at /usr/src/nextcloud/config/autoconfig.php
Warning: /var/www/html/config/redis.config.php differs from the latest version of this image at /usr/src/nextcloud/config/redis.config.php
Warning: /var/www/html/config/smtp.config.php differs from the latest version of this image at /usr/src/nextcloud/config/smtp.config.php
=> Searching for scripts (*.sh) to run, located in the folder: /docker-entrypoint-hooks.d/before-starting
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.233.116.160. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.233.116.160. Set the 'ServerName' directive globally to suppress this message
[Fri Aug 30 20:04:35.830029 2024] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.59 (Debian) PHP/8.2.21 configured -- resuming normal operations
[Fri Aug 30 20:04:35.830046 2024] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
192.168.3.101 - - [30/Aug/2024:20:04:54 +0000] "GET /status.php HTTP/1.1" 500 410 "-" "kube-probe/1.29"
192.168.3.101 - - [30/Aug/2024:20:04:54 +0000] "GET /status.php HTTP/1.1" 500 410 "-" "kube-probe/1.29"
192.168.3.101 - - [30/Aug/2024:20:05:04 +0000] "GET /status.php HTTP/1.1" 500 410 "-" "kube-probe/1.29"
192.168.3.101 - - [30/Aug/2024:20:05:04 +0000] "GET /status.php HTTP/1.1" 500 410 "-" "kube-probe/1.29"
192.168.3.101 - - [30/Aug/2024:20:05:14 +0000] "GET /status.php HTTP/1.1" 500 410 "-" "kube-probe/1.29"
192.168.3.101 - - [30/Aug/2024:20:05:14 +0000] "GET /status.php HTTP/1.1" 500 410 "-" "kube-probe/1.29"
[Fri Aug 30 20:05:14.527831 2024] [mpm_prefork:notice] [pid 1] AH00170: caught SIGWINCH, shutting down gracefully
192.168.3.101 - - [30/Aug/2024:20:05:14 +0000] "GET /status.php HTTP/1.1" 500 410 "-" "kube-probe/1.29"

And it doesn't load.

@hufhend
Copy link

hufhend commented Aug 30, 2024

Since I have a backup, but only a one-day backup, I deleted the files mentioned above and hoped that Nextcloud would handle it somehow. Unfortunately, it didn't. So neither overwriting the files on the server nor deleting them helped.

Worse, however, is that I'm losing track of where it actually sees the files. Somehow it doesn't make sense to me:

❯ oc exec -it nextcloud-78b49fb7f6-8nf8d -- su -s /bin/sh www-data -c bash
Defaulted container "nextcloud" out of: nextcloud, nextcloud-cron, postgresql-isready (init)
bash: cannot set terminal process group (244): Inappropriate ioctl for device
bash: no job control in this shell
www-data@nextcloud-78b49fb7f6-8nf8d:~/html$ df -h
Filesystem                                                                          Size  Used Avail Use% Mounted on
overlay                                                                             232G  159G   62G  73% /
tmpfs                                                                                64M     0   64M   0% /dev
192.168.15.64:/data/cloud/nfs/pvc-ba68e36a-d900-402b-aa9a-fe856e170943/root         2.0T  266G  1.7T  14% /var/www
/dev/mapper/vgubuntu-root                                                           232G  159G   62G  73% /etc/hosts
shm                                                                                  64M     0   64M   0% /dev/shm
192.168.15.64:/data/cloud/nfs/pvc-ba68e36a-d900-402b-aa9a-fe856e170943/html         2.0T  266G  1.7T  14% /var/www/html
192.168.15.64:/data/cloud/nfs/pvc-ba68e36a-d900-402b-aa9a-fe856e170943/tmp          2.0T  266G  1.7T  14% /var/www/tmp
192.168.15.64:/data/cloud/nfs/pvc-ba68e36a-d900-402b-aa9a-fe856e170943/data         2.0T  266G  1.7T  14% /var/www/html/data
192.168.15.64:/data/cloud/nfs/pvc-ba68e36a-d900-402b-aa9a-fe856e170943/config       2.0T  266G  1.7T  14% /var/www/html/config
192.168.15.64:/data/cloud/nfs/pvc-ba68e36a-d900-402b-aa9a-fe856e170943/custom_apps  2.0T  266G  1.7T  14% /var/www/html/custom_apps
192.168.15.64:/data/cloud/nfs/pvc-ba68e36a-d900-402b-aa9a-fe856e170943/themes       2.0T  266G  1.7T  14% /var/www/html/themes
tmpfs                                                                                32G   12K   32G   1% /run/secrets/kubernetes.io/serviceaccount
tmpfs                                                                                16G     0   16G   0% /proc/asound
tmpfs                                                                                16G     0   16G   0% /proc/acpi
tmpfs                                                                                16G     0   16G   0% /proc/scsi
tmpfs                                                                                16G     0   16G   0% /sys/firmware
www-data@nextcloud-78b49fb7f6-8nf8d:~/html$ diff /var/www/html/config/apache-pretty-urls.config.php /usr/src/nextcloud/config/apache-pretty-urls.config.php
4c4
< );
\ No newline at end of file
---
> );
www-data@nextcloud-78b49fb7f6-8nf8d:~/html

And beware, this is on the server:

root@server:/data/cloud/nfs/pvc-ba68e36a-d900-402b-aa9a-fe856e170943/config# ls -la apache-pretty-urls.config.php 
-rwxrwxr-x 1 root www-data 0 Apr 16 20:05 apache-pretty-urls.config.php

In helm chart values there is only this and nothing has changed

persistence:
  enabled: true
  storageClass: "nfs-csi"
  accessMode: ReadWriteMany

@hufhend
Copy link

hufhend commented Aug 30, 2024

How do I revert to an older working version?

@joshtrichards
Copy link
Member

@hufhend

192.168.3.101 - - [30/Aug/2024:20:04:54 +0000] "GET /status.php HTTP/1.1" 500 410 "-" "kube-probe/1.29"

You're getting 500 errors - something else is going on here for you. The warnings about older config files would not cause this from just a simple image update. To figure out why you're getting those 500 errors you'd need to check your nextcloud.log. Either way, outside the scope of this issue. Might want to try the help forum - https://help.nextcloud.com

rugk added a commit to rugk/docker that referenced this issue Oct 24, 2024
As for nextcloud#2266 and the re-appearing message IMHO, it is quite convenient to have a command to copy here if you just have not changed any config files…

Signed-off-by: rugk <[email protected]>
J0WI pushed a commit that referenced this issue Nov 7, 2024
As for #2266 and the re-appearing message IMHO, it is quite convenient to have a command to copy here if you just have not changed any config files…

Signed-off-by: rugk <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants