Nextcloud plugin error after changes to system

Bonnard

Cadet
Joined
Mar 22, 2020
Messages
6
Hello,

I'm just going to start off by saying I'm not real knowledgeable with FreeNAS or NAS stuff in general, I've kind of just been stumbling my way through things for the past year, going through the documentation, and finding info where I can on the internet. So far it's gotten me through most things, but now I have hit a wall that I can't quite figure out how to pass.

For my system I'm using a somewhat dated laptop with an i7-4700MQ CPU and 8GB of RAM running on FreeNAS-11.3-U1. It all started when I upgraded my storage and added another 8 TB external hard drive (I had only 1 before) to create a mirrored pool. I backed up everything from my previous pool onto a totally separate drive and then moved it all onto a new mirrored pool that I created on my dual 8 TB drives. Everything seemed to be working fine for a little while until I started running into problems with my Nextcloud plugin. All of the sudden it started giving me a "502 Bad Gateway nginx" error when managing Nextcloud at its IP and I can't seem to access its console through the shell. I think I remember seeing in my notifications on FreeNAS that the Nextcloud plugin was being updated before I started having issues, although I'm not entirely certain. Also, my Plex plugin works fine still so whatever happened only affected Nextcloud it seems.

I've been trying to repair the plugin and/or figure out how to backup my data in the plugin's jail, but since it appears I can't access things I'm having trouble doing any of that. I would be very grateful if someone could lend me a hand and point me in the right direction because I'm in over my head right now.

Quick Summary:

My Nextcloud plugin has stopped working properly and is displaying "502 Bad Gateway nginx" at its IP after hardware changes and a possible update to it.

Images:

2020-03-23 16.46.57 192.168.1.118 a709df984f75.png


2020-03-23 16.34.30 192.168.1.113 1b7a8faf02a8.png
 

unf0rg0tt3n

Dabbler
Joined
Jan 3, 2020
Messages
40
Of you did an upgrade of your system you might want to check out: /usr/local/www the nextcloud folder might be empty or missing a lot of files. I've had that, could you please check it out for me?
 

Bonnard

Cadet
Joined
Mar 22, 2020
Messages
6
Of you did an upgrade of your system you might want to check out: /usr/local/www the nextcloud folder might be empty or missing a lot of files. I've had that, could you please check it out for me?
Here it is.

shell capture.png


How do you know if it's missing anything?
 

unf0rg0tt3n

Dabbler
Joined
Jan 3, 2020
Messages
40
Here it is.

View attachment 37413

How do you know if it's missing anything?
When I had the same problem you have, the folder was literally empty.

What about the config.php and the data directory? In the config.php you need to have the correct data directory path specified. Also check the permissions on the complete nextcloud folder. You can run:
chown -R www:www /usr/local/www/nextcloud run the command from inside the nextcloud jail shell
 

Bonnard

Cadet
Joined
Mar 22, 2020
Messages
6
In config.php this is what it says my data directory is:

'datadirectory' => '/usr/local/www/nextcloud/data'

Looks to be correct I guess.


Also, I can't access the nextcloud jail shell. This is what happens:

nextcloud jail shell.png
 

unf0rg0tt3n

Dabbler
Joined
Jan 3, 2020
Messages
40
Seems like a permission problem right there.
You need to get the permissions right otherwise it will not work.
The easiest thing is to actually start over with your nextcloud plugin.
 

Bonnard

Cadet
Joined
Mar 22, 2020
Messages
6
Seems like a permission problem right there.
You need to get the permissions right otherwise it will not work.
The easiest thing is to actually start over with your nextcloud plugin.
Hmmm yeah that's weird. Do you know if that's something that can happen to Nextcloud if something gets messed up or corrupted from a hardware or software upgrade/update? Other than start over, is there anything easy to check that might fix the permissions issue?

And if I do decide to start over, what do I do about my files that I have stored in Nextcloud? Is there a relatively easy way to back up my data? In other words, what would be the process for resetting and keeping my personal files, accounts, and settings in my situation?

Thanks.
 

unf0rg0tt3n

Dabbler
Joined
Jan 3, 2020
Messages
40
Hmmm yeah that's weird. Do you know if that's something that can happen to Nextcloud if something gets messed up or corrupted from a hardware or software upgrade/update? Other than start over, is there anything easy to check that might fix the permissions issue?
Yeah, when I did a php upgrade everything dit get messed up.
Did you create a dataset which has a mount to your jail?
if so; go to that dataset in: Storage >> Pools. change the permissions
User: www
group: www
Apply recursively.

Hmmm yeah that's weird. Do you know if that's something that can happen to Nextcloud if something gets messed up or corrupted from a hardware or software upgrade/update? Other than start over, is there anything easy to check that might fix the permissions issue?

And if I do decide to start over, what do I do about my files that I have stored in Nextcloud? Is there a relatively easy way to back up my data? In other words, what would be the process for resetting and keeping my personal files, accounts, and settings in my situation?

Thanks.
When starting over you can expect on losing everything. the problem is that I don't know how your plugin was installed.
Everything is inside the database. what you could do is backup your files, make a SQL data dump and save that. start over fresh with a new plugin.
And revert every setting by importing the SQL dump and files.

You also can startup a new nextcloud plugin jails thingy alongside the old one and copy your files over to the new plugin.
The import the files by:
sudo -u www php /usr/local/www/nextcloud/occ files:scan --all
It's starting to import the files added by you on disk level.

It might be easy to follow: https://www.youtube.com/watch?v=ETdlrNUGjZk where the version is really old this guy explains from start to end.
Nextcloud is one of the most unstable systems I have ever come by, It's the worst. But when it works... it works good.
 

Bonnard

Cadet
Joined
Mar 22, 2020
Messages
6
Yeah, when I did a php upgrade everything dit get messed up.
Did you create a dataset which has a mount to your jail?
if so; go to that dataset in: Storage >> Pools. change the permissions
User: www
group: www
Apply recursively.


When starting over you can expect on losing everything. the problem is that I don't know how your plugin was installed.
Everything is inside the database. what you could do is backup your files, make a SQL data dump and save that. start over fresh with a new plugin.
And revert every setting by importing the SQL dump and files.

You also can startup a new nextcloud plugin jails thingy alongside the old one and copy your files over to the new plugin.
The import the files by:
sudo -u www php /usr/local/www/nextcloud/occ files:scan --all
It's starting to import the files added by you on disk level.

It might be easy to follow: https://www.youtube.com/watch?v=ETdlrNUGjZk where the version is really old this guy explains from start to end.
Nextcloud is one of the most unstable systems I have ever come by, It's the worst. But when it works... it works good.
I'm coming back to this and have decided to start from scratch with my Nextcloud, but I have some questions. To preface, I set up my Nextcloud plugin (the one that is now broke) basically how the guy in the video you linked did, but I used the default data folder location if that explains anything.

Could you elaborate on this portion:
make a SQL data dump and save that. start over fresh with a new plugin.
And revert every setting by importing the SQL dump and files.
More specifically, how do I make a SQL data dump, and how do I import it along with the files?

For the second method, could you elaborate on this portion:
startup a new nextcloud plugin jails thingy alongside the old one and copy your files over to the new plugin.
The import the files by:
sudo -u www php /usr/local/www/nextcloud/occ files:scan --all
More specifically, what you mean by setting up a new nextcloud plugin jail alongside the old one, and how the import command works.

I'm not bothered if you prefer not to elaborate on both methods. I'm okay with just one of them or a new one you think would best match my situation. Also, I'm fine with links to web pages or videos if they can further explain what your talking about as well.

I really appreciate all the help so far, it's doing a lot to help me better understand Nextcloud and FreeNAS.
 

unf0rg0tt3n

Dabbler
Joined
Jan 3, 2020
Messages
40
More specifically, how do I make a SQL data dump, and how do I import it along with the files?
To make the backup:
mysqldump db_name > backup-file.sql
You need to login in your mariadb shell: mysql -u <youruser> -p <your passord>

To import:
mysql db_name < backup-file.sql

I have my own dedicated database server so I generally don't have to worry about this step because I have phpmyadmin running as well.

More specifically, what you mean by setting up a new nextcloud plugin jail alongside the old one, and how the import command works.
You can make a second jail inside of freenas by simply hitting the plugin install button for nextcloud.

The easiest way to keep your data safe and sound is by having it all on your freenas box inside a dataset.
You then can attach the dataset to your freenas box in: jails >> <nextcloud box> >> mount point. as the video demonstrated.

For how the import command works.. it scans all files and add it to your nextcloud database.
Yesterday I got sick and tired of the whole nextcloud plugin, I screamed to it and just deleted it.

It just doesn't work the way it actually should.

My setup is a hypervisor with freenas VM database vm and lots of other vm's. the nextcloud jail inside of freenas just threw a bunch of unsolvable errors and I just deleted the jail.

I made a new VM on my hypervisor, installed nextcloud latest version, mounted the nextcloud data folder and I was done in literally 5 minutes (without the waiting time for installing everything)
Works like a charm and because I have a seperate database server and a dedicated folder it just worked.

If you need more info or stuff isn't clear you can direct message me if you like .
 

EsTaF

Contributor
Joined
Sep 20, 2013
Messages
163
can't help repair rights
chown -R www:www /usr/local/www/nextcloud
ok
ls -l /usr/local/www/nextcloud
all files&directory had www ones
anyway get a bad gateway msg

had roll back to saved snapshot. all're ok
updates for jails - "not about freenas/truenas".
 
Top