NextCloud Box (WDL) on a raspberry PI 2, re-install with USB HDD


I am re-installing my NextCloud box (WDL) on a raspberry pi 2.

  • So i basicly followed this howto _ (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:
Description=NextCloud HDD


# 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:
Description=Be swappy
# 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 :

  • _
  • _
  • _
  • _

what gave you the idea to install this snap ? (this is definitely not something you want to install … the appliance image has everything you need, the snap you try to install is a gadget snap for a completely different appliance setup)

after you went through the first howto, your nextcloud install should already be usable/reachable via https://nextcloud.local/

Yes the nextcloud install worked fine

I have this hardware:
and since it’s from Western Digital Labs, i suposed wdl-nextcloud-pi2 is something that might do the thing for me, but as i said, i could not find any documentation about this package to make sure it was what I needed.

So I just detailled my steps to use the HDD provided with the box.

I’m sure I will later re-install everything with another howto from someone who explain how to have the system on the HDD and save the SDcard a bit, and have faster I/O, but for the while, this is working for me

PS: maybe I should have posted this in the nextcloud forum rather here ?

ah, this setup originally came with an older Ubuntu Core install back when it was recent. the package is the gadget snap (hardware definition, partitioning, default configs and snap connections) that was used for this original image back then … the new appliance image you downloaded does not need it anymore … the package is still around because there might still be people that use the old original image that was created together with western digital in 2016/17 …

1 Like