Nextcloud config directory not writed

“config” 디렉터리에 기록할 수 없습니다!

This can usually be fixed by giving the web server write access to the config directory. But, if you prefer to keep config.php file read only, set the option “config_is_read_only” to true in it. Configuration Parameters — Nextcloud latest Administration Manual latest documentation

My cloud server runs on VMWare. Since this server was recently restarted, nextcloud crashes and prints the following error message:

total 180
drwxr-xr-x 15 www-data www-data  4096 11월 20 10:55 .
drwxr-xr-x  4 root     root      4096 11월 20 10:24 ..
drwxr-xr-x 47 www-data www-data  4096 11월  3 20:17 3rdparty
drwxr-xr-x 50 www-data www-data  4096 11월  3 20:16 apps
-rw-r--r--  1 www-data www-data 19327 11월  3 20:14 AUTHORS
drwxr-x--x  2 www-data www-data  4096 11월 24 11:18 config
-rw-r--r--  1 www-data www-data  4095 11월  3 20:14 console.php
-rw-r--r--  1 www-data www-data 34520 11월  3 20:14 COPYING
drwxr-xr-x 23 www-data www-data  4096 11월  3 20:17 core
-rw-r--r--  1 www-data www-data  6317 11월  3 20:14 cron.php
drwxrwx---  5 www-data www-data  4096 11월 20 10:56 data
drwxr-xr-x  2 www-data www-data 12288 11월  3 20:14 dist
-rw-r--r--  1 www-data www-data  3345 11월 20 10:56 .htaccess
-rw-r--r--  1 www-data www-data   156 11월  3 20:14 index.html
-rw-r--r--  1 www-data www-data  3456 11월  3 20:14 index.php
drwxr-xr-x  6 www-data www-data  4096 11월  3 20:14 lib
-rw-r--r--  1 www-data www-data   283 11월  3 20:14 occ
drwxr-xr-x  2 www-data www-data  4096 11월  3 20:14 ocm-provider
drwxr-xr-x  2 www-data www-data  4096 11월  3 20:14 ocs
drwxr-xr-x  2 www-data www-data  4096 11월  3 20:14 ocs-provider
-rw-r--r--  1 www-data www-data  3139 11월  3 20:14 public.php
-rw-r--r--  1 www-data www-data  5549 11월  3 20:14 remote.php
drwxr-xr-x  4 www-data www-data  4096 11월  3 20:14 resources
-rw-r--r--  1 www-data www-data    26 11월  3 20:14 robots.txt
-rw-r--r--  1 www-data www-data  2452 11월  3 20:14 status.php
drwxr-xr-x  3 www-data www-data  4096 11월  3 20:14 themes
drwxr-xr-x  2 www-data www-data  4096 11월  3 20:16 updater
-rw-r--r--  1 www-data www-data   101 11월  3 20:14 .user.ini
-rw-r--r--  1 www-data www-data   382 11월  3 20:17 version.php

The permissions seem to be set correctly, but I don’t know what’s wrong.
can you help me?

After changing the permissions of the config folder to 744 I get the following error:

*** Configuration was not read or initialized correctly, not overwriting /var/www/nextcloud/config/config.php**

Permissions should be 750 on folders and 640 on files, all owned by www-data:www-data.

I think all folders and files have permissions set to 750 and 644 respectively, and the owner is also set to www-data .

No manual permission edits have been made since installing Nextcloud.

However, since I modified the permissions of the config folder a while ago, the same error occurs even after resetting the permissions of the modified config folder and config/* files.

I don’t know what your config file permissions are. Can you show it? 640 isn’t what’s in the above listing.

This is what’s in the documentation for permissions:

chown -R www-data:www-data nextcloud
find nextcloud/ -type d -exec chmod 750 {} ;
find nextcloud/ -type f -exec chmod 640 {} ;

The files are not supposed to be world readable. I don’t know if that would cause the above error.

root@cloud:/var/www/nextcloud# find /var/www/nextcloud/ -type d -exec chmod 750 {} \;
root@cloud:/var/www/nextcloud# find /var/www/nextcloud/ -type f -exec chmod 640 {} \;

I reset the permission problem as you told me, but the same error message I attached in the body occurs.

Any ideas why this doesn’t work even though I’ve set owner, folder and file permissions?

total 180
drwxr-x--- 15 www-data www-data  4096 11월 20 10:55 .
drwxr-xr-x  4 root     root      4096 11월 20 10:24 ..
drwxr-x--- 47 www-data www-data  4096 11월  3 20:17 3rdparty
drwxr-x--- 50 www-data www-data  4096 11월  3 20:16 apps
-rw-r-----  1 www-data www-data 19327 11월  3 20:14 AUTHORS
drwxr-x---  2 www-data www-data  4096 11월 24 11:18 config
-rw-r-----  1 www-data www-data  4095 11월  3 20:14 console.php
-rw-r-----  1 www-data www-data 34520 11월  3 20:14 COPYING
drwxr-x--- 23 www-data www-data  4096 11월  3 20:17 core
-rw-r-----  1 www-data www-data  6317 11월  3 20:14 cron.php
drwxr-x---  5 www-data www-data  4096 11월 20 10:56 data
drwxr-x---  2 www-data www-data 12288 11월  3 20:14 dist
-rw-r-----  1 www-data www-data  3345 11월 20 10:56 .htaccess
-rw-r-----  1 www-data www-data   156 11월  3 20:14 index.html
-rw-r-----  1 www-data www-data  3456 11월  3 20:14 index.php
drwxr-x---  6 www-data www-data  4096 11월  3 20:14 lib
-rw-r-----  1 www-data www-data   283 11월  3 20:14 occ
drwxr-x---  2 www-data www-data  4096 11월  3 20:14 ocm-provider
drwxr-x---  2 www-data www-data  4096 11월  3 20:14 ocs
drwxr-x---  2 www-data www-data  4096 11월  3 20:14 ocs-provider
-rw-r-----  1 www-data www-data  3139 11월  3 20:14 public.php
-rw-r-----  1 www-data www-data  5549 11월  3 20:14 remote.php
drwxr-x---  4 www-data www-data  4096 11월  3 20:14 resources
-rw-r-----  1 www-data www-data    26 11월  3 20:14 robots.txt
-rw-r-----  1 www-data www-data  2452 11월  3 20:14 status.php
drwxr-x---  3 www-data www-data  4096 11월  3 20:14 themes
drwxr-x---  2 www-data www-data  4096 11월  3 20:16 updater
-rw-r-----  1 www-data www-data   101 11월  3 20:14 .user.ini
-rw-r-----  1 www-data www-data   382 11월  3 20:17 version.php

Please post the permissions of inside the config folder since that’s what the error is referring to.

Have you made any changes to .htaccess in any folder?

Also, I have to ask just to be sure… the disk is not full or mounted read only?

No, that’s not what you said.

I didn’t change .htaccess and disk capacity and mounts seem to be fine.

I am attaching the permissions of the files in the config folder, the disk capacity, and the mount disk information.

root@cloud:/var/www/nextcloud/config# ls -al
total 88
drwxr-x---  2 www-data www-data  4096 11월 24 11:18 .
drwxr-x--- 15 www-data www-data  4096 11월 20 10:55 ..
-rw-r-----  1 www-data www-data   601 11월 24 11:06 config.php
-rw-r-----  1 www-data www-data 72739 11월  3 20:14 config.sample.php
-rw-r-----  1 www-data www-data   495 11월  3 20:14 .htaccess

root@cloud:/var/www/nextcloud/config# df -h
Filesystem Size Used Avail Use% Mounted on
tmpfs 792M 2.0M 790M 1% /run
/dev/sda3 2.0T 188G 1.7T 11% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
/dev/sda2 512M 5.3M 507M 2% /boot/efi
tmpfs 792M 2.4M 790M 1% /run/user/1000
/dev/sr0 3.6G 3.6G 0 100% /media/dhjeong/Ubuntu 22.04.1 LTS amd64
root@cloud:/var/www/nextcloud/config#


/dev/sda3 on / type ext4 (rw,relatime,errors=remount-ro)


If there was a special reason, my server was forced to shut down due to a problem with the power supply.

Since then I am getting that error.

Can you do this?

sudo -u www-data touch /var/www/nextcloud/config/config.php

One of your partition is mounted as read only. Your disk may be dying, check your disk with smartctl to detect bad blocks. Don’t worry, this is the worst case scenario. If your disk is fine, just try to umount and repair it (with fsck) and then remount it (or reboot your server).

Read the log of the kernel (with dmesg) to have more information about this failed mount.

That’s a bit of a leap. Where do you see his disk mounted ro? It says rw right there.

Please post output of: mount

youre right, I read too fast sorry