Current mission: Turn it up to 11 on 24.04 from 10:16 on 20.04

Creating this more as a how to for anyone else that’s stuggling with something similar in the future.

The task: I am running OC 10.16. something on ubuntu 20.04 and I want to upgrade to the most recent OC release 11. Partly because of the recent PHP “issues” partly because it seems like a good idea.

The “problem”: ubuntu 20.04 won’t easily take php 8.3. OC 11 needs 8.3. Ubuntu 22.04 won’t easily run 7.4 or 8.3 so is no good to anyone. Ubuntu 24.04 will run 8.3 but it won’t run 7.4. So, you really need to upgrade bother the underlying OS and the OC install at the same time.

I guess in theory this is simple… but I’ve thought that in the past.

I’m fortunate that I am doing this on a VM with a resonable amount of storage spare so first job, shut the VM down, snapshot it, boot up again.

Enable maintenance mode

cd /var/www/owncloud
sudo -u www-data ./occ maintenance:mode --on

Grab all the current OS updates

apt update && apt dist-upgrade -y && apt autoremove -y && apt auto-clean

Shut it down again, snap it again then boot and run

do-release-upgrade

Leave all existing edited files in place (option n generally)
Reboot
apt update && apt dist-upgrade -y && apt autoremove -y && apt autoclean -y
( ^— probably not really needed)
php -v
(^----- also probably not needed but nice to check it’s showing 8.1 at this point.)
Shutdown, snap.

Phase one done, server upgraded to 22.04.

Phase two, upgrade server from 22.04 to 24.04

Boot,
do-release-upgrade
leave existing edited files as they are again, reboot, first proper problem. No network.
Edit the netplan file and update eth0 to enX0 fix routes, fix permissions on config file,

netplan generate && netplan apply

boom - back in the game

apt update && apt dist-upgrade -y && apt autoremove -y && apt autoclean -y
php -v
seems all good. Shutdown, snap (yes… again),

Phase 2 done, upgraded to 24.04, php 8.3 now available.

Phase 3; upgrade owncloud.

Read the upgrade docs. Pertinent bits are;

  1. maintenance mode (already done)
  2. disable apache (not actually starting right now)
  3. backups (snap snap snap)
  4. download latest (but the link doesn’t work)
  5. Move, extract, link data, copy config files, fix permissions
  6. Do the upgrade (disable maintenance first)

We already have maintenance mode enabled but checking won’t hurt but it actually also won’t work because the current occ command is still the old version. Tried it anyway.
sudo -u www-data ./occ maintenance:mode --on
This version of ownCloud is not compatible with PHP 8.0
You are currently running PHP 8.3.6.

Need to fix apache, it’s currently trying to load the old php 7.4 modules
a2dismod php7.4 && a2enmod php8.3 && apache2ctl configtest
Syntax is ok so start it up
systemctl start apache2 && systemctl status apache2
All looking good, best disable again though so we don’t get any pesky clients trying to connect.
systemctl stop apache2

Download latest. The docs provide a wget line that appears to download the “latest” version but that actually downloads 10.16.0 which is not 11 and not even the latest v10.16 release… sooo, head here instead and download the actual latest.
cd /var/www
mv owncloud owncloud-20261024
wget ``https://github.com/owncloud/core/releases/download/v11.0.0/owncloud-11.0.0.tar.bz2
tar -xf owncloud-11.0.0.tar.bz2

Copy config files over, docs then also say to link data but if I link data then setting permissions is going to take an eon so doing the perms first and taking the risk that something in my data dir might not be quite right for now.
cp /var/www/owncloud-20261024/config/* /var/www/owncloud/config
Not going to copy and paste all the permissions commands, go get them from the docs.

At this point the docs don’t mention it but you have to turn maintenance mode off. The really reassuring part for me at this point was that it didn’t complain about the php version and it acknowledged that stuff needed an upgrade! looks like I’m winning…
sudo -u www-data ./occ maintenance:mode --off
ownCloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Maintenance mode disabled

Run the update, for me this generated some errors
sudo -u www-data ./occ upgrade
Had to disable some of the apps (in fairness I should have probably checked this earlier…)
sudo -u www-data ./occ app:disable activity
Then run the upgrade agian, which for me worked, finally;
systemctl start apache2
sudo -u www-data ./occ maintenance:mode --off

Logon, settings, check version is 11.0.0

Rejoice for you are now up to date (kinda)…

and then shutdown, take ANOTHER snapshot just for good measure…