linuxserver / docker-nextcloud

GNU General Public License v3.0
705 stars 128 forks source link

Incremental upgrade process isn't working, everything is borked now. #336

Closed BartAgterbosch closed 1 year ago

BartAgterbosch commented 1 year ago

Is there an existing issue for this?

Current Behavior

So, I was on version 25.0.4, and wanted to upgrade to the latest version, as I've always done. I'm running linuxserver nextcloud in docker on ubuntu server, next to a mariadb container. Everything worked fine before the upgrade mind you..

So, in portainer I went into edit container, specified the image lscr.io/linuxserver/nextcloud:version-26.0.2 and "always pull image" -> deploy container. Then in the terminal run sudo docker exec -it nextcloud updater.phar, say yes to continue update, say yes to run occ upgrade, say no to disable maintenance mode. Restart the container, then look at version.php, and the version indeed corresponds.

At this point however I'm greeted with an nginx 404 no found (but no error messages in the log apart from cron)... So, I edit the container again, this time I download lscr.io/linuxserver/nextcloud:latest, pull the latest image, restart the container, then go into the mariadb container and do the same thing, now after the logs say updater.phar is no longer available in the nextcloud container, indicating that I should be on the correct version. The logs however after stating "Migrating legacy install (this can take a while) ...)" state "Can't start Nextcloud because the version of the data (25.0.5.1) is more than one major version behind the docker image version (27.0.0.8) and upgrading more than one major version is not supported. Please run an image tagged for the major version 26 first.".

Why is this happening? Did I miss a step in the upgrade process? The version.php file clearly said it was on the 26.0.2 version when I checked, and I upgraded the latest version of the mariadb image by grabbing lscr.io/linuxserver/mariadb:latest. It's just not having it, when I reach version 27 the 404 not found changes to an openresty 502 bad gateway.

I'm not sure what I did wrong here, I think I followed the instructions on https://info.linuxserver.io/issues/2023-06-25-nextcloud/ to the letter.

Downgrading after this doesn't work anymore either, since I cannot get it to drop back down to 25.0.4 from 26.0.2, it stays on 26.0.2 no matter what, so I'm stuck on the 404 not found. This has happened to me before but at least then I could downgrade back to a working version. All the data is still present though, and I can still exec into the nextcloud container and ping outwards.

Another curious thing is when I'm on version 26, and run updater.phar, it tells me this: Current version is 26.0.2.

Update to Nextcloud 25.0.8 available. (channel: "stable") Following file will be downloaded automatically: https://download.nextcloud.com/server/releases/nextcloud-25.0.8.zip Open changelog ↗

The config.php file however (unlike the version.php file) tells me 'version' => '25.0.5.1', regardless of which version I'm at. It happened immediately after the nextcloud update, and all other containers behind nginx still work fine, so I'm assuming the fault here lies solely in the nextcloud container. And I don't think I have done anything other than usual in the steps...

Expected Behavior

No response

Steps To Reproduce

I don't know if it is reproducible. But upgrading incrementally from version 25.0.4 to the latest v27, behind npm, using portainer and the terminal

Environment

- OS: Latest Ubuntu server.
- How docker service was installed: yaml.

CPU architecture

x86-64

Docker creation

---
version: "2.1"
services:
  nextcloud_2:
    image: lscr.io/linuxserver/nextcloud:latest
    container_name: nextcloud_2
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Amsterdam
    volumes:
      - <redacted for security>/config:/config
      - <redacted for security>/data:/data
    ports:
      - <redacted for security>
    restart: unless-stopped

services:
  mariadb:
    image: lscr.io/linuxserver/mariadb:latest
    container_name: mariadb
    environment:
      - PUID=1000
      - PGID=1000
      - MYSQL_ROOT_PASSWORD=<redacted for security>
      - TZ=Europe/Amsterdam
      - MYSQL_DATABASE=<redacted for security>
      - MYSQL_USER=<redacted for security>
      - MYSQL_PASSWORD=<redacted for security>
    volumes:
      - /home/bart/sql:/config
    ports:
      - <redacted for security>
    restart: unless-stopped

Container logs

Version 26: GID/UID
───────────────────────────────────────
User UID:    1000
User GID:    1000
───────────────────────────────────────
using keys found in /config/keys
**** The following active confs have different version dates than the samples that are shipped. ****
**** This may be due to user customization or an update to the samples. ****
**** You should compare the following files to the samples in the same folder and update them. ****
**** Use the link at the top of the file to view the changelog. ****
┌────────────┬────────────┬────────────────────────────────────────────────────────────────────────┐
│  old date  │  new date  │ path                                                                   │
├────────────┼────────────┼────────────────────────────────────────────────────────────────────────┤
│ 2023-06-23 │ 2023-04-13 │ /config/nginx/site-confs/default.conf                                  │
└────────────┴────────────┴────────────────────────────────────────────────────────────────────────┘
**** The following site-confs have extensions other than .conf ****
**** This may be due to user customization. ****
**** You should review the files and rename them to use the .conf extension or remove them. ****
**** nginx.conf will only include site-confs with the .conf extension. ****
/config/nginx/site-confs/default
/config/nginx/site-confs/default.conf.bak
/config/nginx/site-confs/default.conf.bak2
[custom-init] No custom files found, skipping...
[ls.io-init] done.
Could not open input file: /app/www/public/cron.php

Version 27: GID/UID
───────────────────────────────────────
User UID:    1000
User GID:    1000
───────────────────────────────────────
using keys found in /config/keys
Can't start Nextcloud because the version of the data (25.0.5.1) is more than one major version behind the docker image version (27.0.0.8) and upgrading more than one major version is not supported. Please run an image tagged for the major version 26 first.
github-actions[bot] commented 1 year ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

BartAgterbosch commented 1 year ago

the mariadb container however is saying the following when nextcloud is at v26: Caught SIGTERM signal! cat: /var/run/mysqld/mysqld.pid: No such file or directory 230718 19:44:55 mysqld_safe Logging to '/config/databases/3b166118e54b.err'. 230718 19:44:55 mysqld_safe Starting mariadbd daemon with databases from /config/databases

No idea if that is any help...

BartAgterbosch commented 1 year ago

I solved it by first running sudo docker exec -it mariadb mariadb-upgrade -u root -p my_password after upgrading mariadb to the latest version (after nextcloud was at version 27), then going into the nextcloud container (which was still claiming to be 2 versions behind), and manually editing the config.php file in /config/www/nextcloud/config/ from 'version' => '25.0.5.1' to 'version' => '27.0.0.8', which was the version it was actually on. Then rebooted the nextcloud container, and lo and behold, it started upgrading all the components. Now everything seems to be functioning as it should again, and it's back to being accessible. The admin panel also now claims to be on 27.0.0, so I'm wondering if it by any chance used the config.php file as a check to see what version it was on, and it was perhaps lacking write permissions or something to the config file (not sure why or how but okay). Plus sudo docker exec -it mariadb mysql --version showing that it's also on the latest version and I think it's all good now

nemchik commented 1 year ago

It sounds like you've got MariaDB sorted out, but in case you want to review extra info https://info.linuxserver.io/issues/2023-05-29-mariadb/ has what you would need. If the MariaDB container is starting and there's nothing in the container logs mentioning the need for an upgrade it should be fine.

For Nextcloud lscr.io/linuxserver/nextcloud:version-26.0.2 and run docker exec -it nextcloud updater.phar repeatedly until it says there are no updates available. Then set your image to lscr.io/linuxserver/nextcloud:latest and run

docker exec -it nextcloud mv /config/nginx/site-confs/default.conf /config/nginx/site-confs/default.conf.bak
docker exec -it nextcloud mv /config/nginx/nginx.conf /config/nginx/nginx.conf.bak
docker exec -it nextcloud mv /config/crontabs/root /config/crontabs/root.bak
docker restart nextcloud

Then access the web UI and it may have you run an update in the web UI, which should be fine.

BartAgterbosch commented 1 year ago

Hmyea, but I don't think that was the actual issue, it didn't start initializing til after I manually changed the version number in the config.php file. I have a feeling it was a file permissions issue or something, but I don't think there's any way to check now, either way everything seems to now be in working order