# Write errors for nfs mount

**URL:** <https://help.nextcloud.com/t/write-errors-for-nfs-mount/23328>\
**Category:** ℹ️ Support\
**Tags:** synology\
**Created:** [November 9, 2017, 4:10am UTC](https://help.nextcloud.com/t/write-errors-for-nfs-mount/23328 "2017-11-09T04:10:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xarin](https://help.nextcloud.com/letter_avatar/xarin/32/6_449c533f586939b6e5f246632a46421f.png) [@Xarin](https://help.nextcloud.com/u/Xarin)\
**Post date:** [November 9, 2017, 4:10am UTC](https://help.nextcloud.com/t/write-errors-for-nfs-mount/23328/1 "2017-11-09T04:10:30Z")

</div>

I can’t seem to get nextcloud to see that its data directory is indeed writable by the http user.

```
[root@lin-virt02 nextcloud]# sudo -u http ls -alh data
total 436K
drwxrwxrwx 1 http http 188 Nov 9 04:00 .
drwxr-x--- 16 http http 4.0K Nov 9 03:54 ..
drwxr-x--- 1 http http 76 Sep 30 02:03 admin
drwxr-x--- 1 http http 146 Sep 27 19:19 appdata_ocb0vuuo4fin
drwxr-x--- 1 http http 26 Oct 25 19:14 files_external
-rw-r--r-- 1 http http 324 Sep 27 17:43 .htaccess
-rw-r----- 1 http http 0 Sep 27 17:43 index.html
-rw-r----- 1 http http 428K Nov 7 15:23 nextcloud.log
-rw-r----- 1 http http 0 Sep 27 17:43 .ocdata

[root@lin-virt02 nextcloud]# sudo -u http touch data/test

[root@lin-virt02 nextcloud]# sudo -u http ls -alh data
total 436K
drwxrwxrwx 1 http http 196 Nov 9 04:00 .
drwxr-x--- 16 http http 4.0K Nov 9 03:54 ..
drwxr-x--- 1 http http 76 Sep 30 02:03 admin
drwxr-x--- 1 http http 146 Sep 27 19:19 appdata_ocb0vuuo4fin
drwxr-x--- 1 http http 26 Oct 25 19:14 files_external
-rw-r--r-- 1 http http 324 Sep 27 17:43 .htaccess
-rw-r----- 1 http http 0 Sep 27 17:43 index.html
-rw-r----- 1 http http 428K Nov 7 15:23 nextcloud.log
-rw-r----- 1 http http 0 Sep 27 17:43 .ocdata
-rw-r--r-- 1 http http 0 Nov 9 04:00 test

[root@lin-virt02 nextcloud]# sudo -u http php occ files:scan admin
Your data directory is not writable
Permissions can usually be fixed by giving the webserver write access to the root directory. See https://docs.nextcloud.com/server/12/go.php?to=admin-dir_permissions.

An unhandled exception has been thrown:
Exception: Environment not properly prepared. in /usr/share/webapps/nextcloud/lib/private/Console/Application.php:145
Stack trace:
#0 /usr/share/webapps/nextcloud/console.php(99): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 /usr/share/webapps/nextcloud/occ(11): require_once('/usr/share/weba...')

```

fstab:  
synology\_url:/volume1/Nextcloud /usr/share/webapps/nextcloud/data nfs rsize=8192,wsize=8192,\_netdev,noauto,x-systemd.automount 0 0

Any help would be appreciated!

---

<div class="post-metadata">

**Author:** ![Xarin](https://help.nextcloud.com/letter_avatar/xarin/32/6_449c533f586939b6e5f246632a46421f.png) [@Xarin](https://help.nextcloud.com/u/Xarin)\
**Post date:** [November 9, 2017, 6:26pm UTC](https://help.nextcloud.com/t/write-errors-for-nfs-mount/23328/2 "2017-11-09T18:26:57Z")

</div>

For anyone else having this error its a bug with there filesystem checks.

You can fix this by commenting out

/usr/share/webapps/nextcloud/lib/private/legacy/util.php

```
# } else if (!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) {
# //common hint for all file permissions error messages
# $permissionsHint = $l->t('Permissions can usually be fixed by giving the webserver write access to the root directory. See %s.',
# [$urlGenerator->linkToDocs('admin-dir_permissions')]);
# $errors[] = [
# 'error' => 'Your data directory is not writable',
# 'hint' => $permissionsHint
# ];

```

/usr/share/webapps/nextcloud/lib/private/Console/Application.php

```
# if ($input->getFirstArgument() !== 'check') {
# $errors = \OC_Util::checkServer(\OC::$server->getSystemConfig());
# if (!empty($errors)) {
# foreach ($errors as $error) {
# $output->writeln((string)$error['error']);
# $output->writeln((string)$error['hint']);
# $output->writeln('');
# }
# throw new \Exception("Environment not properly prepared.");
# }
# }

```

Nextcloud is running on an arch lamp stack php version 7

---

<div class="post-metadata">

**Author:** ![voidpointer](https://help.nextcloud.com/user_avatar/help.nextcloud.com/voidpointer/32/11829_2.png) [@voidpointer](https://help.nextcloud.com/u/voidpointer)\
**Post date:** [December 18, 2018, 11:02pm UTC](https://help.nextcloud.com/t/write-errors-for-nfs-mount/23328/3 "2018-12-18T23:02:33Z")

</div>

I can verify that @Xarin’s solution works on Nextcloud 15. Sad that this issue is still not resolved…

---

<div class="post-metadata">

**Author:** ![cgmastertecnology](https://help.nextcloud.com/user_avatar/help.nextcloud.com/cgmastertecnology/32/32405_2.png) [@cgmastertecnology](https://help.nextcloud.com/u/cgmastertecnology)\
**Post date:** [April 3, 2022, 2:19pm UTC](https://help.nextcloud.com/t/write-errors-for-nfs-mount/23328/4 "2022-04-03T14:19:31Z")

</div>

> [@Xarin](#):
>
> /usr/share/webapps/nextcloud/lib/private/Console/Application.php
> 
> ```auto
> 
> ```

still not solved…getting crazy with NFS /data mount because of no write/read permission on folder

I # following files:

/usr/src/nextcloud/lib/private/legacy/OC\_Util.php  
/var/www/html/lib/private/legacy/OC\_Util.php

lines:  
“Check if there is a writable install folder.” and "Check if config folder is writable.

---

<div class="post-metadata">

**Author:** ![EgonHeuson](https://help.nextcloud.com/user_avatar/help.nextcloud.com/egonheuson/32/22886_2.png) [@EgonHeuson](https://help.nextcloud.com/u/EgonHeuson)\
**Post date:** [July 27, 2022, 1:47am UTC](https://help.nextcloud.com/t/write-errors-for-nfs-mount/23328/5 "2022-07-27T01:47:59Z")

</div>

Is it ok now? Where can I find this “/usr/share/webapps/nextcloud/lib/private/legacy/util.php” file? Does it work with Docker-based install? I try to install a Nextcloud AIO instance but cannot make it working even though my www-data user can perfectly write in the /mnt/ncdata folder…

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 2, 2024, 3:21pm UTC](https://help.nextcloud.com/t/write-errors-for-nfs-mount/23328/6 "2024-12-02T15:21:39Z")

</div>


