linuxserver / docker-nextcloud

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

Container fails to start as version of PHP is too new #267

Closed Maelstromeous closed 2 years ago

Maelstromeous commented 2 years ago

In SHA version sha256:1358eeb15362cd1ed60ea22d44a481e9819da9745eeaa3751e823f402da86fe1 or 50f0e4fe9593 from Dockerhub (should be amd64 latest, image tag 25.0.0 as of writing) the container will fail to load the web UI with the following error:

This version of Nextcloud is not compatible with > PHP 7.4.
You are currently running 8.0.18.

Expected Behavior

This error should not occur and the web UI should load normally.

Current Behavior

This error occurs upon loading the web UI.

Steps to Reproduce

  1. Pull latest image
  2. Run image
  3. Open web UI

Environment

OS: Linux / Unraid CPU architecture: amd64 How docker service was installed: Shouldn't matter, but via Unraid internals

Command used to create docker container (run/create/compose/screenshot)

Presumbly docker run, unraid takes care of it.

Docker logs

root@NAS:~# docker logs ffb8dff7fb87
[custom-init] No custom services found, skipping...
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service 00-legacy: starting
s6-rc: info: service 00-legacy successfully started
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/01-envfile
cont-init: info: /etc/cont-init.d/01-envfile exited 0
cont-init: info: running /etc/cont-init.d/01-migrations
[migrations] started
[migrations] 01-nginx-site-confs-default: skipped
[migrations] done
cont-init: info: /etc/cont-init.d/01-migrations exited 0
cont-init: info: running /etc/cont-init.d/10-adduser

-------------------------------------
          _         ()
         | |  ___   _    __
         | | / __| | |  /  \
         | | \__ \ | | | () |
         |_| |___/ |_|  \__/

Brought to you by linuxserver.io
-------------------------------------

To support LSIO projects visit:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------

User uid:    99
User gid:    100
-------------------------------------

cont-init: info: /etc/cont-init.d/10-adduser exited 0
cont-init: info: running /etc/cont-init.d/11-folders
cont-init: info: /etc/cont-init.d/11-folders exited 0
cont-init: info: running /etc/cont-init.d/12-samples
cont-init: info: /etc/cont-init.d/12-samples exited 0
cont-init: info: running /etc/cont-init.d/13-nginx
cont-init: info: /etc/cont-init.d/13-nginx exited 0
cont-init: info: running /etc/cont-init.d/14-php
cont-init: info: /etc/cont-init.d/14-php exited 0
cont-init: info: running /etc/cont-init.d/15-keygen
using keys found in /config/keys
cont-init: info: /etc/cont-init.d/15-keygen exited 0
cont-init: info: running /etc/cont-init.d/20-permissions
cont-init: info: /etc/cont-init.d/20-permissions exited 0
cont-init: info: running /etc/cont-init.d/40-config
cont-init: info: /etc/cont-init.d/40-config exited 0
cont-init: info: running /etc/cont-init.d/50-install
cont-init: info: /etc/cont-init.d/50-install exited 0
cont-init: info: running /etc/cont-init.d/60-memcache
cont-init: info: /etc/cont-init.d/60-memcache exited 0
cont-init: info: running /etc/cont-init.d/70-aliases
cont-init: info: /etc/cont-init.d/70-aliases exited 0
cont-init: info: running /etc/cont-init.d/85-version-checks
**** 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. ****
/config/nginx/nginx.conf
/config/nginx/site-confs/default.conf

cont-init: info: /etc/cont-init.d/85-version-checks exited 0
cont-init: info: running /etc/cont-init.d/99-custom-files
[custom-init] No custom files found, skipping...
cont-init: info: /etc/cont-init.d/99-custom-files exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service init-mods: starting
s6-rc: info: service init-mods successfully started
s6-rc: info: service init-mods-package-install: starting
s6-rc: info: service init-mods-package-install successfully started
s6-rc: info: service init-mods-end: starting
s6-rc: info: service init-mods-end successfully started
s6-rc: info: service init-services: starting
s6-rc: info: service init-services successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun cron (no readiness notification)
services-up: info: copying legacy longrun nginx (no readiness notification)
services-up: info: copying legacy longrun php-fpm (no readiness notification)
s6-rc: info: service legacy-services successfully started
s6-rc: info: service 99-ci-service-check: starting
[ls.io-init] done.
s6-rc: info: service 99-ci-service-check successfully started
github-actions[bot] commented 2 years ago

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

nemchik commented 2 years ago

Two things:

  1. You likely need to update Nextcloud (see instructions here) - tldr: docker exec -it nextcloud updater.phar
  2. You should take note of the log message instructing you to update your nginx confs

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. /config/nginx/nginx.conf /config/nginx/site-confs/default.conf

Maelstromeous commented 2 years ago
  1. Done, although the version the updater specified was very old (v20.x)
root@NAS:~# docker exec -it nextcloud updater.phar
Nextcloud Updater - version: v20.0.0beta4-11-g68fa0d4

Current version is 20.0.5. <<<< This was very incorrect, it should be around v24 if it's at all close to the nextcloud version

Update to Nextcloud 20.0.14 available. (channel: "stable")
Steps that will be executed:
<steps to do>

Start update? [y/N] Y
<steps completed>
Update of code successful.

Should the "occ upgrade" command be executed? [Y/n] y
This version of Nextcloud is not compatible with > PHP 7.4.<br/>You are currently running 8.0.18.
Keep maintenance mode active? [y/N] n
  1. Yep they were also rather old, however using the default config supplied in https://raw.githubusercontent.com/linuxserver/docker-nextcloud/master/root/defaults/nginx/site-confs/default.conf.sample, it's now coming up with this error in the container logs:

nginx: [emerg] "map" directive is not allowed here in /config/nginx/nginx.conf:4

Maelstromeous commented 2 years ago

Hmm this is very strange, I commented out the map directive thinking it would be fine, also saying the server directive is not allowed now. My nginx is a bit rusty but pretty sure the config is correct. It's the exact same as the sample link, just with map commented out currently, still erroring.

Also wrapped the server block in a http block thinking it was just an inheritance problem and http is defined somewhere else, errors about SSL locations now. Is this the right config sample to use?

Maelstromeous commented 2 years ago

Ah I did a slight dumb, there's two conf files. I've done the following now:

Still getting the PHP version error :(

j0nnymoe commented 2 years ago

You must still be on an old version of nextcloud within the container. You have to continue to run updater.phar until it reaches at least v24.

Maelstromeous commented 2 years ago

It doesn't appear to want to update any further?

root@NAS:/mnt/user/appdata/nextcloud/nginx/site-confs# docker exec -it nextcloud updater.phar
Nextcloud Updater - version: v20.0.0beta4-11-g68fa0d4

Current version is 20.0.14.

Update to Nextcloud 20.0.14 available. (channel: "stable")
Following file will be downloaded automatically: https://download.nextcloud.com/server/releases/nextcloud-20.0.14.zip
Open changelog β†—
nemchik commented 2 years ago

You will need to downgrade your image to a tag where we had php7.4 then do the update command to get nextcloud 24 installed, then switch back to the latest tag.

Maelstromeous commented 2 years ago

Do you have a recommended version @nemchik ? I rolled it back to tag version 24.0.6 which looks like it uses php7.x, updater.phar executes but it still doesn't detect new versions.

Do I have to go to v21 and upgrade path each major version till I get to 25?

Maelstromeous commented 2 years ago

Ah. The occ update didn't work last time, it's now detecting new versions...

I'll update the thread if I'm successful πŸ‘

nemchik commented 2 years ago

24.0.6-ls204

That version of the image should work. You do not have to swap images for each version, just switch to that version, run the update until nextcloud shows you're running v24, then switch to latest.

Maelstromeous commented 2 years ago

Awesome, after about 6 upgrades this issue is resolved. Thank you @nemchik! πŸ™ I'll close the issue now, hopefully this helps someone in the future.

Resolution was:

  1. Downgrade / pin to 24.0.6-ls204 image
  2. Execute docker exec -it nextcloud updater.phar repeatedly until you reach version 25
  3. Reinstate / remove pin to latest image
  4. Restart

If there's NGINX / PHP issues still, replace files (paths are container relative):

ramair02 commented 2 years ago

I seem to be having a similar issue to OP, but downgrading the container on Unraid did not solve the problem. I've updated the default.conf and nginx.conf already. I have downgraded as far as lscr.io/linuxserver/nextcloud:23.0.4-ls181. Should I keep trying to downgrade the container and update the app?

The GUI updater, when I click Continue Update, just kicks me back to the main dashboard. And updating through Console spits out Nextcloud is already latest version. Nextcloud current version is 22.2.10. It says the update that is available is 23.0.10.

root@homegrown:~# docker exec -it nextcloud updater.phar
Nextcloud Updater - version: v20.0.0beta4-11-g68fa0d4

Current version is 22.2.10.

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

Steps that will be executed:
[βœ”] Check for expected files
[βœ”] Check for write permissions
[βœ”] Create backup
[βœ”] Downloading
[βœ”] Verify integrity
[βœ”] Extracting
[βœ”] Enable maintenance mode
[βœ”] Replace entry points
[βœ”] Delete old files
[βœ”] Move new files in place
[βœ”] Done

Continue update? [y/N] y

Info: Pressing Ctrl-C will finish the currently running step and then stops the updater.

[βœ”] Check for expected files
[βœ”] Check for write permissions
[βœ”] Create backup
[βœ”] Downloading
[βœ”] Verify integrity
[βœ”] Extracting
[βœ”] Enable maintenance mode
[βœ”] Replace entry points
[βœ”] Delete old files
[βœ”] Move new files in place
[βœ”] Done

Update of code successful.

Should the "occ upgrade" command be executed? [Y/n] y
Nextcloud is already latest version

Keep maintenance mode active? [y/N] n
Maintenance mode already disabled

Maintenance mode is disabled
nemchik commented 2 years ago

Use the tag 24.0.6-ls204 for our image, regardless of which version of nextcloud you have installed. Do not use another tag.

Just switch to that tag, run docker exec -it nextcloud updater.phar until it says you're up to date (should be nextcloud 25.x, also say yes to the occ updates), then switch to the latest tag and check the container logs for warnings about which nginx configs to update.

ramair02 commented 2 years ago

24.0.6-ls204 and running docker exec -it nextcloud updater.phar still says that I have the latest version.

image

root@homegrown:~# docker exec -it nextcloud updater.phar
Nextcloud Updater - version: v20.0.0beta4-11-g68fa0d4

Current version is 22.2.10.

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

Steps that will be executed:
[βœ”] Check for expected files
[βœ”] Check for write permissions
[βœ”] Create backup
[βœ”] Downloading
[βœ”] Verify integrity
[βœ”] Extracting
[βœ”] Enable maintenance mode
[βœ”] Replace entry points
[βœ”] Delete old files
[βœ”] Move new files in place
[βœ”] Done

Continue update? [y/N] y

Info: Pressing Ctrl-C will finish the currently running step and then stops the updater.

[βœ”] Check for expected files
[βœ”] Check for write permissions
[βœ”] Create backup
[βœ”] Downloading
[βœ”] Verify integrity
[βœ”] Extracting
[βœ”] Enable maintenance mode
[βœ”] Replace entry points
[βœ”] Delete old files
[βœ”] Move new files in place
[βœ”] Done

Update of code successful.

Should the "occ upgrade" command be executed? [Y/n] y
Nextcloud is already latest version

Keep maintenance mode active? [y/N] n
Maintenance mode already disabled

Maintenance mode is disabled

The updater.phar version is v20.0.0beta4-11-g68fa0d4. Not sure if that could have something to do with it? Or maybe that's correct.

ramair02 commented 2 years ago

I think I figured it out. The issue was the two .step files in the data folder. There was .step and .step-previous-update. I moved both out of that folder, restarted the container and now the update seems to be going through.

ramair02 commented 2 years ago

Just a follow up, this did indeed work. After moving those step files out of the data folder, I was able to complete numerous updates and am now on Nextcloud 25.0.0

russellmoran99 commented 2 years ago

You will need to downgrade your image to a tag where we had php7.4 then do the update command to get nextcloud 24 installed, then switch back to the latest tag.

Can you tell me how to do this via unraid? I am assuming I need to edit my unraid docker for next cloud. I just want to make sure before I mess it up. I am having no lucks updated. I went to 20.0.14 but now it says the OCC upgrade will not work because it's not compatible with > 7.4. Thanks

Maelstromeous commented 2 years ago

@russellmoran99 edit the container in unraid and under repository append :24.0.6-ls204

E.g. linuxserver/nextcloud:24.0.6-ls204

russellmoran99 commented 2 years ago

@russellmoran99 edit the container in unraid and under repository append :24.0.6-ls204

E.g. linuxserver/nextcloud:24.0.6-ls204

Thanks - I figured it out before you replied, but I appreciate the quick response. I'm running the OCC upgrade now and about to upgrade to v25. Fingers crossed!

I'm using NGINX proxy manager. Will I need to change the NGINX/PHP files?

russellmoran99 commented 2 years ago

@nemchik @j0nnymoe

I have went to :24.0.0.6-ls204 and ran the updater.phar

Here's my latest error trying to get to 21.0.9

[βœ”] Check for expected files [βœ”] Check for write permissions [βœ”] Create backup [βœ”] Downloading [βœ”] Verify integrity [βœ”] Extracting [βœ”] Enable maintenance mode [βœ”] Replace entry points [ ] Delete old files ...PHP Warning: rmdir(/config/www/nextcloud/updater/../resources): Directory not empty in phar:///config/www/nextcloud/updater/updater.phar/lib/Updater.php on line 871 [✘] Delete old files failed Could not rmdir: /config/www/nextcloud/updater/../resources

Update failed. To resume or retry just execute the updater again.


I was able to get 2 successful updates in without this error message.

Maelstromeous commented 2 years ago

I'm not a maintainer of this project so I can't answer that query, I'm a regular guy same as you

j0nnymoe commented 2 years ago

The command you should be using is updater.phar as per the readme and if the script is having issues to do an rm, it sounds like you might have permissions issues on your appdata share.

russellmoran99 commented 2 years ago

The command you should be using is updater.phar as per the readme and if the script is having issues to do an rm, it sounds like you might have permissions issues on your appdata share.

Makes sense. The part that confuses me is I have had 2 successful updates using update.phar without problems. This one gave me an issue. How do I go about fixing the permissions issue? Thanks

j0nnymoe commented 2 years ago

Not 100% it's a permissions issue, more of a suggestion to investigate yourself to see what user owns your /config mount or maybe restore a back of that then try the update again.

micheldorsey commented 1 year ago

I am experiencing this same problem, but I must have some mixed file versions, since I can't successfully run the updater.phar without an error.

I am running Portainer. Was running version 25 of NextCloud and I stopped the container, then did a recreate on the container with Nextcloud:latest. When it started, I got the error message that I was trying to update from 25 to 27. I changed my version to 26 and did another recreate on the container and it ran, but I could not connect with my client or the web browser. Since then I have tried various version of 26 and did a recreate to no avail. I have also tried to run the updater.phar and it fails with Downloaded version is lower than installed version. I'm a NextCloud noob, so excuse my ignorance.

frodo:/mnt/Main_Data/NextCloud/Data$ docker exec -it nextcloud updater.phar Nextcloud Updater - version: v26.0.0beta2-9-g64e2e4c dirty

Current version is 26.0.2.

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

Steps that will be executed: [ ] Check for expected files [ ] Check for write permissions [ ] Create backup [ ] Downloading [ ] Verify integrity [ ] Extracting [ ] Enable maintenance mode [ ] Replace entry points [ ] Delete old files [ ] Move new files in place [ ] Done

Start update? [y/N] y

Info: Pressing Ctrl-C will finish the currently running step and then stops the updater.

[βœ”] Check for expected files [βœ”] Check for write permissions [ ] Create backup ... [βœ”] Create backup [βœ”] Downloading [βœ”] Verify integrity [✘] Extracting failed Downloaded version is lower than installed version

Update failed. To resume or retry just execute the updater again.

j0nnymoe commented 1 year ago

You're commenting on an year old issue where a lot had changed with this image a few months back. Read through this https://info.linuxserver.io/issues/2023-06-25-nextcloud/ and if you still have further issues, please post on our discord/discourse.