Upgrade Nextcloud Server to Debian bookworm

My current system is slowly getting old and debian bullseye can’t provide an up to date mariadb and PHP for nextcloud 30. I’m afraid of upgrading the system via ncp-dist-upgrade since it could cause several new problems.

The question I want to ask:
Since all my data and database are stored one an external HDD I want to set up a clean new system.
My current instance: Debian bullseye, pi4, NC 30.0.3, mariadb 10.5.4
The new instance I would set up: Debian bookworm, pi5, NC 30.0.3, mariadb 11.4

If I set up the new system with the exact same NC version and the same configuration I think it should be possible just switching the HDD drive from one server to the other. Is that right?

I’m not sure if there is something I miss that could corrupt my data if I switch the data from one system to another. Will a newer version of mariadb just read the database the same way or will I change things like an update so I wasn’t able to switch back to the old system in case something goes wrong?

Hopefully someone experienced can give me an advice ;).

It’s not as easy as you want to believe, take a look here:
Migrating to a different server
You choose the ncp way to do your nextclouding, I would do the dist-upgrade, there could be issues but they could arrise everywhere, dist-upgrades I’ve made went flawlessly.
As ever do make good backups before you start. Then after your rpi4 server is updated, you may change your harware (backup / restore).

Thank you for your feedback.

OK, maybe I’ll give ncp-dist-upgrade a try.

Usually if I try something new on my server I do a backup of the USB device I run the system on and save the image on my PC. So in case I mess it up I can play it back onto the device an start again. Do you know if this is a “save” way for a whole distribution Upgrade?
I’m afraid of corrupting the data on the external HDD drive (NC data and NC database) with this process. I have a daily backup of it, but it’s always taking a lot of time recovering 2,7 TB of data worst case.

It is the recommended way in docs and the forum;
Where is darkness - bring in light.
You may setup a little test system on a spare sd card with extern drive, db, data and train the process of dist-upgrade.
Remaining at outdated software levels is not an option.
At the end you may consider another storage solution, backup strategy.

Maybe it’s a stupid question.
I’ve installed NCpi via curl installer on debian 11. I don’t know much about other ways and I want to test it the same way my current system was set up…
By now the curl installer is available for debian 12 only. So I can’t set up a test system. Is there a way to get an older image?

Not that I know, but I wonder what do you want to achieve.
Setting up a rpi4 usually is done by flashing the ncp image for rpi4 on boot device boot - activate - done. Mass of docs, videos available.
The curl “installer” let yopu install ncp on virtual hardware, you have no full access, hoster platforms, of course you can use it at home.
World keeps on spinning you have to update from debian 11 either way.

Yes, but like you said I want to set up a test system based on Debian 11 so I can’t practice the update process with ncp-dist-upgrade. Therefore I need an older image of NCP based on Debian 11. But I got it now. Thanks :wink:

Yes, I understand, I never did it setup this way and consider to do so in spare time. Would you mind mention the source of the older image, as long as it is feasable for others here to follow?

Last time I flashed an image of raspberry PI OS with raspberry pi imager and took the curl installer script from github: GitHub - nextcloud/nextcloudpi: 📦 Build code for NextcloudPi: Raspberry Pi, Odroid, Rock64, curl installer...
On the very bottom there are two commands for the curl installer script (with and without sudo rights):
curl -sSL https://raw.githubusercontent.com/nextcloud/nextcloudpi/master/install.sh | bash

Just wait for the script to finish and you are ready to go. But it only seems to be available for the newest version.

Yes, I see; I set the project aside, I did several test updating runs with image flushing installs, starting with older ncp versions, say 1.52.x and do the updating run -nc, ncp, dist-upgrade, until up to date revision, went all flawlessly.

I’ve tried the upgrade on a test system. But I can’t confirm to do the upgrade.

Please, get used to cite your command and the whole output from prompt to prompt.
As in, which commands are available:

pi@ncpi4:~$ ncp-
ncp-backup                     ncp-config                     ncp-report                     ncp-update
ncp-check-nc-version           ncp-dist-upgrade               ncp-restore                    ncp-update-nc
ncp-check-updates              ncp-notify-unattended-upgrade  ncp-scan                       ncp-zram
ncp-check-version              ncp-notify-update              ncp-test-updates
pi@ncpi4:~$ ncp-

You could do a ncp-report, so what is the status of your test setup and is it a the point when ncp offers the dist-upgrade.

That are the commands I used.

root@raspberrypiTEST:/home/pi# ncp-report

NextcloudPi diagnostics

NextcloudPi version  v1.55.3
NextcloudPi image    NextcloudPi_RaspberryPi_v1.53.2.img
OS                   Debian GNU/Linux 11. 5.15.61-v8+ (aarch64)
automount            no
USB devices          sda 
datadir              /opt/ncdata/data
data in SD           yes
data filesystem      ext2/ext3
data disk usage      2.8G/114G
rootfs usage         2.8G/114G
swapfile             /var/swap
dbdir                /var/lib/mysql
Nextcloud check      ok
Nextcloud version    28.0.3.2
HTTPD service        up
PHP service          up
MariaDB service      up
Redis service        up
HPB service          down
Postfix service      up
Internet check       ok
Public IPv4          ***REMOVED SENSITIVE VALUE***
Public IPv6          ***REMOVED SENSITIVE VALUE***
Port 80              open
Port 443             open
IP                   ***REMOVED SENSITIVE VALUE***
Gateway              ***REMOVED SENSITIVE VALUE***
Interface            eth0
Certificates         ***REMOVED SENSITIVE VALUE***
NAT loopback         no
Uptime               13min

root@raspberrypiTEST:/home/pi# ncp-dist-upgrade
ATTENTION
This is a dangerous process that is only guaranteed to work properly if you
have not made manual changes in the system. Backup the SD card first and
proceed at your own risk.

Note that this is not a requirement for NCP to continue working properly.
The current distribution will keep receiving updates for some time.

Do you want to continue? [y/N]
root@raspberrypiTEST:/home/pi# y
bash: y: command not found

When entering ncp-dist-upgrade I’m hanging in that command window forever. The only thing I’ve done before is to upgrade ncp to 1.55.3 and access NC one time.

Oh… wait a moment. I’ve done the following in the same window:

root@raspberrypiTEST:/home/pi# apt update
root@raspberrypiTEST:/home/pi# ncp-dist-upgrade
ATTENTION
This is a dangerous process that is only guaranteed to work properly if you
have not made manual changes in the system. Backup the SD card first and
proceed at your own risk.

Note that this is not a requirement for NCP to continue working properly.
The current distribution will keep receiving updates for some time.

Do you want to continue? [y/N]
root@raspberrypiTEST:/home/pi# y

Now it’s doing things… let’s see what happens

Ok, the update to bookworm worked. Mariadb got updated, too. PHP has to be updated manually I think.

I was curious if it runs on my raspi 5 now. But doesn’t seem so.

No, but now you may train backup/restore in webui (4443).
You could than try to migrate your updated rpi4 instance to a new instance setup from the ncpi rpi5 img NextcloudPi_RaspberryPi5_v1.55.3.zip .

Maybe I’m getting you wrong. But why should I need a distribution upgrade on my current instance if I want to switch to a pi5. I’ve to set up a new system anyway if I don’t want to update the kernel on my current instance manually. So I could buy a new harddrive and set up a new NC on the pi5. Since I have a daily backup anyway (with Borg) I could copy data and database to the new instance and install the few apps I got by myself. If the new instance is up running I switch port forwarding to the new IP and that’s it.
The original question was if I could get around copying all that data by just switching the harddrive with the data. But I understand that’s not as easy as I would think. So buying a new harddrive is the way to go.

As good practice to keep the differences between source and destination as small as possible. Because the ncp1.54.x image is the first with rpi5 support, so it seems good to the source (rpi4) as near as possible to the new instance (rpi5)
But yes, the outgoing question is to be answered migrating is not “pull and plug”.

Hi Oberluch3000,

I’m not looking to interfere or pull the thread off-topic, but like to chime in with some thoughts on another path:

  • Seeing you run on RPi, I imagine this is not a mission critical installation that a business can not do without (not to bagatellize family&friends use of NC!)
  • There may be only few users, that care about their files, but lesser so about set permissions and shares internally and externally

Going back to your initial post,

You would miss the permissions, shares and such, as they live in the database, and installing a completely new/empty Nextcloud, the database will be empty.

Going against best practices: if that is not a problem in your situation, then installing a new NC instance on your new RPi, and configuring the external HDD as data directory, followed by occ files:scan would populate the database with files on the hard disk.

For testing the steps such as proposed by Geow, you could dd a copy of your current RPi4 SD-card to another one, and run your tests on the copy. That will ensure the ‘start’ situation is exactly the same as your current situation, and will keep your actual installation intact. The only downside is that your instance will be down for the duration of these trials.

Hey wbk,

you are right. The cloud is used by a few family members for sharing files, calendar, contacts and as password manager. There is no critical data I wouldn’t have a backup of. But I would like to reduce downtime so everyone has access to their passwords.

Because this is a hobby and I can’t spend hours for repairing errors in case something goes wrong I will buy a new HDD and set up a clean instance on my raspi 5. Then I can copy the data from the current backup to the new cloud via network and restore a database dumb, too. This way I can see if everything works and switch systems if I’m ready.
Maybe there will be a few files missing since I copy the backup data while running the cloud. But if this is the case I can fix it manually.

And most important: it’s less stressful not working on the current instance ;).

That for sure. Good luck!