ERR_TOO_MANY_REDIRECTS erro after Nexcloud 20.0.4 Plugin Install

Joined
Dec 22, 2020
Messages
5
I seem to have fixed my fresh NextCloud plugin installation. Here's what I observed and fixed along the way.

I experienced the too many redirects error when attempting to load /apps/files post sign-in.

jexec'd into the jail. /usr/local/www/nextcloud/apps is empty. Apps seem to be located in /usr/local/www/nextcloud/apps-pkg.

Moveed the apps directory to where the nextcloud config default expects them to be located. cd /usr/local/www/nextcloud && mv apps apps-old && mv apps-pkg apps

Fixed logging by appending 'logfile' => '/var/log/nextcloud/nextcloud.log', to the config array in /usr/local/www/nextcloud/config/config.php

Restarted php-fpm and tried again. service php-fpm restart.

/var/log/nextcloud/nextcloud.log` complained with errors like `Base table or view not found: 1146 Table 'nextcloud.oc_flow_operations' doesn't exist.

Edited /usr/local/www/nextcloud/config/config.php and set 'installed' => false. Went to the base URL again (no /apps/files), and got to the installation screen so I could have it "re-do" the installation. Entered in the same DB connection info from the post-install details. Added info for a new admin user (not ncadmin, because it already exists). Submitted the form and let it complete.
Will try this as fast as i can. Hopefully this helps.

Thanks
 
Joined
Dec 22, 2020
Messages
5
I seem to have fixed my fresh NextCloud plugin installation. Here's what I observed and fixed along the way.

I experienced the too many redirects error when attempting to load /apps/files post sign-in.

jexec'd into the jail. /usr/local/www/nextcloud/apps is empty. Apps seem to be located in /usr/local/www/nextcloud/apps-pkg.

Moveed the apps directory to where the nextcloud config default expects them to be located. cd /usr/local/www/nextcloud && mv apps apps-old && mv apps-pkg apps

Fixed logging by appending 'logfile' => '/var/log/nextcloud/nextcloud.log', to the config array in /usr/local/www/nextcloud/config/config.php

Restarted php-fpm and tried again. service php-fpm restart.

/var/log/nextcloud/nextcloud.log` complained with errors like `Base table or view not found: 1146 Table 'nextcloud.oc_flow_operations' doesn't exist.

Edited /usr/local/www/nextcloud/config/config.php and set 'installed' => false. Went to the base URL again (no /apps/files), and got to the installation screen so I could have it "re-do" the installation. Entered in the same DB connection info from the post-install details. Added info for a new admin user (not ncadmin, because it already exists). Submitted the form and let it complete.
Thanks!!! It worked for me! Even when i submitted the new Usernames and passwords when entering the base URL, the Server loaded and recieved a time out, but after reloading i finally logged in my account and it worked!!!

But now i have to know,how you knew this was the problem? I knew the error message while installing which said folder not found,the apps folder for example.

I would pay you a beer for sure!
 

danila_94

Cadet
Joined
Dec 22, 2020
Messages
7
Jail`s configuration


1. Copy everything from /usr/local/www/nextcloud/data to /usr/local/www/nextcloud/data2
2. Delete /usr/local/www/nextcloud/data folder
3. Stop plugin
4. Create jail with mountpooint from "pool" to /mnt/"pool"/iocage/jails/Nextcloud/root/usr/local/www/nextcloud/data
5. Start plugin
6. Copy everything from /usr/local/www/nextcloud/data2 to /usr/local/www/nextcloud/data
7. restart plugin

But before of course must be used manual from Mr. remear....
 

Hayama

Cadet
Joined
Dec 21, 2020
Messages
5
I seem to have fixed my fresh NextCloud plugin installation. Here's what I observed and fixed along the way.

I experienced the too many redirects error when attempting to load /apps/files post sign-in.

jexec'd into the jail. /usr/local/www/nextcloud/apps is empty. Apps seem to be located in /usr/local/www/nextcloud/apps-pkg.

Moveed the apps directory to where the nextcloud config default expects them to be located. cd /usr/local/www/nextcloud && mv apps apps-old && mv apps-pkg apps

Fixed logging by appending 'logfile' => '/var/log/nextcloud/nextcloud.log', to the config array in /usr/local/www/nextcloud/config/config.php

Restarted php-fpm and tried again. service php-fpm restart.

/var/log/nextcloud/nextcloud.log` complained with errors like `Base table or view not found: 1146 Table 'nextcloud.oc_flow_operations' doesn't exist.

Edited /usr/local/www/nextcloud/config/config.php and set 'installed' => false. Went to the base URL again (no /apps/files), and got to the installation screen so I could have it "re-do" the installation. Entered in the same DB connection info from the post-install details. Added info for a new admin user (not ncadmin, because it already exists). Submitted the form and let it complete.


Dear,

I just try your way and success to log into the nextcloud, i just meet some error when keying with the DB connection blanks. i forget what i have click/key-in that time but i could access in with a new admin account finally. Thank you.

I'm going to re-install the FreeNAS and re-install the nextcloud with your ways tomorrow and hope to more clarfiy about the right steps into log in the 20.0.4 nextcloud

Would you please give help to double check if my below steps were something wrong/missing? Hope below steps would help everyone here, thanks again:

Step1. Click Jails-->select nextcloud-->shell
Step2. input: cd /usr/local/www/nextcloud && mv apps apps-old && mv apps-pkg apps
Step3. input: edit /usr/local/www/nextcloud/config/config.php
Step4. add 1 new line into bottom of the config.php file with: 'logfile' => '/var/log/nextcloud/nextcloud.log', than save changes
Step5. input: service php-frm restart
Step6. input: edit /usr/local/www/nextcloud/config/config.php
Step7. find the line 'installed' => true and change into 'installed' => false
Step8. open a new page in Chrome/FireFox and key the nextcloud's URL(for me is 192.168.1.101)
Step9. log-in/key-in/create with NEW account(not ncadmin), the DB connection key with the pos-install details

log-in success with the new admin account:

1608736133623.png
 

remear

Cadet
Joined
Dec 22, 2020
Messages
4
I'm glad you were able to get things to a working state.

But now i have to know,how you knew this was the problem? I knew the error message while installing which said folder not found,the apps folder for example.

That error message made me curious about the resulting file structure. The apps-pkg folder looked like it actually contained the apps, so I decided to read through the example nextcloud config to understand the default apps path. I figured it was worth a shot to move apps-pkg to apps, which seemed to resolve that issue. Then I encountered the issue with the database tables and worked through the theory that the nextcloud installation hadn't completed correctly, or hadn't yet been performed at all. I remembered from previous nextcloud plugin installations I would enter the database credentials via the web UI, and it would perform some setup tasks. So, I decided to try setting installed to false to get back into that type of workflow.
 

remear

Cadet
Joined
Dec 22, 2020
Messages
4
Would you please give help to double check if my below steps were something wrong/missing? Hope below steps would help everyone here, thanks again:

Step1. Click Jails-->select nextcloud-->shell
Step2. input: cd /usr/local/www/nextcloud && mv apps apps-old && mv apps-pkg apps
Step3. input: edit /usr/local/www/nextcloud/config/config.php
Step4. add 1 new line into bottom of the config.php file with: 'logfile' => '/var/log/nextcloud/nextcloud.log', than save changes
Step5. input: service php-frm restart
Step6. input: edit /usr/local/www/nextcloud/config/config.php
Step7. find the line 'installed' => true and change into 'installed' => false
Step8. open a new page in Chrome/FireFox and key the nextcloud's URL(for me is 192.168.1.101)
Step9. log-in/key-in/create with NEW account(not ncadmin), the DB connection key with the pos-install details

Those steps should do it. I think Step 5 has a typo, where php-frm should be php-fpm. I might have also repeated step 5 after 7. These steps can be compressed into a single set of changes as follows:

  1. Click Jails -> select nextcloud -> shell
  2. cd /usr/local/www/nextcloud && mv apps apps-old && mv apps-pkg apps
  3. Edit /usr/local/www/nextcloud/config/config.php
    1. Change 'installed' => true to 'installed' => false
    2. Append 'logfile' => '/var/log/nextcloud/nextcloud.log'
    3. Save changes
  4. service php-fpm restart
  5. Load your nextcloud UI in a browser
  6. Enter post-install details for the database configuration, and new credentials for an admin account
 

shnurov

Explorer
Joined
Jul 22, 2015
Messages
74
I am getting a
404 Not Found
nginx
error after following through your steps.

Those steps should do it. I think Step 5 has a typo, where php-frm should be php-fpm. I might have also repeated step 5 after 7. These steps can be compressed into a single set of changes as follows:

  1. Click Jails -> select nextcloud -> shell
  2. cd /usr/local/www/nextcloud && mv apps apps-old && mv apps-pkg apps
  3. Edit /usr/local/www/nextcloud/config/config.php
    1. Change 'installed' => true to 'installed' => false
    2. Append 'logfile' => '/var/log/nextcloud/nextcloud.log'
    3. Save changes
  4. service php-fpm restart
  5. Load your nextcloud UI in a browser
  6. Enter post-install details for the database configuration, and new credentials for an admin account
 

jpatel

Cadet
Joined
Dec 21, 2020
Messages
6
I'm glad you were able to get things to a working state.



That error message made me curious about the resulting file structure. The apps-pkg folder looked like it actually contained the apps, so I decided to read through the example nextcloud config to understand the default apps path. I figured it was worth a shot to move apps-pkg to apps, which seemed to resolve that issue. Then I encountered the issue with the database tables and worked through the theory that the nextcloud installation hadn't completed correctly, or hadn't yet been performed at all. I remembered from previous nextcloud plugin installations I would enter the database credentials via the web UI, and it would perform some setup tasks. So, I decided to try setting installed to false to get back into that type of workflow.
A great find for sure. The only question I have is why are apps being put in "apps-pkg" directory when the default directory is "apps". I tried to find information about apps-pkg directory in nextcloud docs but didn't find anything.
 

remear

Cadet
Joined
Dec 22, 2020
Messages
4
apps-pkg seems to be patched in by the freenas setup - ref: https://github.com/search?q=org:freenas+apps-pkg&type=code

My current suspicion is that this issue related to what's mentioned in https://github.com/freenas/iocage-plugin-nextcloud/issues/28 and https://github.com/nextcloud/documentation/pull/2197#issuecomment-721432337. So the solution may be to leave the apps directory as apps-pkg, update some rewrite logic in https://github.com/freenas/iocage-p...ocal/etc/nginx/conf.d/nextcloud.conf.template, and change app-pkgs to apps-pkg in https://github.com/freenas/iocage-plugin-nextcloud/blob/master/post_install.sh#L120
 

Hayama

Cadet
Joined
Dec 21, 2020
Messages
5
Those steps should do it. I think Step 5 has a typo, where php-frm should be php-fpm. I might have also repeated step 5 after 7. These steps can be compressed into a single set of changes as follows:

  1. Click Jails -> select nextcloud -> shell
  2. cd /usr/local/www/nextcloud && mv apps apps-old && mv apps-pkg apps
  3. Edit /usr/local/www/nextcloud/config/config.php
    1. Change 'installed' => true to 'installed' => false
    2. Append 'logfile' => '/var/log/nextcloud/nextcloud.log'
    3. Save changes
  4. service php-fpm restart
  5. Load your nextcloud UI in a browser
  6. Enter post-install details for the database configuration, and new credentials for an admin account

Thanks of your advise, it comes more clear. I just follow your steps again and success to access in
 

danila_94

Cadet
Joined
Dec 22, 2020
Messages
7
I am getting a
404 Not Found
nginx
error after following through your steps.


1. Click Jails -> select nextcloud -> shell
2. cd /usr/local/www/nextcloud && mv apps apps-old && mv apps-pkg apps
3. Edit /usr/local/www/nextcloud/config/config.php
4. Change 'installed' => true to 'installed' => false
5. Append 'logfile' => '/var/log/nextcloud/nextcloud.log'
6. Save changes
7. service php-fpm restart
Load your nextcloud UI in a browser
Enter post-install details for the database configuration, and new credentials for an admin account


During new account creation
You have to use default location for data "/usr/local/www/nextcloud/data"
If you change then you get that error

Jail`s configuration after a new account creation


1. Copy everything from /usr/local/www/nextcloud/data to /usr/local/www/nextcloud/data2
2. Delete /usr/local/www/nextcloud/data folder
3. Stop plugin
4. Create jail with mountpooint from "pool" to /mnt/"pool"/iocage/jails/Nextcloud/root/usr/local/www/nextcloud/data
5. Start plugin
6. Copy everything from /usr/local/www/nextcloud/data2 to /usr/local/www/nextcloud/data
7. restart plugin
 
Last edited:

jpatel

Cadet
Joined
Dec 21, 2020
Messages
6
Thanks for the workaround. It unblocks everyone for now. but this issue must be fixed by devs. The previous JIRA ticket created was created as type "Suggestion". But this feature is not a suggestion, it is in fact a bug. So new ticket with a type bug was created. Below is the link. Can everyone here please vote it and add your comments there so they can bump up the priority?
 

Martin Th

Cadet
Joined
Dec 26, 2020
Messages
1
Hello everyone,

I am not sure if this issue is there for the plugin update, but I just finished installing NextCloud Plugin (Version 20.0.4) and I have added the entry of my domain into trusted_domains. I can successfully see the login page, but once I hit I login with valid credentials, the browser shows me ERR_TOO_MANY_REDIRECTS error with message "nextcloud.domain.com redirected you too many times."

It keeps trying to redirect to /apps/files uri. When I checked /usr/local/www/nextcloud/apps, it was empty. I saw there is a new directory called apps_pkg with apps and tried to change the configuration to point to that directory, but after that, I started getting "Gateway timeout error"

Here is my new config to point to the new app directory (getting 504 Gateway timeout with below config).

"apps_paths" => array(
0 => array(
‘path’ => ‘/usr/local/www/nextcloud/apps-pkg’,
‘url’ => ‘/apps-pkg’,
‘writable’ => true,
),
),

Can anyone please help me here?
I followed remear's advice and the following procedure worked for me for the ERR_TOO_MANY_REDIRECTS error:
  1. In case you don't have an editor, install nano in your Nextcloud jail by opening a shell and typing:
    pkg install nano
  2. In the shell change directory:
    cd /usr/local/www/nextcloud/config
  3. Edit config.php and set 'installed' to false, using:
    nano config.php
    'installed' => false
    You save and exit by hitting ctrl-x, y and then return
  4. When you now go to your Nextcloud site, you have to set a new user (not ncadmin), any password and the database settings from your jail (see your Post Install Notes):
    Database Name: nextcloud
    Database User: dbadmin
    Database Password: [new]
    Nextcloud Admin User: [new]
    Nextcloud Admin Password: [new]
That's all, folks
 

rasalone

Dabbler
Joined
Dec 21, 2020
Messages
10
https://jira.ixsystems.com/browse/NAS-108795 we got pass the first screen and tagged with ready for review! Small progress. Maybe someone can help explan to me whats the github vs jira? I know github is a code repository and Jira is ixsystem's report tracking. But what is the right avanue to chase down this kind of thing?
 

Kris Moore

SVP of Engineering
Administrator
Moderator
iXsystems
Joined
Nov 12, 2015
Messages
1,471
This should be resolved now. The issue was that the FreeBSD packages for nextcloud do that fancy move of apps -> apps-pkg, and that requires some custom bits in the config/config.php file before the installation starts. I've run through it a few times now and it appears to be in order again. Let me know if anybody else sees issues.
 

polizz

Cadet
Joined
Jan 6, 2021
Messages
1
The last of the workarounds is still required for me: editing installed => false so that the install process finishes.

Also, I have to manually modify the trusted_domains, because the current code adds the TrueNAS host IP not the nextcloud jail IP. I'm guessing this plugin assumes everyone uses NAT but that is not how my setup works.
 
Top