Hi,
I am re-installing my NextCloud box (WDL) on a raspberry pi 2.
- So i basicly followed this howto _https://ubuntu.com/appliance/nextcloud/raspberry-pi2 (edit: I just found that I miss followed this guide and did not used the Nextcloud Ubuntu Appliance image, but Ubuntu Core 18 where i Installed the snap nextcloud, not sure yet about the pros/cons)*
- After successfuly login ssh to my raspi, I snap refresh, reboot.
- Then i try to install this package wdl-nextcloud-pi2 but it fails.
- I then supose it needds nextcloud snap to be installed before
- I try again, but it still fails with the same message error:
~$ sudo snap install wdl-nextcloud-pi2
error: cannot perform the following tasks:
- Mount snap "wdl-nextcloud-pi2" (1) (cannot replace gadget snap with a different one)
I didn’t found any project doc/bug report on launchpad or github, so i’m opening a thread here.
On the snapstore page of the snap, it show users from Core 16 only, not Core 18.
It seems I consider there is no support anymore for this package.
I supose someone (maybe le me of the futur who wants to re-install the sdcard), will need some help on how re-install the box, so this is how i’ve done it), so just for the record here is my howTo:
NOTE 1: Disclaimer, I take no responsability of what happend on your installation. This is how i made it, do your own backup, follow on you own risk, if you do not understand a step, you should get more information on it to make sure you are not doing a mistake. I try to explain what I do, but I can do mistake, sorry not sorry
NOTE 2: This will not use the HDD for the system, but only for the nextcloud users data and the swap.
NOTE 3: If I find this (using sdcard for the system) too slow, I will might consider re-install with the system on the hdd and update about it here.
~$ sudo snap connect nextcloud:removable-media
# Find the right partition to mount here
~$ sudo fdisk -l
# I found it was in /dev/sda, but it could be somewhere else for you
Disk /dev/sda: 931.5 GiB, 1000170586112 bytes, 1953458176 sectors
# Let's have more details about this
~$ sudo blkid | grep sda
# I found there are two partition:
/dev/sda1: UUID="blabla" TYPE="swap" PARTUUID="blabla"
/dev/sda2: UUID="blabal" TYPE="ext4" PARTUUID="blabal"
# I'm lazy, the usb will be always plugged to the same USB in the box, i won't use the uid
# So it's /dev/sda2 for me
# And I will choose /media/nextcloud_hdd as the mount folder
# Let's auto mount it on every reboot :
~$ sudo vi /etc/systemd/system/media-nextcloud_hdd.mount
# I've added those lines:
[Unit]
Description=NextCloud HDD
[Mount]
What=/dev/sda2
Where=/media/nextcloud_hdd
Type=ext4
[Install]
WantedBy=multi-user.target
# We reload systemd
~$ sudo systemctl daemon-reload
# Start the unit
~$ sudo systemctl start media-nextcloud_hdd.mount
# and enable auto mount
~$ sudo systemctl enable media-nextcloud_hdd.mount
# Then I move current nextcloud config and data to the target folder
# I've choose "home" because user name subfolder will be there, but you can choose 'nextcloud_data' or other name...
# I move the current files and config of nextcloud
~$ sudo mv /var/snap/nextcloud/common/nextcloud/data/* /media/nextcloud_hdd/home
~$ sudo mv /var/snap/nextcloud/common/nextcloud/data/.* /media/nextcloud_hdd/home
# then I moved the previous nextcloud users data (Nextcloud Box WDL) to a new folder
~$ sudo mv /media/nextcloud_hdd/var/snap/nextcloud/common/nextcloud/data /media/nextcloud_hdd/home
# And i remove other root folders except the /home folder:
# note: those folders exists if you come from a native install of the NextCloud Box (WDL)
# note2: You do NOT need to delete those folders, especialy if you are not sure why i do that.
~$ sudo ls -al /media/nextcloud_hdd/
drwxrwx--- 6 root root 4096 Jan 31 12:33 home
# Then I update the nextcloud config with the new path of the datas:
~$ sudo vi /var/snap/nextcloud/current/nextcloud/config/config.php
# We update the 'datadirectory' line with something like (without the at the begining of the line):
'datadirectory' => '/media/nextcloud_hdd/home',
# Then we disable nextcloud
~$ sudo snap disable nextcloud
# We set the folder permissions
~$ sudo chown -R root:root /media/nextcloud_hdd/home
~$ sudo chmod -R 0770 /media/nextcloud_hdd/home
# Then simply re-enable nextcloud
~$ sudo snap enable nextcloud
# I could not see my olders file so I had to find how to re-index them into nextcloud:
~$ sudo nextcloud.occ files:scan --all
# If like me, you do have a swap partition, you can enable it (for me it was /dev/sda1)
~$ sudo vi /etc/systemd/system/dev-sda4.swap
# And I added the lines:
[Unit]
Description=Be swappy
[Swap]
What=/dev/sda1
[Install]
WantedBy=multi-user.target
# Then I activate it:
~$ sudo systemctl enable --now dev-sda1.swap
# I wasn't sure it was activated so i checked:
~$ sudo cat /proc/swaps
Filename Type Size Used Priority
/dev/sda1 partition 2097148 0 -2
# to make sure everything is ok, reboot
~$ sudo reboot now
The old folder /media/nextcloud_hdd/var/snap/nextcloud/common/nextcloud/ is still in place in case i’ve missed some data, else you can remove it
When I tryed to display my nextcloud home page, it shown a maintenance mode that disappeared after a minute, don’t panic.
If another page is displayed such as an error, it usually gives good hint to highlight the mistake and how to fix it.
thanks a lot to the sources :
- _https://manandkeyboard.com/2018/01/07/nextcloud-snap-installation/comment-page-1/
- _https://superuser.com/questions/1390905/raspberry-pi-3-ubuntu-core-18-mounting-usb-disk-fails
- _https://github.com/nextcloud/nextcloud-snap/issues/505
- _https://forum.snapcraft.io/t/enabling-swap-with-swap-partition-on-ubuntu-core/9762/2