Problems migrating nextcloudpi from Raspberry Pi 4 to Raspberry Pi 5

Hello everybody,

last year I bought an ARGON ONE V3 NVMe case, an NVMe SSD and an Raspberry Pi 5 because I was curious if I could improve the performance of my Nextcloud instance (responding faster in the browser, loading thumbnails etc.) with the SSD and the newer version of the Raspberry Pi (which has also 8 GB of RAM compared to 4 GB of the Raspberry Pi 4).

Two weeks ago I found the time to start the migration project. Online research tells that the recommendation is to setup a new system by writing a fresh ncp image to the SSD and restore a backup of nextcloudpi and Nextcloud. So I went down that road.

I updated nextcloudpi on the RPI 4 from bullseye to bookworm and NextcloudPi v1.55.3. Then I exported ncp configuration using nc-export-ncp and backuped NC instance using nc-backup. Both files were stored on my RAID 1 system that I use as datastorage for the Nextcloud files (using BTRFS as filesystem).

Path 1
I flashed the latest ncp image for Raspberry Pi 5 (also v1.55.3) to the NVMe and connected the RAID 1 system to the Raspberry Pi 5. The import of ncp configuration worked.

When I tried to restore the backup of the NC instance using nc-restore, I ran in some error with MariaDB for which I found the solution here. Now the nc-restore stops with the following error:

[ nc-restore ] (Thu Mar 6 19:14:27 UTC 2025)
Cannot load Zend OPcache - it was already loaded
check free space...
extracting backup file /media/myCloudDrive/ncpexports/nextcloud-bkp_20250306_1741286109.tar.gz...
restore files...
Restoring old '/var/www/nextcloud/data' to '/var/www/nextcloud/data'...
restore database...
ERROR 2013 (HY000) at line 92421: Lost connection to server during query
Error restoring nextcloud database
Cleanup...

Searching for this error message, I found that tweaking the values in my.cnf might help, but this has not worked for me. Only the line in which the connection is lost changes.

Can anybody help what I have to do, that I can successfully restore my NC instance (I have around 800 GB stored in my Nextcloud instance)?

Path 2
Then I thought “Why not just put the SD of the Raspberry Pi 4 with the working nextcloudpi setup into the Raspberry Pi 5, connect the RAID 1 system to the RPI 5 and have the Nextcloud up and running just like that?”
Only research says that you should be able to does this as long as the OS is bookworm (minimum for RPI5). I did this and ran into the error " bcm2712-rpi-5-b.dtb not found" in bootloader. Obviously the dist-upgrade in nextcloudpi from bullseye to bookworm did not include this file.
So I copied bcm2712-rpi-5-b.dtb and kernel_2712.img to /boot of the SD of the Raspberry Pi 4 and put it in the RPI5. Now the system boots and I can log in and the Nextcloud instance is online.
The only problem is that I can’t mount the RAID 1 system with the BTRFS file system. Obviously the kernel Linux raspberrypi 6.6.74+rpt-rpi-2712 for RPI5 does not support BTRFS. Either nextcloudpi ships a modified kernel that enables the use of BTRFS or the kernel8.img (Linux nextcloudpi 6.1.21-v8+) used for RPI4 can handle BTRFS by default.

How can I modify my upgraded RPI4 bookworm OS so that it supports BTRFS when I put it into my RPI5?

I am happy for solutions (either for path 1 or 2) so that I can migrate my working Nextcloud instance with nextcloudpi from a Raspberry Pi 4 to a Raspberry Pi 5.

Thanks I a lot and cheers,
schuck23