Hi,
I’m new to Nextcloud so I installed it via "Snap"to an existing Ubuntu installation. But before I installed NextCloud I added an additional 2 gig hard drive for data storage.
cd /var/www/nextcloud
sudo -u www-data php console.php files:scan --all
With the install via Snap I didn’t have a WWW directory. So after a little searching I came up with these commands below. All three scan commands get the same output listed below.
The data is on the drive, I can see it on a file browser but I can’t see it on a web browser. I can’t get a scan to work. I think I have a permissions issue with my data drive. Please see below. Can someone please help me with this?
An unhandled exception has been thrown:
Exception: Environment not properly prepared. in /snap/nextcloud/20498/htdocs/lib/private/Console/Application.php:167
Stack trace: #0 /snap/nextcloud/20498/htdocs/console.php(98): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #1 /snap/nextcloud/20498/htdocs/occ(11): require_once(‘/snap/nextcloud…’)
I honestly only made this account to comment on this. The search for a solution to my problem has finaly come to an end after days! THANK YOU SO MUCH!!!
Sorry, but I still get
“Exception during scan: opendir(my_data_dir): failed to open dir: Permission denied”
Both ownership and permissions are ok, root:root and 0770. Files are writable from root. So I don’t understand why there is a permission problem. Does nextcloud.occ run under another account?
Hi wa_bo, I’m not the best qualified to help but for anyone to understand your problem you will have to provide more information. I ended up deleting my snap install as there was very little help on the forum for snap installs. I did a re-install following this how to guide:
It was very easy to follow and worked straight away and any issues that I have had there seems to be more information out there for the conventional install. He also has another method of install which I try next time. See link below.
But as I said before, if you want to solve your snap install we would need more information. I hope this helps.
I have searched around at it seems as it boils down to that snap installations are not allowed to reach outside the snap environment, at least not without extra measures. Regardless of the ownership and permissions on the external drive.
Thanks very much for the links. I’ll study the carefully!
I would be looking at when the change back occurs. Does this happen after an update as some Nextcloud system files that we have modified are replaced by the default versions during the update process. For example I have to change the time out values in one of my php files in order to get the Nextcloud app store to work after every update. Each update returns the value to the default. Hope this helps.
Until yesterday, I couldn’t find any specific action when it occurred. The snap updates automatically, so I don’t know when it happens.
However, I checked dmesg yesterday and it turns out that the drive in question is an ext4 file system and had an aborted journal which caused the drive to be mounted read only.
I have now repaired the journal and rebooted the computer several times, and so far seems to be working.
If I continue to have journaling problems, I’ll have to move the data to another, more reliable drive, and retire the current one.
After changing my data directory to my new drive and setting the permissions, this command is what I finally needed to do to get rid of the permissions errors!