How to upgrade Nextcloud HanssonIT VM from 23.012 to a newer version

Situation

You have Nextcloud HanssonIT stuck on version 23.0.12. The version is not maintained anymore. You want to upgrade but the  UI doesn’t give you any more choice to upgrade. A further complication is the operating system is Ubuntu 20.04 but it’s the year 2024. So you’re 4 years behind on Ubuntu LTS as well.

Disable Luks Disk Encryption Password?

You cannot decrypt Luks without decrypting all the data using a live disk.

Upgrade from Ubuntu 20.04 to 22.04

When working with Ubuntu or Debian in general, you always want to update first. So do this:

sudo apt update && sudo apt upgrade

Now reboot.

This doesn’t upgrade the distribution in site of the “upgrade” word present. After reboot, do this:

do-release-upgrade
Checking for a new Ubuntu release
Please install all available updates for your release before upgrading.

Basically you have “held” package and you have to remove them. In our case we had to remove a ton of PHP 7.4 packages:

apt -y --allow-change-held-packages php7.4-common
apt -y --allow-change-held-packages php7.4-zip
apt -y --allow-change-held-packages php7.4-opcache
apt -y --allow-change-held-packages php7.4-cli
apt -y --allow-change-held-packages php7.4-dev
apt -y --allow-change-held-packages php7.4-fpm
apt -y --allow-change-held-packages php7.4-cli
apt -y --allow-change-held-packages php7.4-imagick
apt -y --allow-change-held-packages php7.4-*
apt -y --allow-change-held-packages php-pear
apt -y --allow-change-held-packages php-7.4-xml
apt -y --allow-change-held-packages php7.4-xml
apt -y --allow-change-held-packages php7.4-bcmath
apt -y --allow-change-held-packages php7.4-bz2
apt -y --allow-change-held-packages remove php7.4-bz2
apt -y --allow-change-held-packages remove php7.4-cli
apt -y --allow-change-held-packages remove php-cli
apt -y --allow-change-held-packages remove php-imagick
apt -y --allow-change-held-packages remove php7.4-soap
apt -y --allow-change-held-packages remove php7.4-cli
apt -y --allow-change-held-packages remove php7.4-common
apt -y --allow-change-held-packages remove php7.4-gmp
apt -y --allow-change-held-packages remove php7.4-imap
apt -y --allow-change-held-packages remove php7.4-mbstring
apt -y --allow-change-held-packages remove php7.4-opcache
apt -y --allow-change-held-packages remove php7.4-mbstring
apt -y --allow-change-held-packages remove php7.4-readline
apt -y --allow-change-held-packages remove php7.4-pgsql
apt -y --allow-change-held-packages remove php7.4-ldap
apt -y --allow-change-held-packages remove php7.4-json
apt -y --allow-change-held-packages remove php7.4-intl
apt -y --allow-change-held-packages remove php7.4-gd
apt -y --allow-change-held-packages remove php7.4-curl
apt -y --allow-change-held-packages remove php7.4-common

After this we could do this again:

do-release-upgrade

Next, because you’ve completely removed PHP, you’ll end up in this situation:

root@example:~# bash /var/scripts/update.sh
sudo: php: command not found
/var/scripts/nextcloud_update.sh: line 76: pecl: command not found
sudo: php: command not found
...
sudo: php: command not found
The notifications app isn't enabled - unable to send notifications
Fetching latest packages with apt...
[⣾⣽⣻⣾⣽⣻⣾⣽⣻⣾⣽⣻⣾⣽⣻⣾⣽⣻⣾⣽⣻⣾⣽⣻⣾⣽⣻⣾⣽⣻⣾⣽⣻⣾⣽⣻⣾⣽⣻⣾⣽⣻⣾⣽⣻⣾⣽⣻⣾⣽⣻⣾⣽⣻⣾⣽⣻⣾⣽⣻]

I’ve omitted some of the output but further down, and after having trying to install PHP 8.1, I decided to move to PHP 8.3.

apt install curl gpg gnupg2 software-properties-common ca-certificates apt-transport-https lsb-release -y
add-apt-repository ppa:ondrej/php
apt update -uy
apt -y install php8.3
history
apt install php-pear

After this, redis.so became a problem so we did this:

cd /tmp
git clone https://github.com/phpredis/phpredis.git
cd phpredis
phpize [apt install php-dev]
./configure
make && make install

Then we had to do this:

apt install  php8.3-fpm

We got a lot of this:

root@server:~# bash /var/scripts/update.sh
The notifications app isn't enabled - unable to send notifications

Then we got this:

ERROR: The following modules depend on mpm_prefork and need to be disabled first: php8.3
Considering conflict mpm_worker for mpm_event:
Considering conflict mpm_prefork for mpm_event:
ERROR: Module mpm_prefork is enabled - cannot proceed due to conflicts. It needs to be disabled first!

Some more dependency problems:

a2dismod php8.3
a2dismod mpm_prefork

After another 40 minutes of trying, we decide to upgrade to Ubuntu 24.04, but quickly abandon that too due to the error below:

# do-release-upgrade
Checking for a new Ubuntu release
There is no development version of an LTS available.
To upgrade to the latest non-LTS development release
set Prompt=normal in /etc/update-manager/release-upgrades.
root@nextcloud:~# mc -e /etc/update-manager/release-upgrades

This was aborted because:

https://docs.nextcloud.com/server/latest/admin_manual/installation/system_requirements.html

After much more troubleshooting, this:

[Tue Aug 13 11:16:16.155143 2024] [ssl:emerg] [pid 37210] AH02407: "SSLOpenSSLConfCmd DHParameters /etc/letsencrypt/live/site.example.com/dhparam.pem" failed for site.example.com:443

Commented out that line, then got this:

Your current version is still not compatible with the version required to run this script.

To upgrade between major versions, please check this out:
https://shop.hanssonit.se/product/upgrade-between-major-owncloud-nextcloud-versions

 Conclusion

  • Don’t use Hansson IT
  • Use AIO

If you have to upgrade, consult a specialist, or pay 200 Euro to Hansson IT.

 

Tags

Share this article

2 thoughts on “How to upgrade Nextcloud HanssonIT VM from 23.012 to a newer version”

    1. Eugène van der Merwe

      Thank you so much for your comment! I struggled for hours and then did this instead:

      1. Install vanilla Virtualmin to easy Apache and PHP version control
      2. Installed a Nextcloud older version as per the old server
      3. Backup Postgres on the old instance
      4. Restore Postgres on the new instance
      5. Upgrade version by version until I had things back

      It took hours. Postgres had issues which I don’t recall now.

      I don’t think I’ll use the Hanssonit version again, it seemed to direct me to paid services.

      At least with Virtualmin one has full control over PHP and what not.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top