[5/5] Self hosted Nextcloud 20+
See also
๐๏ธ This part deals with maintenance burden. Not the funniest part but always needed to ensure a healthy system. I've divided the sections as if they were 'flight rules', they aren't meant to be read sequentially.
Remounting as a read/write FS
When updates are needed or simply updating the configuration is needed, one could need to temporarily deactivate the read only filesystem.
Although overlayroot
package gives an overlayroot-chroot
command, donโt use it for two reasons:
- The
/media/root-ro
directory is remounted asro
and changes wouldnโt persist - Packages updates / installation might break because some operations are forbidden in chrooted environment. You might experience some
Running in chroot, ignoring request.
errors.
sudo mount -o remount,defaults,noatime,rw -t ext4 /dev/mmcblk0p2 /media/root-ro
sudo vim /media/root-ro/etc/overlayroot.local.conf
# โ Add '#' before `overlayroot="tmpfs:swap=1,recurse=0"` line
sudo reboot
Updating Nextcloud
- Remount the filesystem as read/write (see above) and reboot
- Upgrade Nextcloud from the command line:
sudo -u www-data php /var/www/nextcloud/updater/updater.phar --no-interaction
- Remount the system in readonly mode
sudo vim /etc/overlayroot.local.conf # uncomment the line sudo reboot
Updating the Kernel
If you recompiled your kernel in Part 2, youโll have to recompile it regularly to keep it up to date.
-
Compile kernel sources
# On the HOST machine # Assuming you still have a linux git clone from part 2 git branch # Will tell you on which branch you currently are git pull origin linux-5.4.y # Restart incremental compilation make zImage ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j16 make modules ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j16 # Compile the DTS (should not be necessary) make ARCH=arm rk3288-tinker.dtb CROSS_COMPILE=arm-linux-gnueabihf- -j8 # Transfer to SDCard # Installing drivers on SD Card sudo make ARCH=arm INSTALL_MOD_PATH=/media/$USER/324cd421-b656-4326-9882-de35a3ad335a/ modules_install # Installing on the target's /boot partition cp arch/arm/boot/zImage /media/$USER/4C89-2DED/ cp arch/arm/boot/dts/rk3288-miniarm.dtb /media/$USER/4C89-2DED/
-
When rebooting, recreate an
initframfs
:En bootant, refaire un initrd: su root export PATH="/usr/sbin:$PATH" update-initramfs -c -k "$(uname -r)" # This will create an initrd in /boot (ex: "initrd.img-5.4.94+")
-
Youโll have to update the
/boot/extlinux/extlinux.conf
file with the two new files.
Backing up your SD Card
- Put your SD Card in your host pc
- Umount it manually
- Launch a terminal and type:
sudo dd if=/dev/mmcblk0 conv=sync,noerror bs=64K | gzip -c > /PATH/TO/DRIVE/backup_image.img.gz
(adapt
mmcblk0
with your SD Card actual dev name)
Restoring a backup
Same procedure but goes the other way round:
gunzip backup_image.img.gz
sudo sh -c 'cat backup_image.img > /dev/mmcblk0'
(again, adapt mmcblk0
with your SD Card actual dev name)