Can I migrate to a new server instead of upgrading. Unsolved issues with webfinger, nodeinfo and Collabora when upgrading to 21.0.7

I have a VPS that has been running for a couple of years with about 50 registered users. Have with time upgraded to 20.0.14, but when I wanted to upgrade to 21.0.7 I got two issues:

  1. Your web server is not set up correctly to resolve “/.well-known/webfinger” and “/.well-known/nodeinfo”. I have read the forums and github and tried the proposed configurations in /etc/nginx/conf.d/nextcloud.conf but with nu success.
  2. After upgrade CollaboraOffice stopped working. When trying to create or open a document I just get a second copy of the upper NC meny. I have edited the /etc/nginx/conf.d/nextcloud.conf and added the proposed changes from here https://sdk.collaboraonline.com/docs/installation/Proxy_settings.html#reverse-proxy-with-nginx-webserver, I have reinstalled to collabora docker and removed and reinstalled the collabora app. Still same problem.
    I have no warnings or errors in the nextcloud log accessible from the web-browser.

I can try harder but am ready to give up and find another solution.

Beside the old NC-version I also need to upgrade php and Ubuntu. So I am considering to migrate the current server to a new version, based on Ubuntu20 and php8.0. I have an experimental server NC21.0.8 with that configuration. Collabora works. I have no errors.

How can I migrate? I have seen instructions on how to migrate in the official manual. My question - will it work just to dump the current database and copy it to the new machine that has other versions of MysQL, php, Ubuntu and NC? Do I have to upgrade the current server first?

Current set up:
Operating system Ubuntu 18, eg Linux 4.15.0-70-generic #79-Ubuntu SMP Tue Nov 12 10:36:11 UTC 2019 x86_64
Webserver nginx/1.15.9 (fpm-fcgi)
Database mysql 10.3.15
PHP version 7.3.22-1+ubuntu18.04.1+deb.sury.org+1
Modules loaded: Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, sodium, session, standard, cgi-fcgi, mysqlnd, PDO, xml, apcu, bcmath, bz2, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, gmp, iconv, igbinary, imagick, intl, json, ldap, exif, mysqli, pdo_mysql, apc, posix, readline, redis, shmop, SimpleXML, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xmlreader, xmlwriter, xsl, zip, Phar, Zend OPcache
Nextcloud version 20.0.14 - 20.0.14.2

Hi @rollanders

I cannot give you a detailed step by step guide, since I have never done a migration to a new server myself. And to be honest, I doubt that migrating to a new server will automagically solve all your issues. For example, if you use the same configuration on the new server, you will most likely have the same issues there too, and if not, you wouldn’t know why. :wink:

As far as the the configuration of the OS, web server and PHP goes, these are completely independent of your Nextcloud installation. So If your goal is to upgrade to Ubuntu 20.04, reinstall and reconfigure PHP, reinstall and reconfigure or even switch to anoter web server, you can do all that on your current system as well, provided you can afford downtime of course.

If you want to try a migration, you can read here what the necessary steps are…

https://docs.nextcloud.com/server/latest/admin_manual/maintenance/migrating.html

Not tested, but perhaps less problems:
Perhaps you can create a new VPS with Ubuntu 20.04 LTS.
Use a new temp name for your nextcloud server e.g. files.domain.tld

Old server:
Make a backup of your old server. Use maintenance mode that nobody edit files.

New server:
Make a restore with the same nextcloud version (e.g. 20.0.14).
Change the settings to the temp server name.
Hopefully the (newer) PHP version works.
Upgrade the Nextcloud version up to Nextcloud 21, 22, 23.

Old server:
Deactivate the old server.
Move the name to the new server (CNAME, A, Lets Encrypt).

I think you can only use this version if you upgrade your old server to this version and then use backup/restore (links above).

@bb77 @devnull
You are right.
I tried a migration, but ended up with “this versions is not compatible with php8.0”. I realise that what I did was just to migrate the old NC 20 version.

So it seems I need to upgrade it to NC21 and solve the issue that will come. It seems others have had issues in that process. I will search the forums once again.

I wonder if these “bugs” will be fixed in 21.0.8 and is it worth waiting for before I try to upgrade again? It has reached RC3 so far but the number of open issues reported on https://github.com/nextcloud/server/milestones are increasing instead of decreasing.

Afaik Ubuntu 20.04 does ship with PHP 7.4 which should be fine to run Nextcloud 20 and even is the recommanded version to run Nextcloud 21and 22 on. Can’t say much about the bugs you linked to. Do any of them directly affect you? I had no issues upgrading to 21 and 22. I usually upgrade after the first point release is out.

I definitely had these problems as I described. I tried a lot to solve them in vain.
For the webfinger you can see these threads which shows that I was not the only one having the problem.

https://docs.nextcloud.com/server/20/admin_manual/installation/nginx.html

For the Collabora there are also a lot of threads from others having problems. In my next try I will purge docker before upgrading and then reinstall docker from scratch. I hope it should solve that problem :wink:

My current php is 7.3 which is no longer supported and 7.4 is getting close to EOL. php8.0 seems to be the recommended version, but I can wait with php and Ubuntu.

But I first need to upgrade from NC20.0.14. I guess I will go further to NC22 once I have managed to get to NC21.

I solved it!
This is what I did (not sure if all details are necessary)
I took a backup and made a snapshot of the VPS.
Uninstalled most apps. Kept only the most important. I removed CollaboraCode completely.
Opened the terminal and put the server in maintenance mode
Removed Docker completely by issuing
sudo apt-get purge docker-ce docker-ce-cli containerd.io
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd

did the upgrade - this time I got NC21RC3
Put maintenance mode off

Checked for errors and found "Your web server is not set up correctly to resolve “/.well-known/webfinger” and “/.well-known/nodeinfo”.

Put the server in maintenanemode again
edited the nextcloud.conf (nano /etc/nginx/conf.d/nextcloud.conf) according to the different proposals in the thread above.

Everything in vain.
BUT - I had somewhere read a comment that the problem may be the browsers cache. I checked in an incognitowindow and - voila - no error. I did ctrl+F% in chrome brower and now there were no errors in the ordinary window either.

The final version in nextcloud.conf is below. Anything may have worked…

access_log off;
}
#changed the following

location ^~ /.well-known {
location = /.well-known/carddav { return 301 /remote.php/dav/; }
location = /.well-known/caldav { return 301 /remote.php/dav/; }
location = /.well-known/webfinger { return 301 //index.php/.well-known/webfinger; }
location = /.well-known/nodeinfo { return 301 //index.php/.well-known/nodeinfo; }
location /.well-known/acme-challenge { try_files $uri $uri/ =404; }
location /.well-known/pki-validation { try_files $uri $uri/ =404; }
return 301 /index.php$request_uri;
}

I now installed docker and collabora from scratch and it worked with no problem.

So my problem was the browsers cache and remaining old Collabora Docker things.

Thast is not correct.
I think Nextcloud must support PHP 7.4 as long Ubuntu uses it.
I think it is not necessary to install PHP versions from other sources than the actual Ubuntu release.

System requirements — Nextcloud latest Administration Manual latest documentation

8.0 (recommended)
Perhaps someone delete this (wrong) entry or add some informations. It is not a good idea to use php from another source. Ubuntu 20.04 LTS is still the stabel Ubuntu release with PHP 7.4 and i think Ubuntu 22.04 LTS will be shipped with PHP 8.1 https://packages.ubuntu.com/jammy/php

Why are you telling this in every thread someone is using or wants to use PHP 8.0?

Yes it is not officially supported by Canonical, but which home user has a support contract with Canonical anyways? This is even more true with Debian, where there are no support contracts at all. Also, these are not just some dubious sources you can add, these sources are maintained by Ondrej Sury, the maintainer of PHP for Debian.

And yes you are right, you don’t have to use PHP 8.0 with Nextcloud, but you can if you know what you are doing. And yes you have to know how the handling with 3rd party package sources works and that there is no official 1st party support by Canonical or the Debian project. But I personally find the handling easier than for example with backports on Debian. And if you explicitly install a specific version (php8.0-cli, php8.0-fpm…) and not php-cli, php-fpm, the packages will stay on that version and even get security and bug fixes as soon as they become available upstream. Sury does a great job maintaining these repos.

That’s not entirely true when it comes to Ubuntu. (with this part of his post @devnul is right :wink: ) Since PHP is in the main repository of Ubuntu, at least security fixes will be backported to all supported Ubuntu LTS releases and their respective PHP versions Ubuntu release cycle | Ubuntu

Nextcloud usually adapts their requirements to these release cycles, so that you always should be able to use the PHP version of at least the current Ubuntu LTS release. I think PHP 8.0 is recommended by now, because the Nextcloud developers are optimizing Nextcloud for PHP 8.0 since Version 22 or 21?. But PHP 7.4 is still supported though.

1 Like

As php7.3 has reached EOL I guess I should upgrade. I would welcome advices/instructions or references to such instructions on how to do the upgrade to whatever version is best.

If you are using PHP 7.3 from the Ubuntu main repos you will continue to receive security updates until Ubuntu 18.04 will reach End Of Life at some point in 2023. I would recomand upgrading to Ubuntu 20.04 in the forseeble future though, which would also upgrade the PHP packages to version 7.4. Or you could wait for 22.04, which will be the next LTS release. 22.04 will ship with PHP 8.1, which isn’t supported by Nextcloud just yet but should be supported starting with Nextcloud 24.

If you are using the packages from the Sury repos, you will have to manually upgrade the packages to at least 7.4, regardless of which Ubuntu version you are using. In this case, I would go directly to 8.0 for now.

OK. And can you give instructions how to upgrade Ubuntu from the main repos? Any risk for issues?

You use a VPS. I think you can not upgrade the running system on your own. Read my first post in this thread. Read also the documentation of your hosting provider for upgrading to a newer Ubuntu version.

If it is just a standard VPS with full root access, starting the upgrade process itself is easy:

sudo apt update && sudo apt dist-upgrade

sudo do-release-upgrade

But there is always the possibility that something goes wrong during the process or not everything is working without at least some manual intervention after the OS upgrade. So you should ask yourself at least the following two questions:

  • Is there docmentation on how you installed Nextcloud and it’s dependencies like PHP, nginx, database, so you could reproduce and / or reconfigure these things in case it’s needed?

  • And most important: Does your hosting company offer you a possibility to snapshot or backup the hole VM, in order to roll back the VPS to it’s previous state in case you got stuck or the installation gets completley borked?

If it is a managed server and / or it has some management software installed like C-Panel or Plesk, the upgrade process definitly gets more involved or it could even be possible, that you can’t upgrade the instance yourself like @devnull mentioned.

If you are unsure about any of the points I mentioned, you should definitley consult your hosting company or at least check their documentation before you trying to upgrade your instance.

It is a non-managed VPS which I have setup myself based on scripts from C Rieger some 3 years ago I think. I have root access, one snapshot, I do backups every night (I gave most of this information from the start…) .

But thanks for the instructions. Seems possible for me to do, I usually do such things in a testing server first to see what can go wrong.

Then I would say, take a snapshot before you start, and go for it. :slight_smile:

Yeah me too, even though I have only two users, but my girlfriend has all her stuff on it, so my life is somewhat depending on that thing running :wink:

Seriously. What can happen, and what I have already experienced is that not all PHP modules worked after an upgrade. But if you used the C-Rieger script, you have installed the PHP packages from the Sury repos anyways and you should be able to upgrade them independently of your OS version.

apt remove php*

and then:

apt update -q4 && apt install -y php8.0-{fpm,gd,mysql,curl,xml,zip,intl,mbstring,bz2,ldap,apcu,bcmath,gmp,imagick,igbinary,redis,smbclient,cli,common,opcache,readline} imagemagick

If it doesn’t work after that, you can also remove PHP completley incl. the config files:

apt purge php*

and then reinstall and reconfigure PHP according to C. Rieger’s instructions:

https://www.c-rieger.de/nextcloud-installationsanleitung/#c02

Another important point is the database. Since you used the C. Rieger script, this was also installed via third party repos. Maybe it makes sense to manually upgrade it to 10.6 beforehand, just to make sure that Ubuntu won’t mess with it during the release upgrade, which it imho shouldn’t, but better safe than sorry, I guess :wink:

https://mariadb.com/kb/en/upgrading/

https://www.c-rieger.de/mariadb-update-10-5-auf-10-6/

https://www.c-rieger.de/nextcloud-installationsanleitung/#c03

EDIT:
…and one more thing: During the release upgrade Ubuntu disables all third party repos. Make sure you re-enable them after the upgarde, otherwise, you won’t get security updates for MariaDB and PHP.