Resource icon

Scripted installation of Nextcloud 28 in iocage jail 2018-03-23

Gblenn

Dabbler
Joined
Feb 21, 2024
Messages
32
Interesting. Can you share your Caddyfile? Remove sensitive values. I'm having no issues right now.
Here it is...

When trying to log in from Firefox, I got the login errors no matter where I tried to log in, Edge, Chrome, different PC, and subsequently 30 penalty, and errors.
After that suddenly one of my instances refused to show any files when moving between folders (message saying folder empty) but when I did refresh in browser everything was there. This never cleared until logged out and logged in again. However I also got an error when trying to log out, at the first try, after which it worked and then files and items were there...
I wonder if there is something with web cache and/or something stored in NC about the sessions?? It changes over time...

{
# debug
# default_sni myddns.ddns.com
}

myddns.ddns.com {
root * /usr/local/www/nextcloud
file_server
log {
output file /var/log/myddns.ddns.com.log
}

php_fastcgi 127.0.0.1:9000 {
env front_controller_active true
}

tls /usr/local/etc/pki/tls/certs/fullchain.pem /usr/local/etc/pki/tls/private/privkey.pem

# client support (e.g. os x calendar / contacts)
redir /.well-known/carddav /remote.php/dav 301
redir /.well-known/caldav /remote.php/dav 301
redir /.well-known/webfinger /index.php/.well-known/webfinger 301
redir /.well-known/nodeinfo /index.php/.well-known/nodeinfo 301

# .htaccess / data / config / ... shouldn't be accessible from outside
@forbidden {
path /.htaccess
path /data/*
path /config/*
path /db_structure
path /.xml
path /README
path /3rdparty/*
path /lib/*
path /templates/*
path /occ
path /console.php
}

respond @forbidden 404

@notlegacy {
path *.php
not path /index*
not path /remote*
not path /public*
not path /cron*
not path /core/ajax/update*
not path /status*
not path /ocs/v1*
not path /ocs/v2*
not path /ocs-provider/*
not path /updater/*
not path */richdocumentscode/proxy*
}
rewrite @notlegacy /index.php{uri}

}
 
Last edited:

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
And @victort, thanks for all your help--not just in figuring out this rewrite rule, but in this thread in general.
 

Gblenn

Dabbler
Joined
Feb 21, 2024
Messages
32
Did you restart caddy after adding these blocks? And clear you browser cache?

Caddyfile looks good.
Restarted the jail, multiple times, and used multiple browsers opening up anonymous tabs = no cookies or cache. I guess now that you guys consider this issue being fixed I have do try again and do some more testing.
But I'm wondering if NC keeps some metadata or cache for each session you have. It tracks devices at least, and you can list all the one's where you have logged in...
 

victort

Guru
Joined
Dec 31, 2021
Messages
973
Restarted the jail, multiple times, and used multiple browsers opening up anonymous tabs = no cookies or cache. I guess now that you guys consider this issue being fixed I have do try again and do some more testing.
But I'm wondering if NC keeps some metadata or cache for each session you have. It tracks devices at least, and you can list all the one's where you have logged in...
Please do. I’ve even gone back and went to more devices and more incog tabs and no issues so far.
 

Gblenn

Dabbler
Joined
Feb 21, 2024
Messages
32
Please do. I’ve even gone back and went to more devices and more incog tabs and no issues so far.
I have now been running my server with the changed Caddyfile for close to 2 days without any issues. I have no idea what happened before with the login and all that strange behaviour. May have been totally unrelated...
 

victort

Guru
Joined
Dec 31, 2021
Messages
973
@danb35 I finally did get the path_regexp working for me. Check the caddy forums for the updated block.

Wondering if it would be best practice to use that in order to keep things as close as possible between web servers.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Wondering if it would be best practice to use that in order to keep things as close as possible between web servers.
I think my inclination would be to keep it as it is. It does make the Caddyfile longer, but I think it's quite a bit easier to follow what's happening there. I see the attraction of keeping it as similar to "upstream" (such as it is) as possible, but I'm not sure how much that applies if we're using a completely different web server.
 

cdog89

Explorer
Joined
Jan 19, 2024
Messages
75
I wake up this morning to an apparent power glitch during the middle of the night. Even though the server is on a UPS battery backup, it apparently rebooted (as indicated by system logs). Now both my plex server and nextcloud server aren't working. I can ping both jails, but the secure domain name(s) in the Caddyfile won't connect to the server. I'm most concerned about the nextcloud server. I know the data is located outside of the jail, so not concerned about losing it, but I'm a little concerned nonetheless.

I've restored the snapshot for the jails to one from 2 days ago, but it doesn't fix the problem. The onlyoffice server jail seems to be working fine. I don't know if it's related, but I installed the turnserver to the nextcloud jail without configuration. I don't think it's the problem since both the plex and nextcloud servers located in separate jails don't seem to be working. Maybe it's the Caddyfile, though I've changed nothing in it.

Any tips would be fantastic. Thanks all!
 
Last edited:

victort

Guru
Joined
Dec 31, 2021
Messages
973
I wake up this morning to an apparent power glitch during the middle of the night. Even though the server is on a UPS battery backup, it apparently rebooted (as indicated by system logs). Now both my plex server and nextcloud server aren't working. I can ping both jails, but the secure domain name(s) in the Caddyfile won't connect to the server. I'm most concerned about the nextcloud server. I know the data is located outside of the jail, so not concerned about losing it, but I'm a little concerned nonetheless.

I've restored the snapshot for the jails to one from 2 days ago, but it doesn't fix the problem. The onlyoffice server jail seems to be working fine. I don't know if it's related, but I installed the turnserver to the nextcloud jail without configuration. I don't think it's the problem since both the plex and nextcloud servers located in separate jails don't seem to be working. Maybe it's the Caddyfile, though I've changed nothing in it.

Any tips would be fantastic. Thanks all!
It is likely not an issue with the Caddyfile if you didn’t make any changes when this happened.

1. Reboot entire server
2. See if pinging your domain names gives you the proper IP of the jails
3. Check these two log files and look for lines that start with level:error /var/log/caddy/caddy.log /var/log/yourdominsname.tld.log

Post the errors on here if any are present.
 

cdog89

Explorer
Joined
Jan 19, 2024
Messages
75
It is likely not an issue with the Caddyfile if you didn’t make any changes when this happened.

1. Reboot entire server

1. Done

2. See if pinging your domain names gives you the proper IP of the jails

Ping is successful:

Pinging nextcloud.XXXX.com [66.68.89.140] with 32 bytes of data:
Reply from XX.XX.89.140: bytes=32 time=5ms TTL=64
Reply from XX.XX.89.140: bytes=32 time=8ms TTL=64
Reply from XX.XX.89.140: bytes=32 time=5ms TTL=64
Reply from XX.XX.89.140: bytes=32 time=8ms TTL=64

Ping statistics for XX.XX.89.140:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 5ms, Maximum = 8ms, Average = 6ms



3. Check these two log files and look for lines that start with level:error /var/log/caddy/caddy.log /var/log/yourdominsname.tld.log

Post the errors on here if any are present.

There were some errors. It was referencing gzip:

Error: adapting config using caddyfile: /usr/local/www/Caddyfile:53: unrecognized directive: gzip
Error: caddy process exited with error: exit status 1

So I DID make a change that broke it. I restored the Caddyfile from 2 days ago and now at least reach the secure server. But I get the message:

Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

I'm trying to access the nextcloud log file now, but running into security issues accessing through windows SMB. I'm working on that, but wanted to post the current status.

Edit: the nextcloud.log shows errors starting from today (03/11/2024). All the messages are the same for each line near the bottom of the log. I tried to copy the error, but the line is massively long.

As I indicated before I installed the package 'turnserver-4.6.2' because video calls were being dropped in nextcloud. I never configured it, but it was installed. Is it possible this broke nextcloud?

Also, here's the code for the Caddyfile as it stands:

Code:
{
# debug
# acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
email XXXX
default_sni nextcloud.XXXX.com
}

nextcloud.XXXX.com {
root * /usr/local/www/nextcloud
file_server
log {
output file /var/log/www.XXXX.com.log
}

php_fastcgi 127.0.0.1:9000 {
env front_controller_active true
}

# tls {
# dns cloudflare XXXX
# }

header {
enable HSTS
Strict-Transport-Security max-age=31536000;
}

# client support (e.g. os x calendar / contacts)
redir /.well-known/carddav /remote.php/dav 301
redir /.well-known/caldav /remote.php/dav 301
redir /.well-known/webfinger /index.php/.well-known/webfinger 301
redir /.well-known/nodeinfo /index.php/.well-known/nodeinfo 301

# .htaccess / data / config / ... shouldn't be accessible from outside
@forbidden {
path /.htaccess
path /data/*
path /config/*
path /db_structure
path /.xml
path /README
path /3rdparty/*
path /lib/*
path /templates/*
path /occ
path /console.php
}

respond @forbidden 404
}

onlyoffice.XXXX.com {
reverse_proxy http://192.168.86.201
}
collabora.XXXX.com {
encode gzip
@collabora {
path /loleaflet/* # Loleaflet is the client part of LibreOffice Online
path /hosting/discovery # WOPI discovery URL
path /hosting/capabilities # Show capabilities as json
path /lool/* # Main websocket, uploads/downloads, presentations
}
reverse_proxy @collabora http://192.168.86.27:9980
}

plex.XXXX.com {
reverse_proxy http://192.168.86.199:32400
}

 
Last edited:

victort

Guru
Joined
Dec 31, 2021
Messages
973
1. Done



Ping is successful:

Pinging nextcloud.XXXX.com [66.68.89.140] with 32 bytes of data:
Reply from XX.XX.89.140: bytes=32 time=5ms TTL=64
Reply from XX.XX.89.140: bytes=32 time=8ms TTL=64
Reply from XX.XX.89.140: bytes=32 time=5ms TTL=64
Reply from XX.XX.89.140: bytes=32 time=8ms TTL=64

Ping statistics for XX.XX.89.140:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 5ms, Maximum = 8ms, Average = 6ms





There were some errors. It was referencing gzip:



So I DID make a change that broke it. I restored the Caddyfile from 2 days ago and now at least reach the secure server. But I get the message:



I'm trying to access the nextcloud log file now, but running into security issues accessing through windows SMB. I'm working on that, but wanted to post the current status.

Edit: the nextcloud.log shows errors starting from today (03/11/2024). All the messages are the same for each line near the bottom of the log. I tried to copy the error, but the line is massively long.

As I indicated before I installed the package 'turnserver-4.6.2' because video calls were being dropped in nextcloud. I never configured it, but it was installed. Is it possible this broke nextcloud?

Also, here's the code for the Caddyfile as it stands:

Code:
{
# debug
# acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
email XXXX
default_sni nextcloud.XXXX.com
}

nextcloud.XXXX.com {
root * /usr/local/www/nextcloud
file_server
log {
output file /var/log/www.XXXX.com.log
}

php_fastcgi 127.0.0.1:9000 {
env front_controller_active true
}

# tls {
# dns cloudflare XXXX
# }

header {
enable HSTS
Strict-Transport-Security max-age=31536000;
}

# client support (e.g. os x calendar / contacts)
redir /.well-known/carddav /remote.php/dav 301
redir /.well-known/caldav /remote.php/dav 301
redir /.well-known/webfinger /index.php/.well-known/webfinger 301
redir /.well-known/nodeinfo /index.php/.well-known/nodeinfo 301

# .htaccess / data / config / ... shouldn't be accessible from outside
@forbidden {
path /.htaccess
path /data/*
path /config/*
path /db_structure
path /.xml
path /README
path /3rdparty/*
path /lib/*
path /templates/*
path /occ
path /console.php
}

respond @forbidden 404
}

onlyoffice.XXXX.com {
reverse_proxy http://192.168.86.201
}
collabora.XXXX.com {
encode gzip
@collabora {
path /loleaflet/* # Loleaflet is the client part of LibreOffice Online
path /hosting/discovery # WOPI discovery URL
path /hosting/capabilities # Show capabilities as json
path /lool/* # Main websocket, uploads/downloads, presentations
}
reverse_proxy @collabora http://192.168.86.27:9980
}

plex.XXXX.com {
reverse_proxy http://192.168.86.199:32400
}

Would like to see that error line…

It looks like it’s resolving to your public IP. Can’t you set it to resolve locally using your router?
 

cdog89

Explorer
Joined
Jan 19, 2024
Messages
75
Would like to see that error line…

It looks like it’s resolving to your public IP. Can’t you set it to resolve locally using your router?

Ok, I def need to brush up on my permissions management. I managed to setup a share for the folder containing the log files and copied them to my Windows PC. As I said, the nextcloud.log is massive. I tried to find where the error repeats, and here's what I have:

Code:
{"reqId":"S05HSwinXmCg7ZqxySxG","level":3,"time":"2024-03-11T12:43:00-05:00","remoteAddr":"192.168.86.1","user":"--","app":"index","method":"GET","url":"/index.php/204","message":"Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory","userAgent":"Mozilla/5.0 (Windows) mirall/3.12.0stable-Win64 (build 20240213) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"28.0.3.2","exception":{"Exception":"Doctrine\\DBAL\\Exception","Message":"Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory","Code":2002,"Trace":[{"file":"/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1654,"function":"connect","class":"OC\\DB\\Connection","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1081,"function":"getWrappedConnection","class":"Doctrine\\DBAL\\Connection","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/DB/Connection.php","line":261,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->","args":["SELECT * FROM `oc_appconfig`",[],[],null]},{"file":"/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":337,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->","args":["SELECT * FROM `oc_appconfig`",[],[],null]},{"file":"/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":377,"function":"executeQuery","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":280,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/AppConfig.php","line":421,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/AppConfig.php","line":187,"function":"loadConfigValues","class":"OC\\AppConfig","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/AppConfig.php","line":377,"function":"getApps","class":"OC\\AppConfig","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/App/AppManager.php","line":128,"function":"getValues","class":"OC\\AppConfig","type":"->","args":[false,"enabled"]},{"file":"/usr/local/www/nextcloud/lib/private/App/AppManager.php","line":149,"function":"getInstalledAppsValues","class":"OC\\App\\AppManager","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/legacy/OC_App.php","line":231,"function":"getInstalledApps","class":"OC\\App\\AppManager","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php","line":90,"function":"getEnabledApps","class":"OC_App","type":"::","args":[]},{"file":"/usr/local/www/nextcloud/lib/base.php","line":700,"function":"runInitialRegistration","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/base.php","line":1200,"function":"init","class":"OC","type":"::","args":[]},{"file":"/usr/local/www/nextcloud/index.php","line":37,"args":["/usr/local/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/usr/local/www/nextcloud/lib/private/DB/Connection.php","Line":139,"message":"Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory","exception":{},"CustomMessage":"Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory"}}
{"reqId":"S05HSwinXmCg7ZqxySxG","level":3,"time":"2024-03-11T12:43:00-05:00","remoteAddr":"192.168.86.1","user":"--","app":"core","method":"GET","url":"/index.php/204","message":"Exception thrown: Doctrine\\DBAL\\Exception","userAgent":"Mozilla/5.0 (Windows) mirall/3.12.0stable-Win64 (build 20240213) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"28.0.3.2","exception":{"Exception":"Doctrine\\DBAL\\Exception","Message":"Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory","Code":2002,"Trace":[{"file":"/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1654,"function":"connect","class":"OC\\DB\\Connection","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1081,"function":"getWrappedConnection","class":"Doctrine\\DBAL\\Connection","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/DB/Connection.php","line":261,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->","args":["SELECT * FROM `oc_appconfig`",[],[],null]},{"file":"/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":337,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->","args":["SELECT * FROM `oc_appconfig`",[],[],null]},{"file":"/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":377,"function":"executeQuery","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":280,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/AppConfig.php","line":421,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/AppConfig.php","line":187,"function":"loadConfigValues","class":"OC\\AppConfig","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/AppConfig.php","line":377,"function":"getApps","class":"OC\\AppConfig","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/App/AppManager.php","line":128,"function":"getValues","class":"OC\\AppConfig","type":"->","args":[false,"enabled"]},{"file":"/usr/local/www/nextcloud/lib/private/App/AppManager.php","line":149,"function":"getInstalledAppsValues","class":"OC\\App\\AppManager","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/legacy/OC_App.php","line":231,"function":"getInstalledApps","class":"OC\\App\\AppManager","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php","line":90,"function":"getEnabledApps","class":"OC_App","type":"::","args":[]},{"file":"/usr/local/www/nextcloud/lib/base.php","line":700,"function":"runInitialRegistration","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/base.php","line":1200,"function":"init","class":"OC","type":"::","args":[]},{"file":"/usr/local/www/nextcloud/index.php","line":37,"args":["/usr/local/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/usr/local/www/nextcloud/lib/private/DB/Connection.php","Line":139,"CustomMessage":"Exception thrown: Doctrine\\DBAL\\Exception"}}


If I recall, the 'turnserver' package did install mariadb. I'm not sure, but maybe it messed up the database settings for nextcloud?

If so, I'm guessing that a full reinstall of nextcloud would be necessary using danb's . In that case, is it possible to keep the nextcloud configurations that I've already set up? Kind of, like, copy certain folders to a secure location. Run the script. Then copy those folders back?

Thanks @victort for you help! I clearly need to get a handle on jail backups before making changes. I thought I had a jail backup script in place, but it didn't work. I used an old script from 9-10 years ago found in the forum, but the .gz file doesn't appear correct.
 
Last edited:

victort

Guru
Joined
Dec 31, 2021
Messages
973
Best is to go to the shell and to tail /var/log/nextcloud.xxx.com.log This will give you the most recent logs.
Can you also post your config.php for nextcloud?
Did you make any changes to that?
It looks like you might be having issues with your database .
 

cdog89

Explorer
Joined
Jan 19, 2024
Messages
75
Ok, I def need to brush up on my permissions management. I managed to setup a share for the folder containing the log files and copied them to my Windows PC. As I said, the nextcloud.log is massive. I tried to find where the error repeats, and here's what I have:

Code:
{"reqId":"S05HSwinXmCg7ZqxySxG","level":3,"time":"2024-03-11T12:43:00-05:00","remoteAddr":"192.168.86.1","user":"--","app":"index","method":"GET","url":"/index.php/204","message":"Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory","userAgent":"Mozilla/5.0 (Windows) mirall/3.12.0stable-Win64 (build 20240213) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"28.0.3.2","exception":{"Exception":"Doctrine\\DBAL\\Exception","Message":"Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory","Code":2002,"Trace":[{"file":"/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1654,"function":"connect","class":"OC\\DB\\Connection","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1081,"function":"getWrappedConnection","class":"Doctrine\\DBAL\\Connection","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/DB/Connection.php","line":261,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->","args":["SELECT * FROM `oc_appconfig`",[],[],null]},{"file":"/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":337,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->","args":["SELECT * FROM `oc_appconfig`",[],[],null]},{"file":"/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":377,"function":"executeQuery","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":280,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/AppConfig.php","line":421,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/AppConfig.php","line":187,"function":"loadConfigValues","class":"OC\\AppConfig","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/AppConfig.php","line":377,"function":"getApps","class":"OC\\AppConfig","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/App/AppManager.php","line":128,"function":"getValues","class":"OC\\AppConfig","type":"->","args":[false,"enabled"]},{"file":"/usr/local/www/nextcloud/lib/private/App/AppManager.php","line":149,"function":"getInstalledAppsValues","class":"OC\\App\\AppManager","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/legacy/OC_App.php","line":231,"function":"getInstalledApps","class":"OC\\App\\AppManager","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php","line":90,"function":"getEnabledApps","class":"OC_App","type":"::","args":[]},{"file":"/usr/local/www/nextcloud/lib/base.php","line":700,"function":"runInitialRegistration","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/base.php","line":1200,"function":"init","class":"OC","type":"::","args":[]},{"file":"/usr/local/www/nextcloud/index.php","line":37,"args":["/usr/local/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/usr/local/www/nextcloud/lib/private/DB/Connection.php","Line":139,"message":"Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory","exception":{},"CustomMessage":"Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory"}}
{"reqId":"S05HSwinXmCg7ZqxySxG","level":3,"time":"2024-03-11T12:43:00-05:00","remoteAddr":"192.168.86.1","user":"--","app":"core","method":"GET","url":"/index.php/204","message":"Exception thrown: Doctrine\\DBAL\\Exception","userAgent":"Mozilla/5.0 (Windows) mirall/3.12.0stable-Win64 (build 20240213) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"28.0.3.2","exception":{"Exception":"Doctrine\\DBAL\\Exception","Message":"Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory","Code":2002,"Trace":[{"file":"/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1654,"function":"connect","class":"OC\\DB\\Connection","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1081,"function":"getWrappedConnection","class":"Doctrine\\DBAL\\Connection","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/DB/Connection.php","line":261,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->","args":["SELECT * FROM `oc_appconfig`",[],[],null]},{"file":"/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":337,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->","args":["SELECT * FROM `oc_appconfig`",[],[],null]},{"file":"/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":377,"function":"executeQuery","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":280,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/AppConfig.php","line":421,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/AppConfig.php","line":187,"function":"loadConfigValues","class":"OC\\AppConfig","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/AppConfig.php","line":377,"function":"getApps","class":"OC\\AppConfig","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/App/AppManager.php","line":128,"function":"getValues","class":"OC\\AppConfig","type":"->","args":[false,"enabled"]},{"file":"/usr/local/www/nextcloud/lib/private/App/AppManager.php","line":149,"function":"getInstalledAppsValues","class":"OC\\App\\AppManager","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/legacy/OC_App.php","line":231,"function":"getInstalledApps","class":"OC\\App\\AppManager","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php","line":90,"function":"getEnabledApps","class":"OC_App","type":"::","args":[]},{"file":"/usr/local/www/nextcloud/lib/base.php","line":700,"function":"runInitialRegistration","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/base.php","line":1200,"function":"init","class":"OC","type":"::","args":[]},{"file":"/usr/local/www/nextcloud/index.php","line":37,"args":["/usr/local/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/usr/local/www/nextcloud/lib/private/DB/Connection.php","Line":139,"CustomMessage":"Exception thrown: Doctrine\\DBAL\\Exception"}}


If I recall, the 'turnserver' package did install mariadb. I'm not sure, but maybe it messed up the database settings for nextcloud?

If so, I'm guessing that a full reinstall of nextcloud would be necessary using danb's . In that case, is it possible to keep the nextcloud configurations that I've already set up? Kind of, like, copy certain folders to a secure location. Run the script. Then copy those folders back?

Thanks @victort for you help! I clearly need to get a handle on jail backups before making changes. I thought I had a jail backup script in place, but it didn't work. I used an old script from 9-10 years ago found in the forum, but the .gz file doesn't appear correct.
Best is to go to the shell and to tail /var/log/nextcloud.xxx.com.log This will give you the most recent logs.
Can you also post your config.php for nextcloud?
Did you make any changes to that?
It looks like you might be having issues with your database .

Sure, here's the config.php file - no changes were made to that.

Code:
<?php
$CONFIG = array (
  'passwordsalt' => 'XXXX',
  'secret' => 'XXXX',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => 'nextcloud.XXXX.com',
    2 => '192.168.86.200',
  ),
  'datadirectory' => '/mnt/files',
  'dbtype' => 'mysql',
  'version' => '28.0.3.2',
  'overwrite.cli.url' => 'https://nextcloud.XXXX.com',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:/var/run/mysql/mysql.sock',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'XXXX',
  'installed' => true,
  'instanceid' => 'XXXX',
  'logtimezone' => 'America/Chicago',
  'default_phone_region' => 'US',
  'log_type' => 'file',
  'logfile' => '/var/log/nextcloud/nextcloud.log',
  'loglevel' => '2',
  'logrotate_size' => '104847600',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
  ),
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'overwritehost' => 'nextcloud.XXXX.com',
  'overwriteprotocol' => 'https',
  'htaccess.RewriteBase' => '/',
  'trusted_proxies' =>
  array (
    1 => 'localhost',
  ),
  'maintenance_window_start' => 5,
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'XXXX',
  'mail_domain' => 'XXXX.com',
  'mail_smtphost' => 'smtp.XXXX.com',
  'mail_smtpport' => '587',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'XXXX',
  'mail_smtppassword' => 'XXXX',
  'app_install_overwrite' =>
  array (
    0 => 'facerecognition',
    1 => 'pdfdraw',
    2 => 'google_synchronization',
  ),
  'maintenance' => false,
);

 

victort

Guru
Joined
Dec 31, 2021
Messages
973
Ran into some weird issue with Internal Server Error after installing google storage external support. I know that there are two google integration apps, one of which warns of this behaviour, but the other one has no warning. But as I recall it was an untested app so…

I now have to reinstall including new datasets. I tried rolling back snapshots, reinstalling jail, but nothing worked. I have seen this issue in multiple other threads, but no solutions.
Referencing this post here.

Did you install the Google External support integration by any chance?
 

cdog89

Explorer
Joined
Jan 19, 2024
Messages
75
Is that the Google drive synchronization app for nextcloud? If so, yes, I did.

Ok....so it looks like I have to reinstall nextcloud. If I do, I think I can save the Caddyfile and config.php files, then restore them to the new installation. What about the user files? I only have 1 login so far (me). Is it possible to copy those over as well and they 'automatically' work? Or are the user definitions stored in the db (which will be brand new, I'm guessing).

I guess the big question is: Is there a procedure anywhere for installing a new nextcloud jail and use configurations from another jail to make it easier?

Also, what kind of backup procedure should I use if I want to rollback to versions from days, or weeks, ago? Should I make copies of the entire jail? Or would the snapshot system work?
 

victort

Guru
Joined
Dec 31, 2021
Messages
973
Is that the Google drive synchronization app for nextcloud? If so, yes, I did.

Ok....so it looks like I have to reinstall nextcloud. If I do, I think I can save the Caddyfile and config.php files, then restore them to the new installation. What about the user files? I only have 1 login so far (me). Is it possible to copy those over as well and they 'automatically' work? Or are the user definitions stored in the db (which will be brand new, I'm guessing).

I guess the big question is: Is there a procedure anywhere for installing a new nextcloud jail and use configurations from another jail to make it easier?
Why do you feel you need to reinstall?

You can disable the app from the command line.

Can you post the output of su -m www -c 'php /usr/local/www/nextcloud/occ app:list' from inside you jail?
I'm not sure what the app is called, but if you find the name of it you can then run su -m www -c 'php /usr/local/www/nextcloud/occ app:remove appname' to remove it.
 

victort

Guru
Joined
Dec 31, 2021
Messages
973
Is that the Google drive synchronization app for nextcloud? If so, yes, I did.

Ok....so it looks like I have to reinstall nextcloud. If I do, I think I can save the Caddyfile and config.php files, then restore them to the new installation. What about the user files? I only have 1 login so far (me). Is it possible to copy those over as well and they 'automatically' work? Or are the user definitions stored in the db (which will be brand new, I'm guessing).

I guess the big question is: Is there a procedure anywhere for installing a new nextcloud jail and use configurations from another jail to make it easier?

Also, what kind of backup procedure should I use if I want to rollback to versions from days, or weeks, ago? Should I make copies of the entire jail? Or would the snapshot system work?
And if you do reinstall, all you have to do is rename your old jail to nextcloud1 or something, and rerun the script overtop of you data. It will detect a reinstall and leave your data intact.
Once you confirm everything is working, you can delete the old jail.
 
Top