[Support] Linuxserver.io - Nextcloud


Recommended Posts

Hey everyone. I'm having a similar problem as mrvilla was, I think. I recently noticed the mobile app was getting unknown error when trying to auto upload photos. I started digging and found NextCloud is not reaching the MariaDB database. Upon checking the MariaDB log, I see 

 

170825 10:59:42 mysqld_safe Logging to syslog.170825 10:59:42 mysqld_safe Starting mysqld daemon with databases from /config/databases

and it's repeating over and over, almost every second. I'm not sure where to go from here.

I've tried removing both containers and images and, then loading them back, same results. From what I can tell the mysqld is failing and starting over and over. I haven't changed any file permissions (I know better / I learned my lesson one time).

 

 

 

 

Edited by d8sychain
Link to comment
On 25/08/2017 at 4:17 PM, d8sychain said:

Hey everyone. I'm having a similar problem as mrvilla was, I think. I recently noticed the mobile app was getting unknown error when trying to auto upload photos. I started digging and found NextCloud is not reaching the MariaDB database. Upon checking the MariaDB log, I see 

 

 


170825 10:59:42 mysqld_safe Logging to syslog.170825 10:59:42 mysqld_safe Starting mysqld daemon with databases from /config/databases
 

and it's repeating over and over, almost every second. I'm not sure where to go from here.

I've tried removing both containers and images and, then loading them back, same results. From what I can tell the mysqld is failing and starting over and over. I haven't changed any file permissions (I know better / I learned my lesson one time).

 

 

 

 

 

Answer is in the mariadb thread

 

 

Link to comment
On ‎15‎/‎06‎/‎2017 at 2:26 AM, aleary said:

 

I had similar client timeout issues after changing my letsencrypt/nextcloud settings. (I was changing from www.mydomain.com/nextcloud to nextcloud.mydomain.com)

It turned out that the Android and Windows clients repeatedly attempted to connect using the old URL before I managed to change their settings to the new URL.

 

The BruteForce Login Protection in Nextcloud kicked in and slowed/prevented all my client apps from connecting.

 

You may have run into the effects of this feature too.

 

Check the admin log for entries like the following:

 

   Bruteforce attempt from "172.17.0.1" detected for action ...

 

Also check  the "oc_bruteforce_attempts" table in your database. Clearing out the relevant entries in this table resolved the problem for me.

 

/Alan.

Checked all that out.  Things have moved on a bit.  The slow issue seemed to resolve itself for me when I upgraded to v112.02. ....  Except for 1 server.  This was the main one I was referring to above.  It all works but, way too slow.  Checked the logs. Nothing there different to other machines I look after.

 

The phone app times out when you try to log in.

Brute force is turned off.

Any other ideas?

 

Edited by Jessie
Link to comment

Not step by step of everthing I did, because there was some trial and error, but here is what I found to get NextCloud running again.

 

Issue:

NextCloud quit working using MariaDB (I still don't know the root cause of what triggered this exactly other than a corrupt file)

 

Errors:

NextCloud: HTTP 500 error

All NextCloud clients fail to connect

NextCloud docker log:

2017/08/27 16:14:19 [error] 306#306: *250 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [1045] Access denied for user 'oc_nextcloud'@'172.17.0.1' (using password: YES) in /config/www/nextcloud/lib/private/DB/Connection.php:61
Stack trace:
#0 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()
#1 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /config/www/nextcloud/lib/private/DB/Connection.php(148): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverM...
PHP message: PHP Fatal error:  Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [1045] Access denied for user 'oc_nextcloud'@'172.17.0.1' (using password: YES) in /config/www/nextcloud/lib/private/DB/Connection.php:61
Stack trace:
#0 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()
#1 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /config/www/nextcloud/lib/private/DB/Connection.php(148): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /confi

This would repeat over and over

MariaDB docker log:

170827 14:36:56 mysqld_safe Logging to syslog.
170827 14:36:56 mysqld_safe Starting mysqld daemon with databases from /config/databases
170827 14:36:57 mysqld_safe Logging to syslog.
170827 14:36:57 mysqld_safe Starting mysqld daemon with databases from /config/databases
170827 14:36:58 mysqld_safe Logging to syslog.
170827 14:36:58 mysqld_safe Starting mysqld daemon with databases from /config/databases
170827 14:36:59 mysqld_safe Logging to syslog.
170827 14:36:59 mysqld_safe Starting mysqld daemon with databases from /config/databases
170827 14:37:00 mysqld_safe Logging to syslog.
170827 14:37:00 mysqld_safe Starting mysqld daemon with databases from /config/databases

This also would repeat over and over

 

My explanation:

NextCloud quit working because it could no longer connect to the MariaDB database server. The MariaDB mysqld service was not starting and retrying repeatedly, because of a corrupt file. Eventually I determined that /appdata/maria/databases/ib_logfile0 was the cause by replacing the files in ../databases/ one at a time (more on that later)

 

New Solution:

1. Stop the NextCloud container

2. Stop the MariaDB container

3. Delete files 'ib_logfile0' and 'ib_logfile1' in  '/mnt/user/appdata/mariadb/databases/' (or where ever your '/config/databases/' is located) MariaDB will replace these when restarted

4. Start the MariaDB container

5. Start the NextCloud container

 

<--Ignore This -->

I realized later on a lot of this was not necessary and was only needed to fix things that I messed up along the way

Old Solution:
1. Stop the NextCloud container
2. Stop the MariaDB container
3. Edit the MariaDB template and change the AppData Config Path (mine was '/mnt/user/appdata/mariadb' I changed it to '/mnt/user/appdata/mariadb-nextcloud')
4. Start the MariaDB container and then stop it again. Let it run for a minute as it starting for the first time basically and creating all the files that belong in the AppData Config Path (see container log)
5. Copy and Paste the folder containing the NextCloud database '/mnt/user/appdata/mariadb/databases/nextcloud' to the new AppData Config Path '/mnt/user/appdata/mariadb-nextcloud/databases/' (I used Krusader, I'm not very good with the command line)
6. Copy and Paste the file '/mnt/user/appdata/mariadb/databases/ibdata1' to the new AppData Config Path '/mnt/user/appdata/mariadb-nextcloud/databases/'
7. Start the MariaDB container
8. Open the config file for NextCloud '/appdata/nextcloud/www/nextcloud/config/config.php and note the 'dbuser' and 'dbpassword' (I used Notepad++)
9. Create a new user in MariaDB and set the username and password the same as it is in the NextCloud config file (I used MySQL Workbench)
10. Set the new user to have full administrative roles
11. Restart the MariaDB container
12. Start the NextCloud container

 

Edited by d8sychain
Changed solution method
Link to comment

CHBMB, I completely agree, using a backup would have been much better. Dumb (and laziness maybe) on my part. That however has been took care using CA, scheduled weekly.

 

I tried using

docker exec -it mariadb bash
mv /config/log/ /config/log-old/
exit
docker restart mariadb

as you had mentioned in the MariaDB thread but it didn't work for me. Everything executed fine and I didn't have any problem with the command lines, but the problem file wasn't in 'config/log/' it was in 'config/databases/'. It was 'ib_logfile0' that was causing the issue. After the container recreated all of the files (because I changed the AppData Config Path in the template). I stopped and started the container, replacing each file in there, one at a time, with the old (original files) in between each start and checked the log files until the issue came back. Once I put the original 'lb_logfile0' in '/databases/' the the issue started again.

 

Here is what I found on those files "What exactly are iblog files in mysql"

 

I was still unsure why I had to fix the dbuser and dbpassword for NextCloud to work, until I looked into things further. MySQL stores the user info in its own database. Although I have not tested this, I should have just copied over both the 'mysql' and 'nextcloud' folder and that would have saved some steps

Link to comment
47 minutes ago, d8sychain said:

I was still unsure why I had to fix the dbuser and dbpassword for NextCloud to work, until I looked into things further. MySQL stores the user info in its own database. Although I have not tested this, I should have just copied over both the 'mysql' and 'nextcloud' folder and that would have saved some steps

 

Actually what I should have done was much simpler. I edited my original post and listed a much simpler solution.

Link to comment

Hi, after the appdata backup the containers restarted fine but now nextcloud does not work, container logs:

 

Quote

Brought to you by linuxserver.io

We gratefully accept donations at:

https://www.linuxserver.io/donations/

-------------------------------------

GID/UID

-------------------------------------

User uid: 99

User gid: 100

-------------------------------------

 

[cont-init.d] 10-adduser: exited 0.

[cont-init.d] 20-config: executing...

[cont-init.d] 20-config: exited 0.

[cont-init.d] 30-keygen: executing...

using keys found in /config/keys

[cont-init.d] 30-keygen: exited 0.

[cont-init.d] 40-config: executing...

[cont-init.d] 40-config: exited 0.

[cont-init.d] 50-install: executing...

[cont-init.d] 50-install: exited 0.

[cont-init.d] 60-memcache: executing...

[cont-init.d] 60-memcache: exited 0.

[cont-init.d] done.

[services.d] starting services

[services.d] done.

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes) in /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php on line 128

 

[owncloud]

[3] Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes) at /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php#128
		
	


 

database mariaDB seem fine i can connect with: mysql -h  localhost -u root -p

to the database.

 

any idea?

 

thanks

Link to comment
  • 2 weeks later...
7 minutes ago, chalk4 said:

Any chance we could have the Preview Generator built into this docker container?

 

https://apps.nextcloud.com/apps/previewgenerator

 

I am struggling to get this setup with the current docker container.

 

Nope, that would make it an absolute nightmare to support.  Two different pieces of software with different release schedules.  What are you struggling with?

Link to comment
docker exec -i nextcloud sudo -u abc php7 /config/www/nextcloud/occ preview:pre-generate

Will run the preview.  Can add it to Unraid cron once you've confirmed it's working as expected.

 

EDIT:  Or use user scripts to schedule it, sorry @Squid always forget you've made it easier for us.... :D

Edited by CHBMB
  • Like 1
Link to comment

Thank you!   It is running now but I did get the following error:

 

Error PHP

Allowed memory size of 134217728 bytes exhausted (tried to allocate 12288 bytes) at /config/www/nextcloud/lib/private/legacy/image.php#477

 

When I tried to run it again it said the command is already running.  I will let it run for a while and check the results.

Link to comment
35 minutes ago, chalk4 said:

Thank you!   It is running now but I did get the following error:

 

Error PHP

Allowed memory size of 134217728 bytes exhausted (tried to allocate 12288 bytes) at /config/www/nextcloud/lib/private/legacy/image.php#477

 

When I tried to run it again it said the command is already running.  I will let it run for a while and check the results.

 

I think you need to run this command the first time, to generate previews for files already present.

 

docker exec -i nextcloud sudo -u abc php7 /config/www/nextcloud/occ preview:generate-all

 

  • Like 1
Link to comment

Thanks CHBMB!  I did need to run the preview:generate-all first to generate the previews for the existing images.  However it ran for a few minutes and then I get the PHP error above.   When I try to rerun the command I get the same result.  I have tried restarting the nextcloud docker too but it results in the same error.

 

Error    PHP    Allowed memory size of 134217728 bytes exhausted (tried to allocate 12288 bytes) at /config/www/nextcloud/lib/private/legacy/image.php#477    in a few seconds
Error    PHP    Allowed memory size of 134217728 bytes exhausted (tried to allocate 12288 bytes) at /config/www/nextcloud/lib/private/legacy/image.php#477    a minute ago
Error    PHP    Allowed memory size of 134217728 bytes exhausted (tried to allocate 12288 bytes) at /config/www/nextcloud/lib/private/legacy/image.php#477    a minute ago
Error    PHP    Allowed memory size of 134217728 bytes exhausted (tried to allocate 12288 bytes) at /config/www/nextcloud/lib/private/legacy/image.php#477    7 minutes ago
Error    PHP    Allowed memory size of 134217728 bytes exhausted (tried to allocate 12288 bytes) at /config/www/nextcloud/lib/private/legacy/image.php#477    7 minutes ago
Error    PHP    Allowed memory size of 134217728 bytes exhausted (tried to allocate 12288 bytes) at /config/www/nextcloud/lib/private/legacy/image.php#477    14 minutes ago

 

Any idea why this is happening?

Link to comment

I had the same problem with running the preview generation.

 

PHP is configured with a memory limit of 128MB. I tried bumping this up to 256MB and it's working fine for me now.

 

To change the PHP config, open a shell into the Nextcloud docker and edit the PHP config file

docker exec -it nextcloud bash

nano /etc/php7/php.ini

You're looking for the following section, where you can increase the memory limit.

; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 128M

Then restart the Nextcloud docker to pick up the configuration change.

  • Like 1
Link to comment

Hi,

 

I installed Nextcloud a few days ago and am very happy with it. I have the linuxserver letsencrypt and duckdns dockers for ssl remote access.

 

Unfortunately, i am unable to install any app.

My problem: When i click on "Enable" to enable an app (any app), i get within a fraction of a second the following message: " Error while enabling app".

When clicking "Disable" to disable an app, the button turns to "Disabling app..." but stays like this and nothing actually happens.

 

Log status: Nothing in the Nextcloud, or letsencrypt dockers. Nothing relevant in the web browser console (just a missing font not being downloaded).

 

What i have already tried: I have tried this guys solution : https://help.nextcloud.com/t/error-while-enabling-app/9492

But it didn't work for me (and yes i did restart the docker and even the whole server)

I have seen this and do not have this problem: https://github.com/linuxserver/docker-nextcloud/issues/22

I have searched limetech's, nextcloud's and owncloud's forums for other possible solutions but didn't find anything relevant.

I also accessed the web interface via the local IP, but the problem still persists.

 

I added some lines in config.php, hoping it would help, but it didn't. Here is the version i tried (i erased the private stuff):

 

<?php
$CONFIG = array (
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'datadirectory' => '/data',
  'instanceid' => '',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' =>
  array (
    0 => '',
    1 => '',
    2 => '',
  ),
  'trusted_proxies' =>
  array (
    0 => '',
  ),
  'overwritewebroot' => '/nextcloud',
  'overwrite.cli.url' => '/nextcloud',
  'dbtype' => 'mysql',
  'version' => '12.0.2.0',
  'dbname' => 'nextcloud',
  'dbhost' => '',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_root',
  'dbpassword' => '',
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => '',
  'mail_domain' => 'gmail.com',
  'mail_smtpauth' => 1,
  'mail_smtpsecure' => 'ssl',
  'mail_smtpport' => '465',
  'mail_smtphost' => 'smtp.gmail.com',
  'mail_smtpname' => '',
  'mail_smtppassword' => '',
  'has_internet_connection' => true,
  'appstoreenabled' => true,
  'apps_paths' => array(
        array(
                'path'=> '/config/www/nextcloud/apps',
                'url' => '/apps',
                'writable' => true,
        ),
),
  'appcodechecker' => false,
);

 

I would really appreciate any suggestions as to how i could download nextcloud apps.

 

Thanks a lot to linuxserver.io for the great dockers and your amazing work!

 

Regards,

 

Edited by Lynxphp
Link to comment
1 hour ago, aleary said:
 

I had the same problem with running the preview generation.

 

PHP is configured with a memory limit of 128MB. I tried bumping this up to 256MB and it's working fine for me now.

 

To change the PHP config, open a shell into the Nextcloud docker and edit the PHP config file


docker exec -it nextcloud bash

nano /etc/php7/php.ini

You're looking for the following section, where you can increase the memory limit.


; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 128M

Then restart the Nextcloud docker to pick up the configuration change.

 

 

This fixed the issue and I think I am good to go now.  Thank you both for all the help!  

Link to comment
On 13/09/2017 at 6:10 PM, Lynxphp said:

Hi,

 

I installed Nextcloud a few days ago and am very happy with it. I have the linuxserver letsencrypt and duckdns dockers for ssl remote access.

 

Unfortunately, i am unable to install any app.

My problem: When i click on "Enable" to enable an app (any app), i get within a fraction of a second the following message: " Error while enabling app".

When clicking "Disable" to disable an app, the button turns to "Disabling app..." but stays like this and nothing actually happens.

 

Log status: Nothing in the Nextcloud, or letsencrypt dockers. Nothing relevant in the web browser console (just a missing font not being downloaded).

 

What i have already tried: I have tried this guys solution : https://help.nextcloud.com/t/error-while-enabling-app/9492

But it didn't work for me (and yes i did restart the docker and even the whole server)

I have seen this and do not have this problem: https://github.com/linuxserver/docker-nextcloud/issues/22

I have searched limetech's, nextcloud's and owncloud's forums for other possible solutions but didn't find anything relevant.

I also accessed the web interface via the local IP, but the problem still persists.

 

I added some lines in config.php, hoping it would help, but it didn't. Here is the version i tried (i erased the private stuff):

 


<?php
$CONFIG = array (
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'datadirectory' => '/data',
  'instanceid' => '',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' =>
  array (
    0 => '',
    1 => '',
    2 => '',
  ),
  'trusted_proxies' =>
  array (
    0 => '',
  ),
  'overwritewebroot' => '/nextcloud',
  'overwrite.cli.url' => '/nextcloud',
  'dbtype' => 'mysql',
  'version' => '12.0.2.0',
  'dbname' => 'nextcloud',
  'dbhost' => '',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_root',
  'dbpassword' => '',
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => '',
  'mail_domain' => 'gmail.com',
  'mail_smtpauth' => 1,
  'mail_smtpsecure' => 'ssl',
  'mail_smtpport' => '465',
  'mail_smtphost' => 'smtp.gmail.com',
  'mail_smtpname' => '',
  'mail_smtppassword' => '',
  'has_internet_connection' => true,
  'appstoreenabled' => true,
  'apps_paths' => array(
        array(
                'path'=> '/config/www/nextcloud/apps',
                'url' => '/apps',
                'writable' => true,
        ),
),
  'appcodechecker' => false,
);

 

I would really appreciate any suggestions as to how i could download nextcloud apps.

 

Thanks a lot to linuxserver.io for the great dockers and your amazing work!

 

Regards,

 

 

You shouldn't need to add anything to config.php to get apps to install...

Link to comment
21 hours ago, CHBMB said:

 

You shouldn't need to add anything to config.php to get apps to install...

 

That's what i thought as well..

 

I also posted on nextclouds support forum. If I get an answer there i'll report back here (and vice versa).

 

Could it have with unraid permissions to do?

Edited by Lynxphp
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.