OK. So as the topic says I’m losing my mind. I desperately need some help.
So I had 4 paragraphs of a rant on a soapbox written but I tossed it. Here’s the issue:
So I have a computer where I have ubuntu server 22.04 installed. I install the snap for NextCloud but nothing else has been done. My synology has a shared folder on top of btrfs. The NextCloud server automounts with fstab with this information:
//192.168.x.x/nextcloud /mnt/nextcloud cifs rw,dir_mode=0770,file_mode=0770,vers=3.0,username=xxx,password=xxx 0 0
For this exercise let’s ignore my user and password being in the fstab. I’ll move to a credentials file later. For now I just need this working.
The system mounts the external drive properly and I follow the documentation from above where the folders need to be owned by root. I do all that and things look good.
I create my admin user and go from there. Still nothing even though I followed the linked instructions to the letter. the data directory isn’t my /mnt/nextcloud/data. The directory is still /var/snap/nextcloud and so on.
So I’m lost. I use the Synology to hold my media for my Jellyfin instance and that auto-mounts using 0777 (again ignore the security implications) and it all works.
NextCloud however, doesn’t allow that. I need the 0770 but nothing I do seems to make it work properly.
Google has failed so any help to rectify this would be greatly appreciated.
FIrst of all:
Did you change data dictionary in the config.php file?
The owner of the data frolder you designates to this has to be the user of which runs your webserver in the snap. I think it is www-data, but I am not using the SNAP version so cannot test this. If root owns the folder, the nextcloud cannot do anything with the folder.
I did change the directory before I even installed NextCloud. I only installed the snap.
I was following this guide: Change data directory to use another disk partition · nextcloud-snap/nextcloud-snap Wiki · GitHub
Nothing seems to work. I pieced together an old laptop today so I could test and rebuild quickly. I’m still getting nowhere.
I’m really at a loss and I’m getting really frustrated. It should not be this hard to use my Synology NAS as my data folder. I should not have to buy a more powerful NAS to install NextCloud locally. I have plenty of spare computers laying around that can do that duty.
Thanks. I actually figured it out this morning.
Your post about the removable-media was part of it and i found that last night. This is all documented in scattered places but there’s nothing definitive. This is how I finally got it all to work. YMMV but if I deviate from these steps in any way it doesn’t work.
Install Ubuntu (or linux distro of choice that supports snapd) and update.
sudo mkdir -p /mnt/foldername
modify fstab - //IPaddressofsynology/sharedfoldernamefromnas /mnt/foldername cifs rw,dir_mode=0770,file_mode=0770,vers=3.0,username=xxxx,password=xxxxxx 0 0
I have since moved to the credentials file for passing username and password but this was the quickest way to test back and forth.
sudo mount -a
sudo mkdir -p /mnt/foldername/data - make sure this appears on the NAS
sudo snap install nextcloud
sudo snap connect nextcloud:removable-media
sudo nano /var/snap/nextcloud/current/nextcloud/config/autoconfig.php → modify ‘directory’ to point to /mnt/foldername/data instead of where it it wants to go grab the environment variable.
sudo snap restart nextcloud.php-fpm
login and have it install
Now it all works. The snap connect command and the timing of creating the /data folder mattered for me.
There’s no needing to screw with permissions or access via chown or chmod.
Once I got it installed I then changed the port to something else so that I could put it behind my nginx proxy. that meant that I needed to add my URL to the trusted domains and then needed to add these entries to the config after the trusted domains:
‘overwrite.cli.url’ => ‘https://myURL’,
‘overwriteprotocol’ => ‘https’,
The overwrite lines are to allow the desktop client to be able to connect.
It’s finally working and working well. Was just very frustrating to get to this point.