Cannot login to a fresh install of NextCloud using snap on Ubuntu Server

Hi,

I have an Ubuntu server running on a raspberry pi that I want to use as a NextCloud server. I’ve did a straight forward

sudo snap install nextcloud 

and the package is installed without any warning and such. Then, from a browser on another computer I went to the IP address of the raspberry pi address. I was greeted with NextCloud’s interface to create a username and password for the admin. I added those and then I’m stuck on a login screen. I type in the username and password that I set, and I’m being transferred to the same page without any error message or any further information.

How do I fix this?

Hello,

Your installation process isn’t finished yet.

After that command, you needed to execute couple of more commands to complete the installation.

sudo nextcloud.manual-install username password

Set you own user name and password above.

Further,

sudo nextcloud.occ config:system:set trusted_domains 1 --value=your.server.static.ip

Once that successfully executes, then you can use that user name password to log into your installation.

Refer here for details → GitHub - nextcloud-snap/nextcloud-snap: ☁️📦 Nextcloud packaged as a snap

Thanks.

Hi, thank you for the help.

I’ve launched the two commands, plus (since I use external drive for the files):

sudo snap connect nextcloud:removable-media

I still see the same behavior.

The folder where nextcloud is supposed to store the data is /media/BIG/nextcloud:

ubuntu@ubuntu:/media/BIG$ ls -l
total 24
drwxr-x--- 5 root     root      4096 May  5 14:51 librephotos
drwx------ 2 root     root     16384 Apr 30 18:23 lost+found
drwxr-xr-x 3 www-data www-data  4096 May  4 18:00 nextcloud
ubuntu@ubuntu:/media/BIG$ 

What else am I missing?

I think the default snap storage location is /var/snap/nextcloud/common/nextcloud/data

I think its better to remove the installation and start fresh, then try

Thanks.

I think the default snap storage location is /var/snap/nextcloud/common/nextcloud/data

How do I change it then? I’ve placed this here just so it is clear what I did.

I think its better to remove the installation and start fresh, then try

This was a fresh new install, I formatted my SD card with a new image. I didn’t format the external drive, though.

Hello,

You may need to stop nextcloud service,

sudo snap stop nextcloud

edit the config file,

sudo nano /var/snap/nextcloud/current/nextcloud/config/config.php

Change the DataDirectory value to your desired external location, then move the conatins,

sudo mv /var/snap/nextcloud/common/nextcloud/data /new/location/

Restart the NextCloud Service.

Just remove the snap installation and reinstall… Start fresh to avoid any previous error / mistake getting carried over.

Thanks.

Things are getting weird.

I ran sudo snap remove --purge nextcloud and then I installed nextcloud again.
Once installed, I changed /var/snap/nextcloud/30263/nextcloud/config/config.php to include the line datadirectory => /media/big/nextcloud
I also changed the /media/big/nextcloud configuration as per this

sudo chown -R root:root /media/BIG/nextcloud
sudo chmod -R 770 /media/BIG/nextcloud

Finally, I typed the commands for enabling external media followed by this:

$ sudo nextcloud.occ config:system:set trusted_domains 1 --value=192.168.1.104  

And I got this:

Nextcloud is not installed - only a limited number of commands are available
There are no commands defined in the "config:system" namespace. 

Have I ruined everything now?

Hello,

I am no expert but I guess the simple command to remove NextCloud snap is,

sudo snap remove nextcloud

I guess it’s better to start with a fresh clean install of Ubuntu. Then just few commands,

  1. sudo snap install nextcloud
  2. sudo nextcloud.manual-install username password
  3. sudo snap connect nextcloud:removable-media
  4. Add your trusted domain / IP sudo nextcloud.occ config:system:set trusted_domains 1 --value=your.server.ip.address
  5. Edit Config → sudo nano /var/snap/nextcloud/current/nextcloud/config/config.php (find the line DataDirectory, change the location)
  6. Move your existing files, sudo mv /var/snap/nextcloud/common/nextcloud/data /new/location/
  7. Fix the permission of the new directory
  8. Reboot

Thanks.

during install of ubuntu there is an option to install additional apps by selecting them from a list. Nextcloud snap is one of these options, select the checkbox for it and continue - Nextcloud snap is ready once Ubuntu Server install is complete.

I have this system and what I did was all that you did for the config file but I linked the external (NFS - as it was on a network drive) folder to the data folder and all is good.

hope this helps

Hi, I’ve followed your instructions, and I ended up in the same situation as my original post. I’ve done that in a fresh new install of ubuntu server on my raspberry pi. Clearly I’m missing something, only I cannot figure out what.

OK! I got this working! Almost.

I’ve purged the package, and installed it again, following again your instructions and checked I can login before moving the datafolder. Things sort of worked at this stage (look below). But then, when I changed the data directory to the external drive nextcloud failed to start complaining about permissions and the lack of .ocdata and/or wrong permissions. I tried to fix that but I saw that the permission are a bit more complex that just going with chmod 770 -R /path/to/external/data/folder so I reinstalled everything again, only this time I copyed the folder using sudo cp -a /var/snap/nextcloud/current/nextcloud/data /path/to/external/data/folder and this works.


I still have a problem that I don’t think is relevant here, though I hope you can still help me. When I try to login from my Vivaldi browser (what I usually use) login fails (as per my original post). I tried again from Firefox and this worked. Do I tried again Vivaldi - failed. Vivaldi in incognito mode? Works. So the problem is somewhere with Vivaldi. I tried removing the cache and distabling all extensions but this didn’t help. Any idea where I should look in addition?

Hello,

Glad to know it worked for you :heart_eyes:

Cloud you please be more specific, as failed means?

It draws blank page?
It throw some error code?
It shows authentication error?

What exactly happens when you type in the NAT IP of your Pi running nextcloud?

Thanks.

Hi.

The problem is that I’m constantly being redirected to the login page. I don’t see any error message or warning. I only get the login screen again. It doesn’t matter if I’m putting a right or wrong username and password. It’s the same.