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

Was on image 25.0.4 and now image says 27.0.0 but unable to upgrade #2015

Closed
helsan74 opened this issue Jun 19, 2023 · 18 comments
Closed

Was on image 25.0.4 and now image says 27.0.0 but unable to upgrade #2015

helsan74 opened this issue Jun 19, 2023 · 18 comments
Labels
feature: upgrading Upgrading an existing deployment to a new image/NC version needs info Additional info needed to triage question

Comments

@helsan74
Copy link

helsan74 commented Jun 19, 2023

When I try to upgrade I get:
Exception: Updates between multiple major versions and downgrades are unsupported.

Tried to downgrade to 26.0.2 But says I'm not using the correct image.
Can't start Nextcloud because the version of the data (27.0.0.8) is higher than the docker image version (26.0.2.1) and downgrading is not supported. Are you sure you have pulled the newest image version?

Error when upgrading:
Preparing update
Set log level to debug
Turned on maintenance mode
Exception: Updates between multiple major versions and downgrades are unsupported.

What are my options to fix the issue?

@helsan74
Copy link
Author

Just to clarify
With image 25.0.7.1
Can't start Nextcloud because the version of the data (27.0.0.8) is higher than the docker image version (25.0.7.1) and downgrading is not supported. Are you sure you have pulled the newest image version?

With image version 26.0.2.1 I get the following error:
Can't start Nextcloud because the version of the data (27.0.0.8) is higher than the docker image version (26.0.2.1) and downgrading is not supported. Are you sure you have pulled the newest image version?

With image 27.0 (Latest)
Exception: Updates between multiple major versions and downgrades are unsupported

@martadinata666
Copy link

You may want to override the /var/www/html/version.php, take the nextcloud release https://download.nextcloud.com/server/releases/ copy the version.php to your docker installation. Don't forget backup first. 🤞🏼

@helsan74
Copy link
Author

You may want to override the /var/www/html/version.php, take the nextcloud release https://download.nextcloud.com/server/releases/ copy the version.php to your docker installation. Don't forget backup first. 🤞🏼

So I use the version.php from v27 or v26?

@martadinata666
Copy link

your title said 25, so maybe start from 25?

@helsan74
Copy link
Author

your title said 25, so maybe start from 25?

I just did... and after the reboot it stays in a loop asking to update again: Nextcloud will be updated to version 25.0.7

@helsan74
Copy link
Author

Something is still wrong...
But no longer is asking to upgrade but I'm not able to login.
I get the following now:
The server was unable to complete your request.
If this happens again, please send the technical details below to the server administrator.
More details can be found in the server log.

I pushed version 25.0.4 version.php and image 25.0.4
All my shared link are working at least so I can access my data and files.

I'll go into the logs later. Probably a mismatch between the image and the files.

@frznlogic
Copy link

frznlogic commented Jun 20, 2023

I've had similar issues and keep running into them as I run a docker instance for personal use, and I keep falling behind the versions quite substantially. Recently I went from 24 to 27 in a single step and winded up in the same situation. This is risky and I take no responsibility as I'm a complete noob/idiot at nextcloud things.

  • I set my docker-compose file back to 25.0 version and deleted the version.php file completely.
  • I pulled and started the 25.0 docker image, there's some log texts about it actually initializing...
  • Then I get a webpage telling me I can upgrade via the web interface, or if I'm afraid of timeouts, I could use occ for it.
  • ran a shell with docker-compose exec inside the container, run ./occ upgrade

The next upgrade from 25 to 26 etc i do that in a loop, but no need to delete the version.php file again.

As stated, I take no responsibility for any data loss etc, but it's worked for me.

@helsan74
Copy link
Author

I'll give it a try... thanks for sharing and yes I understand the risky part of it!

@wetneb
Copy link
Contributor

wetneb commented Jun 24, 2023

#1809 has some insights about how to get out of this situation. In my case (upgrading from 24 to 27), I downloaded the .zip archive for 24, replaced the contents of the /var/www/html volume with that, and I could start the Docker image for 24 again. Then, I followed the official upgrade (upgrading one major version at a time, upgrading all apps at each step). Make sure you back everything up (volumes, SQL database) before attempting anything.

To prevent this annoying problem from happening in the future, I have proposed #2018 so that the Docker image does not start the upgrade process at all if the major versions are too far apart.

@JuniorJPDJ
Copy link

It doesn't even upgrade from 25 to 26:

nextcloud-app-1    | 2023-06-25T10:52:21.595186799Z Can't start Nextcloud because the version of the data (
nextcloud-app-1    | 2023-06-25T10:52:21.595262511Z 25.0.8.2) is higher than the docker image version (
nextcloud-app-1    | 2023-06-25T10:52:21.595281691Z 26.0.3.2) and downgrading is not supported. Are you sure you have pulled the newest image version?

@stevenaloha
Copy link

I have no idea what is it with that folder. My /var/www/html only has index.nginx-debian.html. Nothing about nextcloud. What am I doing wrong? I am running in the same issue and can't find a damn version.php.

@Skinner927
Copy link

Skinner927 commented Jul 6, 2023

I just goofed this myself exactly the same and was able to fix everything by basically doing a manual upgrade inside the container.

First of all, you can browse all releases at https://download.nextcloud.com/server/releases/

Per the title, say the last working run was Nextcloud 25 and you mistakenly ran 27. So some install files think they're 27, but others think they're 25. This should work from any version. You just need to do the manual install from one version higher than your last correctly running Nextcloud. So we're going to manually install 26 (25+1).

These instructions are paraphrased notes from the official manual upgrade instructions.

  1. Start the 26 next cloud container (or whatever last working version +1 is) with all the regular mounts and wait until it complains about a bad version.
  • If the container stops, run it again as you normally do, but add the -ti options and the last argument should be /bin/bash. That'll open a shell and keep the container running.
  • If the container continues to run, run docker exec -ti CONTAINER_NAME /bin/bash in another shell to pop into a bash shell inside the container.
  1. You should now be in /var/www/html. Run ls and if you don't see any files then you messed up a mount or something because you should have /var/www/html mounted to a volume or a local bind mount and inside should be a config and data folders. If you don't have at least the data folder then there's no point in doing this fix because you'll have no data. Check your mounts and try again. (this does not apply if you mounted your data directory somewhere else and adjusted your config, but if you deviated from standard install then you'll have to adjust).
  2. If you have automated cronjobs turn them off of you could mess this whole thing up.
  3. Make a backup. You'll use that old-html to restore html if anything goes wrong. later.
cd /var/www
cp -a html old-html
# move old-html into html so it's in a volume/mount so it's not lost
mv old-html html/
  1. Ensure there's no nextcloud directory in /var/www or the next steps will get confusing.
  2. Inside /var/www/html delete everything except the old-html, custom_apps, config, and data directories.
  3. Download the 26 release (or whatever last working version +1 is) wget https://download.nextcloud.com/server/releases/latest-26.tar.bz2
  4. Extract it tar -xjf latest-26.tar.bz2
  5. You should now have a directory named nextcloud in front of you. Remove its config directory rm -rf nextcloud/config. Also remove custom_apps and data if they exist but they shouldn't.
  6. Copy into html cp -a nextcloud/* nextcloud/.* html/
  7. Fix permissions. These 3 commands will take some time. The last 2 are a little overly aggressive, but safe than sorry.
chown -R www-data:www-data html
# Yes you need to escape the semicolon this is not a formatting error
find html/ -type d -exec chmod 750 {} \;
find html/ -type f -exec chmod 640 {} \;
  1. cd into the html dir: cd html
  2. Start the upgrade: runuser -u www-data -- php occ upgrade
  • If the above fails, you can also try runuser -u www-data -- php occ maintenance:repair
  1. Turn off maintenance mode runuser -u www-data -- php occ maintenance:mode --off

You probably need to restart the container at this point but the upgrade should now be successful.

If the upgrade is successful, you'll now want to carefully increment your nextcloud image by 1 full version. So once the 26 manual upgrade is complete, and you've verified everything is working, stop your container and now run nextcloud:27 and let it perform its upgrade. If the upgrade isn't running for some reason, set the NEXTCLOUD_UPDATE environment variable.

@CollinJoseph
Copy link

@Skinner927 It's a working fix. Thank you.

@frederikstroem
Copy link

frederikstroem commented Aug 3, 2023

I had a similar problem with my Nextcloud deployment:

Initializing nextcloud 27.0.1.2 ...
Can't start Nextcloud because upgrading from 25.0.4.1 to 27.0.1.2 is not supported.
It is only possible to upgrade one major version at a time. For example, if you want to upgrade from version 14 to 16, you will have to upgrade from version 14 to 15, then from 15 to 16.

I tried the approach suggested by @Skinner927, but I didn't get it working. The main problem appeared to be acquiring bash access to the restarting container. Instead, I ended up incrementing the Nextcloud container version, restarting, and letting it update in between. So I did the following to update mine from 25 to 27:

1. Set the Nextcloud container version to 26 in the docker-compose.yml file and recreate the container:

version: '3'
  nextcloud:
    # https://github.com/nextcloud/docker
    # https://hub.docker.com/_/nextcloud/
    image: nextcloud:26
    container_name: nextcloud

2. Let the Nextcloud container update, follow the logs with docker logs -f nextcloud and wait for the update to finish.

3. Set the Nextcloud container version in the 'docker-compose.yml' file to the most recent and recreate the container:

version: '3'
  nextcloud:
    # https://github.com/nextcloud/docker
    # https://hub.docker.com/_/nextcloud/
    image: nextcloud
    container_name: nextcloud

3. {ALTERNATIVE} Pin to version 27 in the docker-compose.yml file and recreate the container:

version: '3'
  nextcloud:
    # https://github.com/nextcloud/docker
    # https://hub.docker.com/_/nextcloud/
    image: nextcloud:27
    container_name: nextcloud

@TheIceMagmaCube
Copy link

I currently have the same problem trying to upgrade from 26.0.1.
I have my own custom docker.tar which I rebuild every time I have update (pull the last nextcloud apache and rebuild my own image called nextcloud_cron).

In this situation, I can't update with the same as above.
More, I can't deploy a new instance with this image

Can't start Nextcloud because the version of the data (0.0.0.0) is higher than the docker image version (
Warning: PHP Startup: Unable to load dynamic library 'imap.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20220829/imap.so (libc-client.so.2007e: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20220829/imap.so.so (/usr/local/lib/php/extensions/no-debug-non-zts-20220829/imap.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
27.0.2.1) and downgrading is not supported. Are you sure you have pulled the newest image version?

The version 0.0.0.0 means the volume was clear.
My instance doesn't need an update right now, but it might be something to adress.

Also, I tried to start a new instance with the nextcloud:apache image, which you can do.

Initializing nextcloud 27.0.2.1 ...
New nextcloud instance
Initializing finished
=> Searching for scripts (*.sh) to run, located in the folder: /docker-entrypoint-hooks.d/before-starting
==> but the hook folder "before-starting" is empty, so nothing to do
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.48.2. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.48.2. Set the 'ServerName' directive globally to suppress this message
[Sat Aug 26 12:22:37.196350 2023] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.57 (Debian) PHP/8.2.9 configured -- resuming normal operations
[Sat Aug 26 12:22:37.196376 2023] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'

So, I guess there's something wrong with my image OR in the config.
Updating manually an instance could be possible. I'm managing +10 nextcloud instances, so doing them one by one will be a pain.

I'll look if I can modify the tag set for the version. Maybe it'll work.

@joshtrichards joshtrichards added question feature: upgrading Upgrading an existing deployment to a new image/NC version labels Oct 25, 2023
@joshtrichards
Copy link
Member

@TheIceMagmaCube Your issue is the same as in #2002 and caused by the imap.so error. That error is ending up in the $image_version variable and breaking the version comparison check for you:

docker/27/fpm/entrypoint.sh

Lines 150 to 154 in 37ee8cf

image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
if version_greater "$installed_version" "$image_version"; then
echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?"
exit 1

Fix the cause of that and you'll be fine.

@JuniorJPDJ Your situation looks similar to the above. Are there some other log lines missing in between what you posted? They will provide the clues.

@helsan74 Are you sure there weren't extra lines in the log output? You're the original reporter here, but my best guess is it was similar to the above / #2002.

@joshtrichards joshtrichards added the needs info Additional info needed to triage label Nov 8, 2023
@joshtrichards
Copy link
Member

joshtrichards commented Jun 18, 2024

Closing due to no further follow-up info received.

@joshtrichards joshtrichards closed this as not planned Won't fix, can't repro, duplicate, stale Jun 18, 2024
@JuniorJPDJ
Copy link

JuniorJPDJ commented Jun 18, 2024

This was exactly like you mentioned - it's about something (possibly imap.so) breaking the check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: upgrading Upgrading an existing deployment to a new image/NC version needs info Additional info needed to triage question
Projects
None yet
Development

No branches or pull requests