NS records and permission related problem with NextCloud

Hello,

This is my installation details:
NextCloud version: 19.0.2
OS: Ubuntu 20.04.1
Control Panel: Hestia CP v1.2.3
Apache version: 2.4.46
PHP version: 7.4.9

I have NextCloud installed on one of the users accounts. It’s working fine but I have a repeated error on the logs.

[PHP] Error: Unknown: send of 5 bytes failed with errno=32 Broken pipe at Unknown#0

GET /index.php/apps/logreader/poll?lastReqId=wDtYp3jHf3vK4ARTlfYQ
from XX.XXX.XXX.XX by USERNAME at 2020-09-03T14:46:12+00:00

The Apache error log is showing this error.

[Thu Sep 03 14:21:42.381748 2020] [core:crit] [pid 75465:tid 140601282504448] (13)Permission denied: [client XX.XXX.XXX.XX:0] AH00529: /home/XXXXX/web/XXXXX.com/public_html/data/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that ‘/home/XXXXX/web/XXXXX.com/public_html/data/’ is executable

Please note that I have all files and folders under user account and permissions seems in order.


I have noticed that on “ServerInfo” the domain name is the (Admin Domain) that I am using for the NS records for all users account not the user domain that I am using for NextCloud and also NextCloud is not able to get server info because its requires admin access!

This is the error that NextCloud log is showing when I open the Serverinfo page.

[PHP] Error: Invalid argument supplied for foreach() at /home/XXXXXX/web/XXXXXX.com/public_html/apps/serverinfo/lib/OperatingSystems/DefaultOs.php#164

GET /index.php/settings/admin/serverinfo
from XX.XXX.XXX.XX by XXXXX at 2020-09-03T14:38:38+00:00

I tried to fix the problem by changing the the NS records. I was able to change the “SOA” and “Default Name Servers” from admin account to (NS1.userdomain.com) but I couldn’t add the NS records of userdomain to the list of DNS records. This is the error I am getting.

Error: IN A ns1.userdomain.com does not exist

Can you please help me fix this problem.

1 Like

Hello,

I just want to add that I installed NextCloud v19.0.1.1 via the Web Installer and I used the “root” to copy the (setup-nextcloud.php) to the user directory. Then I accessed the setup page via the browser.

Does copying the setup file by “root” to the user directory is the cause of this error and how can I fix this issue?

Thank you for your support.

1 Like

Permission should always be user:user (inside the public_html directory).

1 Like

Hello

Thank you for your support.

I have everything inside the public_html directory set to user:user permission.

I have also “.htaccess” set to “644” and “/data” set to “770” but I am still getting this error on the log.

[Fri Sep 04 04:00:11.972786 2020] [core:crit] [pid 56760:tid 139952776013568] (13)Permission denied: [client 39.101.67.145:0] AH00529: /home/XXXXX/web/XXXXX.com/public_html/data/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that ‘/home/XXXXX/web/XXXXX.com/public_html/data/’ is executable
[Fri Sep 04 13:36:53.535483 2020] [core:crit] [pid 215422:tid 139953681979136] (13)Permission denied: [client 37.106.99.125:0] AH00529: /home/XXXXX/web/XXXXX.com/public_html/data/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that ‘/home/XXXXX/web/XXXXX.com/public_html/data/’ is executable

I tried to run this script.sh to fix any permission related problems.

This is result.

[email protected]:~# chmod +x /home/XXXXX/web/XXXXX.com/public_html/script.sh
[email protected]:~# /home/XXXXX/web/XXXXX.com/public_html/script.sh
Creating possible missing Directories
chmod Files and Directories
chmod: missing operand after ‘0640’
Try ‘chmod --help’ for more information.
chown Directories
chown: cannot access ‘/var/www/nextcloud/apps/’: No such file or directory
chown: cannot access ‘/var/www/nextcloud/config/’: No such file or directory
chown: cannot access ‘/var/www/nextcloud/themes/’: No such file or directory
chmod: cannot access ‘/var/www/nextcloud/occ’: No such file or directory
chmod/chown .htaccess

The script is in nextcloud docs.
https://docs.nextcloud.com/server/9.0/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions

After that I checked “/etc/apache2/sites-enabled” I didn’t find any of my sites!

I checked it because I found (‘overwrite.cli.url’ => ‘’,) on the “config.php”

Can you please help me find an end to this error.

Regards,
Nasser

There seems to be something wrong with your nextcloud setup, i don’t think this path here is right.

1 Like

Hello ScIT,

I appreciate your support.

I already changed the “ncpath” on the script.sh. Can you kindly check it just to make sure.

I really don’t know why it’s still getting the default path
https://docs.nextcloud.com/server/9.0/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions

I think I will delete the user account and install nextcloud again. do you think it’s the right call?

  1. saudinm=‘www-data’
  2. saudinm=‘www-data’
  3. rootuser=‘root’

Owner of the files should be
“user:user”

not www-data:www-data

1 Like

Hello eris,

I edited the script as you said and its run correctly

[email protected]:~# chmod +x /home/saudinm/web/xxxxx.com/public_html/script.sh
[email protected]:~# /home/saudinm/web/xxxx.com/public_html/script.sh
Creating possible missing Directories
chmod Files and Directories
chown Directories
chmod/chown .htaccess

I am getting this message!

I was confident with the daily system backup thinking that I can use it whenever needed but the backup wiped the whole /public_html directory

Please note that the NextCloud is installed few weeks ago!

Why you dont just use the tar source code and place it inside public_html? According to https://docs.nextcloud.com/server/latest/admin_manual/installation/source_installation.html this should be the way to go and should work out of the box.

2 Likes

That’s wrong and the reason why apache complains about the non readable htaccess. It should be 755 as with all other directories.

Ps: everything you did afterwards probably messed it up even more.
Nextcloud works extracted from the regular archive oob. just make sure owner and group are correct nothing else. I run it myself, so I know for sure it works without custom templates :wink:

1 Like

Hello,

I appreciate your support guys.

Yesterday was a busy day for me. The backup failed and I had to delete the “user account” and start again. I followed ScIT advise, by downloading the tar file, then unzip it on to the public_html and making sure all permissions are under user:user. Now everthing is workin like before, I am back to square one.

If I stay on the “log” page this error keeps coming up

[PHP] Error: Unknown: send of 5 bytes failed with errno=32 Broken pipe at Unknown#0

GET /index.php/apps/logreader/poll?lastReqId=DzVpXpURGDTnqhb9XlJA
from XX.XXX.XXX.XX by USER at 2020-09-05T14:39:55+00:00

falzo I don’t think “/data” set to “770” is wrong. When I change the permission to 755 it reverte to 770.

I have disabled the systeminfo app permanently because I couldn’t fix it.

Thanks again

1 Like

yes, I stand corrected. just checked and indeed the data folder is set to 770 automatically. however it works just fine here, so something else seems wrong. I don’t use the systeminfo stuff though.

Hello,

I appreciate your support.

I have cleared the “nextcloud.log” then tried to view the files. After that this error showed up on the log .

I am using “Guests app” . I think its related to this error but I am not sure of that.

I will try to run “nextcloud” on other platforms and keep you guys updated.

Best regards,
Nasser

no idea about these apps and what they are doing. however from the log this is the only interesting entry:

MySQL server has gone away

it essentially means you are hitting a timeout or something like that. as we don’t know how large your tables already are in terms of number of files and whatnot, and which other extension, apps and plugins you might run, it could be a lot here from simply overloading the server up to just the need of fine tuning your mysql settings.

remember that everything hestia sets as defaults might not be a good fit for every occasion. so you probably want to look into the nginx/apache/php-fpm logs as weel to see, which part is timing out and why or the other way around - what is taking how long and why…

also, do you use memcached/redis etc.? maybe also check if that is configured and running correctly…

1 Like

About the MySQL Server has gone away message… Here is an excerpt from my notes about what corrections to do after installing Vesta/Hestia.

# MySQL - Increase MySQL packet size [solves the "MySQL Server gone" error]
sed -ri 's/#?max_allowed_packet\s+.*/max_allowed_packet = 512M/' /etc/mysql/my.cnf

Hello,

Sorry for the delay falzo, I was trying to fix the problem but I couldn’t.

I am still getting this error on the nextcloud.log

MySQL server has gone away

Here is the error in details

it essentially means you are hitting a timeout or something like that. as we don’t know how large your tables already are in terms of number of files and whatnot, and which other extension, apps and plugins you might run, it could be a lot here from simply overloading the server up to just the need of fine tuning your mysql settings.

I have a VPS at DigitalOcean with 2 vCPUs and 4GB / 80GB Disk. I am running 2 Wordpress Websites and NextCloud with less than 1000 visitors a day.

This is my.cnf I only changed.

max_allowed_packet = 512M
wait_timeout=3600

Here are an image that shows the server load over a week.

also, do you use memcached/redis etc.? maybe also check if that is configured and running correctly…

Yes, I have Redis installed and added to the NextCloud config.php file

‘memcache.local’ => ‘\OC\Memcache\APCu’,
‘filelocking.enabled’ => true,
‘memcache.locking’ => ‘\OC\Memcache\Redis’,
‘redis’ =>
array (
‘host’ => ‘localhost’,
‘port’ => 6379,
‘timeout’ => 0.0,
),

I tried to ping the redis-cli and this is the outcome.
03

This is the redis.conf if you want to check it out. I only changed

maxmemory 256mb
maxmemory-policy allkeys-lru

Felix, I tried the fix you suggested. but I am still getting the same error. The error occur when loading a preview of a +300mb PDF document. I moved the large documents to a separate folder to prevent loading the preview.

Should I upgrade the server or is it a configuration issue?

I am monitoring the server via Netdata.

Can you guys help me out

I appreciate your support.

Regards,
Nasser

thanks for the detailed information :+1:

I still think you might run into a timeout and it seems you already spotted the cause.

It can however be difficult to find the exact thing that is timing out, as you will have several limits in different places (nginx, apache, php, redis, mysql). these are there to avoid overloading the server, so they shouldn’t be raised without thinking over it beforehand properly :wink:

even mysql itself knows multiple different time and size limits, so I am afraid I can’t directly tell you what to adjust :confused:

maybe google or stackoverflow can help, however I suggest to also check the redis/nginx/apache/php-fpm logs to see if there are errors matching the timestamp of the mysql problem and see if this somehow could be related.
if the issue lies elsewhere maybe you could also try to bypass redis just for testing and disable all sorts of caching.

I just checked one of my install and that is only using apcu and no redis. I think file.locking should be avoided as well if possible… so all I use is:
'memcache.local' => '\\OC\\Memcache\\APCu',

haven’t touched the mysql settings at all. but I also don’t have a 300MB pdf to check if that’s previewable anyway :wink: :wink: :wink:

sorry to be not much of a help here… but I don’t think your instance needs an upgrade, this should be fixable within the configs though.

[PHP] Error: Unknown: send of 5 bytes failed with errno=32 Broken pipe

Is this from: /var/log/php*.log ?
Also post content of : /home/XXXXX/web/XXXXX.com/public_html/data/.htaccess

Hello,

Thank you for your continuous support.

I think I found something on the php7.4-fpm.log.

[16-Sep-2020 11:01:16] WARNING: [pool NEXTCLOUD.WEBSITE] server reached max_children setting (8), consider raising it

No, Its from nextcloud.log

Parzival, this is the content of .htaccess you requested.

I appreciate your support guys.

Best regards,
Nasser