[Support] Linuxserver.io - Nextcloud


5008 posts in this topic Last Reply

Recommended Posts

  • Replies 5k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Application Name: Nextcloud Application Site: https://nextcloud.com/ Docker Hub: https://hub.docker.com/r/linuxserver/nextcloud/ Github: https://github.com/linuxserver/docker-nextcl

Here's my list of instructions....    Use them at your own risk.....   If upgrading to v12 please see here:   ##Turn on maintenance mode docker exec -it nextcloud occ m

I replaced these lines in the '/mnt/cache/appdata/nextcloud/nginx/site-confs/default' file. (Adjust path to your appdata path, if it's different)   location = /.well-known/carddav { return

Posted Images

Hello. 
Nextcloud write the nextcloud.log in my data share. So the hard drive won't spin down. 
Is there a way to move the log file into the app data folder of nextcloud on the cache drive? 
Yes there is.

Open the command line for the nextcloud container and type this.


sudo touch /var/log/nextcloud.log
sudo chown abc /var/log/nextcloud.log

Move the nextcloud.log from Share to var/logs

www-data probably has not enough permissions to create the file itself.


From


Log configuration


Parameters
Logging levels range from DEBUG, which logs all activity, to FATAL, which logs only fatal errors.
• 0: DEBUG: All activity; the most detailed logging.
• 1: INFO: Activity such as user logins and file activities, plus warnings, errors, and fatal errors.
• 2: WARN: Operations succeed, but with warnings of potential problems, plus errors and fatal errors.
• 3: ERROR: An operation fails, but other services and operations continue, plus fatal errors.
• 4: FATAL: The server stops.

From


Sent from my Pixel 2 XL using Tapatalk

Link to post
Yes there is.

Open the command line for the nextcloud container and type this.


sudo touch /var/log/nextcloud.log
sudo chown abc /var/log/nextcloud.log

Move the nextcloud.log from Share to var/logs

www-data probably has not enough permissions to create the file itself.


From


Log configuration


Parameters
Logging levels range from DEBUG, which logs all activity, to FATAL, which logs only fatal errors.
• 0: DEBUG: All activity; the most detailed logging.
• 1: INFO: Activity such as user logins and file activities, plus warnings, errors, and fatal errors.
• 2: WARN: Operations succeed, but with warnings of potential problems, plus errors and fatal errors.
• 3: ERROR: An operation fails, but other services and operations continue, plus fatal errors.
• 4: FATAL: The server stops.

From


Sent from my Pixel 2 XL using Tapatalk

The link from nextcloud is
https://help.nextcloud.com/t/nextcloud-logfile-not-in-var-log-nextcloud-log/2986

Sent from my Pixel 2 XL using Tapatalk

Link to post

First of all, I have no idea how to use the console. Something I'm doing wrong. If I delete / move the file from the share, it will be recreated immediately. 

 

root@Unraid:~# sudo touch /var/log/nextcloud.log
root@Unraid:~# sudo chown abc /var/log/nextcloud.log
chown: invalid user: ‘abc’
root@Unraid:~#

 

Edited by OOmatrixOO
Link to post
First of all, I have no idea how to use the console. Something I'm doing wrong. If I delete / move the file from the share, it will be recreated immediately. 
 
root@Unraid:~# sudo touch /var/log/nextcloud.logroot@Unraid:~# sudo chown abc /var/log/nextcloud.logchown: invalid user: ‘abc’root@Unraid:~#

 

You have to use the console of the docker. Not the one from the unraid system. Did you you the dockers are kind of like their own computer?

Go to the docker, right click the nextcloud container.
There you do the command.

So according to nextcloud forums and knowledge base and I'll explain.

All you are really doing is creating an empty file with the command "touch"

The command "chown" is to assign attributes for permissions. This is to give permission to the user, in this case "abc" which is the user nextcloud uses to run.

The command "sudo" is to run the command with elevated permissions.

And for the config file you can change the log level if you want. I had my log in 0 for debug mode, which was giving me too much information, which then I changed to level 1 for information, errors and warnings. I did this because my log was too big.

Also, the var location you won't see it in appdata because it's inside the docker.

You are not really moving the log file. Nextcloud by default saves in that location, unless it doesn't have permissions to do it and it will create the file somewhere else.

So now you know.

sudo touch /var/log/nextcloud.log
sudo chown abc /var/log/nextcloud.log

Please feel free to correct me if I'm wrong.



Sent from my Pixel 2 XL using Tapatalk

Link to post
1 hour ago, OOmatrixOO said:

Ok now i understand what's going on. Thanks. 

So i have to change abc to my user and then it should be working. Will try it. 

The only thing I'd caution against that approach is a location inside the container is on your docker.img so a session of error log spamming will fill up your docker image.  I'd suggest moving it to somewhere in /config so at least it's on your cache disk.

Link to post

Got stuck in maintenance mode after updating.

 

Have tried enter command line mode from nextcloud docker menu and enter the following:

sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off

 

doesnt work.

 

Get that user www-data is unknown

 

Please help.

Link to post
9 minutes ago, mrvilla said:

Got stuck in maintenance mode after updating.

 

Have tried enter command line mode from nextcloud docker menu and enter the following:

sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off

 

doesnt work.

 

Get that user www-data is unknown

 

Please help.

 

There is no www-data user. Use abc.

Link to post
12 hours ago, gacpac said:

You have to use the console of the docker. Not the one from the unraid system. Did you you the dockers are kind of like their own computer?

Go to the docker, right click the nextcloud container.
There you do the command.

So according to nextcloud forums and knowledge base and I'll explain.

All you are really doing is creating an empty file with the command "touch"

The command "chown" is to assign attributes for permissions. This is to give permission to the user, in this case "abc" which is the user nextcloud uses to run.

The command "sudo" is to run the command with elevated permissions.

And for the config file you can change the log level if you want. I had my log in 0 for debug mode, which was giving me too much information, which then I changed to level 1 for information, errors and warnings. I did this because my log was too big.

Also, the var location you won't see it in appdata because it's inside the docker.

You are not really moving the log file. Nextcloud by default saves in that location, unless it doesn't have permissions to do it and it will create the file somewhere else.

So now you know.

sudo touch /var/log/nextcloud.log
sudo chown abc /var/log/nextcloud.log

Please feel free to correct me if I'm wrong.



Sent from my Pixel 2 XL using Tapatalk
 

Somehow this does not work. I have no plan anymore. If I use the console of Docker comes the error message:

 

root@567f1e60d30e:/# sudo touch /var/log/nextcloud.log
sudo: error in /etc/sudo.conf, line 0 while loading plugin "sudoers_policy"
sudo: /usr/lib/sudo/sudoers.so must be only be writable by owner
sudo: fatal error, unable to load plugins

Link to post
1 hour ago, CHBMB said:

The only thing I'd caution against that approach is a location inside the container is on your docker.img so a session of error log spamming will fill up your docker image.  I'd suggest moving it to somewhere in /config so at least it's on your cache disk.

How can i do this?

Link to post
42 minutes ago, OOmatrixOO said:

How can i do this?

OK, I've reviewed your posts, by default nextcloud logs to the appdata share on your cache disk. (/config/nextcloud.log)

 

Which if your appdata is setup correctly shouldn't be on your array, but on your cache disk.

 

So, lets start from first principles, is your nextcloud appdata definitely on your cache disk?  As you seem to believe it is on the array.

 

Can you paste the output of

 

ls -la /mnt/cache/appdata/nextcloud

 

and

 

ls -la /mnt/user0/appdata/nextcloud

 

Link to post

Thanks.

Yes the appdata should be definitely on my cache disk.

 

 

root@Unraid:~# ls -la /mnt/cache/appdata/nextcloud
total 4
drwxrwxrwx 1 nobody users   56 Feb 26 11:47 ./
drwxrwxrwx 1 nobody users  220 May 24 23:09 ../
drwxrwxrwx 1 nobody users   20 Jan 18 22:43 .cache/
-rw-rw-rw- 1 nobody users 1024 May 25 11:48 .rnd
drwxrwxrwx 1 nobody users   32 Jan 18 22:33 keys/
drwxrwxrwx 1 nobody users   16 May 25 11:41 log/
drwxrwxrwx 1 nobody users   40 Jan 18 22:33 nginx/
drwxrwxrwx 1 nobody users   44 Jan 18 22:33 php/
drwxrwxrwx 1 nobody users   38 Jan 18 22:33 www/

 

root@Unraid:~# ls -la /mnt/user0/appdata/nextcloud
total 0
drwxrwxrwx 1 nobody users  6 Feb 26 11:47 ./
drwxrwxrwx 1 nobody users 18 May 18 13:21 ../
drwxrwxrwx 1 nobody users  0 May 24 22:39 log/

 

Link to post
5 hours ago, CHBMB said:

The only thing I'd caution against that approach is a location inside the container is on your docker.img so a session of error log spamming will fill up your docker image.  I'd suggest moving it to somewhere in /config so at least it's on your cache disk.

Thanks for the assist. I've been doing a lot of reading now that you say this. 

@OOmatrixOO I think I found a simpler solution for you.

 

First, turn off your docker just in case. 

Go to your config.php and look for a setting 'logfile' => '/var/log/nextcloud.log', 

Change that to the location you want, like @CHBMBsaid '/config/log/nextcloud/nextcloud.log'  what I did now was. I manually created the location and the nextcloud.log

 

image.png.32978058ec2013d4f3af18f1893caf62.png

 

You can add more settings, I followed the instructions in the config.sample.php located in the config folder. I'll upload them so you can have a look. 

 

At the end my configuration look like this. The explanation is in the sample.php that I've attached. And no command line needed. Test and let us know

 

  'logfile' => '/config/log/nextcloud/nextcloud.log'

  'logfile' => '/config/log/nextcloud/nextcloud.log',
  'log_type' => 'file',
  'logtimezone' => 'America/New_York',
  'logdateformat' => 'F d, Y H:i:s',
  'log_rotate_size' => 100 * 1024 * 1024,
  'logfilemode' => 0660,
  'loglevel' => 0,

 

FYI: I'm using the logfilemode 0660 because there that was a recommendation in the github of nextcloud.

https://github.com/nextcloud/server/pull/8282

config.sample.php

Edited by gacpac
missed a letter
Link to post
1 hour ago, OOmatrixOO said:

Thanks.

Yes the appdata should be definitely on my cache disk.

 

 


root@Unraid:~# ls -la /mnt/cache/appdata/nextcloud
total 4
drwxrwxrwx 1 nobody users   56 Feb 26 11:47 ./
drwxrwxrwx 1 nobody users  220 May 24 23:09 ../
drwxrwxrwx 1 nobody users   20 Jan 18 22:43 .cache/
-rw-rw-rw- 1 nobody users 1024 May 25 11:48 .rnd
drwxrwxrwx 1 nobody users   32 Jan 18 22:33 keys/
drwxrwxrwx 1 nobody users   16 May 25 11:41 log/
drwxrwxrwx 1 nobody users   40 Jan 18 22:33 nginx/
drwxrwxrwx 1 nobody users   44 Jan 18 22:33 php/
drwxrwxrwx 1 nobody users   38 Jan 18 22:33 www/

 


root@Unraid:~# ls -la /mnt/user0/appdata/nextcloud
total 0
drwxrwxrwx 1 nobody users  6 Feb 26 11:47 ./
drwxrwxrwx 1 nobody users 18 May 18 13:21 ../
drwxrwxrwx 1 nobody users  0 May 24 22:39 log/

 

Actually that shows there is part of you log file on the array.

 

rm -rm /mnt/user0/appdata/nextcloud

Will remove it.  Probably need to check your appdata share to ensure it's set to prefer cache disk.

Edited by CHBMB
Link to post
24 minutes ago, gacpac said:

Thanks for the assist. I've been doing a lot of reading now that you say this. 

@OOmatrixOO I think I found a simpler solution for you.

 

First, turn off your docker just in case. 

Go to your config.php and look for a setting 'logfile' => '/var/log/nextcloud.log', 

Change that to the location you want, like @CHBMBsaid '/config/log/nextcloud/nextcloud.log'  what I did now was. I manually created the location and the nextcloud.log

 

image.png.32978058ec2013d4f3af18f1893caf62.png

 

You can add more settings, I followed the instructions in the config.sample.php located in the config folder. I'll upload them so you can have a look. 

 

At the end my configuration look like this. The explanation is in the sample.php that I've attached. And no command line needed. Test and let us know

 

  'logfile' => '/config/log/nextcloud/nextcloud.log'
  'log_type' => 'file',
  'logtimezone' => 'America/New_York',
  'logdateformat' => 'F d, Y H:i:s',
  'log_rotate_size' => 100 * 1024 * 1024,
  'logfilemode' => 0660,
  'loglevel' => 0,

config.sample.php 51.05 kB · 1 download

If i do this i have this issue when i go to the nextcloud login page:

 

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 webserver log.

If i remove 'logfile' => '/config/log/nextcloud/nextcloud.log' i can login to the page.

Link to post
4 minutes ago, OOmatrixOO said:

This is the appdata share:

 

screen_20190525_145458.png

 

And the command does not work for me:


root@Unraid:~# rm -rm /mnt/user0/appdata/nextcloud
rm: invalid option -- 'm'
Try 'rm --help' for more information.

 

Well for whatever reason you DO have the logs directory on your array as /mnt/user0/ is the array minus the cache disk.

 

Apologies, typo in that command

 

rm -rf /mnt/user0/appdata/nextcloud

 

Link to post
4 minutes ago, CHBMB said:

And @OOmatrixOO stop trying to do two fixes synchronously, you'll complicate matters more and you're making changes to things you don't understand.

 

As I said change Use cache disk to prefer.

Ok yes you are right sorry.

I typo in that command and now changed use cache to prefer.

 

 

Link to post
 
 
 
 
 
4
14 minutes ago, OOmatrixOO said:

If i do this i have this issue when i go to the nextcloud login page:

 


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 webserver log.

If i remove 'logfile' => '/config/log/nextcloud/nextcloud.log' i can login to the page.

Sorry I had a brain fart  I missed a ","

 

'logfile' => '/config/log/nextcloud/nextcloud.log',

Link to post
18 minutes ago, OOmatrixOO said:

Ok yes you are right sorry.

I typo in that command and now changed use cache to prefer.

 

 

Right now run these commands:

docker exec -it nextcloud bash
sudo -u abc touch /config/log/nextcloud.log
chmod 777 /config/log/nextcloud.log

 

then edit config.php in /mnt/cache/appdata/nextcloud/www/config/config.php

 

and include these two lines

 

  'loglevel' => 1,
  'logfile' => '/config/log/nextcloud.log',

and restart your container.

 

Now as /config is really /mnt/cache/appdata/nextcloud and remember that

 

/mnt/user/ = array disks and cache disk

and

/mnt/user0 = array disks without cache disk

 

your log file for nextcloud will be in /mnt/user/appdata/nextcloud/log/ and called nextcloud.log

 

Because you had the log directory partially on the array there was every chance that if that was where the nextcloud.log file was it would continue to write to the array even with just the config.php changes.

 

By removing that rogue /mnt/user0/appdata/nextcloud directory and setting use cache disk to prefer it will stop that from happening again

Edited by CHBMB
Link to post
21 minutes ago, CHBMB said:

Right now run these commands:


docker exec -it nextcloud bash
sudo -u abc touch /config/log/nextcloud.log
chmod 777 /config/log/nextcloud.log

 

then edit config.php in /mnt/cache/appdata/nextcloud/www/config/config.php

 

and include these two lines

 


  'loglevel' => 1,
  'logfile' => '/config/log/nextcloud.log',

and restart your container.

Oh man, I am slowly despairing. I'm certainly doing something wrong. 😞

 

Now i have this: 

root@Unraid:~# docker exec -it nextcloud bash
Error: No such container: nextcloud
root@Unraid:~#

Link to post

What is your nextcloud container called?

By default it's nextcloud

Linux is case sensitive so have you changed anything to caps or renamed it in any way?

Sent from my Mi A1 using Tapatalk

Link to post

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.