Gradual upgrade 7.3 to version 7.4

Nethserver 7.3.1611
module, email and nexstcloud

config show sysconfig
sysconfig=configuration
Copyright=
DefaultLanguage=en_US.utf8
ProductName=NethServer
Release=Final
Version=7.3.1611

is there a possibility to make a gradual upgrade to version 7.4, then to 7.5 and then to 7.6?
my problem is nextcloud.

thanks

Some time ago this solution was given. Nowadays it is obsolete as NethServer has an integrated release lock mechanism (via How to lock to a specific distribution release), so I don’t know if that would still work.

I’ve partially tried updating specific packages (nethserver-{base,subscription,release,nethforge-release} centos-release) and editing some db props, forced Version prop and yum vars, but manual repo edits were required to make it work and I desisted.

A related approach would be to manually edit urls of repositories and using CentOS Vault.

If it’s just for Nextcloud, there shall be an easier and more direct approach (once we find out, I’ll pull my hairs out for overthinking this :stuck_out_tongue_winking_eye:), but at the moment I came up with a generic workaround (not nextcloud specific, and based on same concept as nsreleaselock) which shall work for CentOS and/or NethServer version updates just by tweaking the custom repo file in use. For same problem but on more up to date servers or to “rollback” unsupported nextcloud upgrade paths, the wiki has some notes.

Excuses, in advance, for the long post… not to be afraid of the wall of text, at the end it’s easier than it seems.


Background

In this example we will focus on *nextcloud updates. Officially, Nextcloud does not support updates between multiple major version so if, like in this case, we have a server that has not been updated for a long while, and Nextcloud is managed through rpm packages, we might end up in a situation where we are only offered the latest *nextcloud version while previous major versions and its requirements are no longer available in our configured repos.

We could manually download all the required packages for each major version of nextcloud, but that would be cumbersome. Another approach is to manually edit the repos or create a custom repo file pointing to older CentOS/NethServer repositories, if available.

Note: FTR, there could be other nextcloud tricks to accomplish unsupported upgrade paths, like manually editing nextcloud version number in some files. Untested.

Example

Initial state:

  • NethServer/Centos 7.3.1611
  • Nextcloud 10.0.2
  • Nextcloud located at /var/www/html/nextcloud/
# rpm -qa *nextcloud {nethserver,centos}-release  # *php* versions omitted
nextcloud-10.0.2-1.ns7.noarch
nethserver-release-7-0.6.ns7.noarch
nethserver-nextcloud-1.0.4-1.ns7.noarch
centos-release-7-3.1611.el7.centos.x86_64

Create a custom repository file (remember to inspect contents of downloaded file):

 curl https://gist.githubusercontent.com/dnutan/1d21e6f7e3bd8bc516a73b718a96de11/raw/52c7ebc0a937f37909c4a2a414c7490cf217cc66/Custom.repo -o /etc/yum.repos.d/Custom.repo

Set a custom yum var (used in the custom repo file to specify the desired minor version release of the distribution):

echo '7.3.1611' > /etc/yum/vars/customrelease

Clean yum repository data:

yum --enablerepo=\* clean all

optional step - Visually verify whether the repositories are correct (–nogpgcheck is used because some old nethserver repos were not gpg signed):

yum --nogpgcheck \
--disablerepo=\* \
--enablerepo=custom-C7-{base,updates,extras},\
custom-nethserver-{base,updates},\
epel,custom-centos-sclo-{sclo,rh} \
repolist -v

Find out which *nextcloud packages are provided in the custom repos. We can relate nextcloud package version to nethserver-nextcloud package by looking at the changelog:

yum --nogpgcheck \
--disablerepo=\* \
--enablerepo=custom-C7-{base,updates,extras},\
custom-nethserver-{base,updates},\
epel,custom-centos-sclo-{sclo,rh} \
--showduplicates \
list nethserver-nextcloud nextcloud

Update packages specifying the desired version (e.g. update to nextcloud 11.x). After each update we can also verify nextcloud is working and check logs for errors:

yum --nogpgcheck \
--disablerepo=\* \
--enablerepo=custom-C7-{base,updates,extras},\
custom-nethserver-{base,updates},\
epel,custom-centos-sclo-{sclo,rh} \
update nethserver-nextcloud-1.1.3-1.ns7 nextcloud-11.0.3-2.ns7

Example updating from Nextcloud 11.x to Nextcloud 12.x:

yum --nogpgcheck \
--disablerepo=\* \
--enablerepo=custom-C7-{base,updates,extras},\
custom-nethserver-{base,updates},\
epel,custom-centos-sclo-{sclo,rh} \
update nethserver-nextcloud-1.1.7-1.ns7 nextcloud-12.0.2-2.el7

Changing yum repositories to another CentOS/NethServer distribution release:

echo '7.5.1804' > /etc/yum/vars/customrelease
yum --enablerepo=\* clean all
# optionally, repeat other previous steps to verify repos urls and available packages 

Update from Nextcloud 12.x to Nextcloud 13.x:

yum --nogpgcheck \
--disablerepo=\* \
--enablerepo=custom-C7-{base,updates,extras},\
custom-nethserver-{base,updates},\
epel,custom-centos-sclo-{sclo,rh} \
update nethserver-nextcloud-1.2.4-1.ns7 nextcloud-13.0.6-1.el7

Removing custom yum var, custom repos and cleaning yum repo data. Next updates shall come from the latest available original repositories:

rm /etc/yum/vars/customrelease
rm /etc/yum.repos.d/Custom.repo
yum --enablerepo=\* clean all

Update from Nextcloud 13.x to Nextcloud 14.x (lock for available packages, as before, if needed):

yum update nethserver-nextcloud-1.3.0-1.ns7 nextcloud-14.0.4-1.el7

Update all system packages as usual (at the time of writing, the following will update nextcloud to 15.x):

yum update

End result:

  • NethServer/Centos 7.6.1810
  • Nextcloud 15
  • Nextcloud located at /usr/share/nextcloud/
# rpm -qa *nextcloud {nethserver,centos}-release  # *php* versions omitted
nethserver-release-7-12.ns7.noarch
centos-release-7-6.1810.2.el7.centos.x86_64
nextcloud-15.0.0-1.el7.noarch
nethserver-nextcloud-1.4.0-1.ns7.noarch

Don’t forget to check and update disabled nextcloud apps.
Of course, if for some reason there were missing dependencies we should investigate and find our way through.

3 Likes

Thank you for your precise and detailed answer,
but maybe it’s not worth spending too much time on it.
Thanks again.
Hello

Hello,
i recived white page for nextcloud after updating 15.0.7 to 16.0.11.
Please help me

{“reqId”:“YPKxtlOpHycdJLP5HheO7QAAAAY”,“level”:3,“time”:“2021-07-17T10:32:22+00:00”,“remoteAddr”:“192.168.1.115”,“user”:“–”,“app”:“PHP”,“method”:“GET”,“url”:“/nextcloud/index.php/csrftoken”,“message”:“Interface ‘OCP\AppFramework\Bootstrap\IBootstrap’ not found at /usr/share/nextcloud/apps/files_texteditor/lib/AppInfo/Application.php#37”,“userAgent”:“Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0”,“version”:“16.0.4.1”}

thanks
thanks

Try disabling the app that you think is giving the error:

occ app:disable files_texteditor

Also check if occ upgrade is ok.

On old releases of nethserver you had to run occ specifying its path and user like

sudo -u apache scl enable rh-php72 -- php -dmemory_limit=512M /usr/share/nextcloud/occ

do not remember the exact version, though

Thanks dnutan for you replay, but i recived this error:

su - apache -s /bin/bash -c “source /opt/rh/rh-php71/enable; cd /usr/share/nextcloud/; php occ app:disable files_texteditor”

The current PHP memory limit is below the recommended value of 512MB.
PHP Fatal error: Interface ‘OCP\AppFramework\Bootstrap\IBootstrap’ not found in /usr/share/nextcloud/apps/files_texteditor/lib/AppInfo/Application.php on line 37

thanks

Maybe the app got updated to the latest version, because it didn’t implement IBootstrap till recently (since Nextcloud 20 or so), so it tries to find some core code that is not there yet.
To get the app version:

occ config:app:get files_texteditor installed_version

If the app cannot be disabled I think you can try moving the app outside of nextcloud apps folder.

Version lock was overruled serveral versions ago…