Updating from Nextcloud 24.0.12 to 25

Hello,
I am running Nextcloud 24.0.12 and want to upgrade to the latest version.
I installed Nextcloud using a script on a server dedicated to it, and in the past, I upgraded using the script sudo bash /var/scripts/update.sh
However, when I run it now, it won’t update, because it is fetching the version 26 and it cannot skip a version during upgrade.
Is there a way to force it to upgrade to 25, or should I do the upgrade manually (if so, can anyone help me with the link)

[/details]

Nextcloud version : 24.0.12
Operating system and version : 22.04
Apache or nginx version : Apache
PHP version : 8.12

The issue you are facing:
Cannot update to version 25 using script.sh

Is this the first time you’ve seen this error? Y

You should provide all information, not only the name of a script, it could contain everything possible.
My advice, open the script in an editor and look what it exactly does, you should of course be able to speak Bash freely, which is not so dificult and should be a goal for everybody begining to run a linux server. If you don’t, you should ask the person who wrote the script a.k. the maintainer.

Thank you for the quick reply, if it any help, here is the script:

#!/bin/bash

# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/

true
SCRIPT_NAME="Update Server + Nextcloud"
# shellcheck source=lib.sh
source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/master/lib.sh)

# Check for errors + debug code and abort if something isn't right
# 1 = ON
# 0 = OFF
DEBUG=0
debug_mode

# Must be root
root_check

mkdir -p "$SCRIPTS"

if [[ "${1}" =~ ([[:upper:]]) ]]
then
    msg_box "Please use lower case letters for the beta/rc/minor."
    exit
fi

if [ "${1}" = "minor" ]
then
    echo "$((NCMAJOR-1))" > /tmp/minor.version
elif [ "${1}" = "beta" ]
then
    echo "beta" > /tmp/prerelease.version
elif [[ "${1}" == *"rc"* ]]
then
    echo "${1}" > /tmp/prerelease.version
fi

# Delete, download, run
run_script GITHUB_REPO nextcloud_update

exit

Sorry i can not really help you. But maybe other read my infos and save time to solve your problem.

The script uses this file: https://raw.githubusercontent.com/nextcloud/vm/master/lib.sh . Maybe this is the same: vm/lib.sh at master · nextcloud/vm · GitHub

In this script the new version number is apparently calculated. And maybe here is an error. You need from version 24 a version 25 and not version 26.

nc_update() {
    CURRENTVERSION=$(sudo -u www-data php $NCPATH/occ status | grep "versionstring" | awk '{print $3}')
    NCVERSION=$(curl -s -m 900 $NCREPO/ | sed --silent 's/.*href="nextcloud-\([^"]\+\).zip.asc".*/\1/p' | sort --version-sort | tail -1)
    STABLEVERSION="nextcloud-$NCVERSION"
    NCMAJOR="${NCVERSION%%.*}"
    NCBAD=$((NCMAJOR-2))
    NCNEXT="$((${CURRENTVERSION%%.*}+1))"
}

Maybe someone can explain where in the code the Nextcloud zip file is downloaded. Does the regular expression exclude the “.asc” to use direct “.zip”? Sorry i am not an expert in Chomsky hierarchy Type-3.

2 Likes

that is correct @devnull

NCVERSION=$(curl -s -m 900 $NCREPO/ | sed --silent 's/.*href="nextcloud-\([^"]\+\).zip.asc".*/\1/p' | sort --version-sort | tail -1)

This line takes the last line and separates the number (latest NC version). This is currently “26.0.1”.

I don’t know the script, never worked with it. But this is the version number used. You could just download the file and change the line to: NCVERSION=25.0.6
Don’t forget to backup.

2 Likes

Wow, thank you I might try it. However maybe it is better to just do the manual upgrade? less risky?

The script takes decisions from you and checks what you should (but don’t have to) do manually.
But with a backup you are always on the safe side. A manual upgrade is (especially in a case like yours) easier to start.

You can first do a manual upgrade and then run the web script (which should then work).

I know it might be a silly question, but can you point me to the proper manual install?

https://docs.nextcloud.com/server/latest/admin_manual/maintenance/upgrade.html#how-to-upgrade
I would recommend you the “Upgrader” of the web interface.

1 Like

In my case, the web updater does not show in the settings panel. Maybe I can install it somehow?

Then via CLI
https://docs.nextcloud.com/server/latest/admin_manual/maintenance/manual_upgrade.html

Looking at it right now :slight_smile: , an enormous thank you for the help.