"Your data directory is not writable" after Ubuntu upgrade

Support intro

Sorry to hear you’re facing problems. :slightly_frowning_face:

The community help forum (help.nextcloud.com) is for home and non-enterprise users. Support is provided by other community members on a best effort / “as available” basis. All of those responding are volunteering their time to help you.

If you’re using Nextcloud in a business/critical setting, paid and SLA-based support services can be accessed via portal.nextcloud.com where Nextcloud engineers can help ensure your business keeps running smoothly.

Getting help

In order to help you as efficiently (and quickly!) as possible, please fill in as much of the below requested information as you can.

Before clicking submit: Please check if your query is already addressed via the following resources:

(Utilizing these existing resources is typically faster. It also helps reduce the load on our generous volunteers while elevating the signal to noise ratio of the forums otherwise arising from the same queries being posted repeatedly).

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can. :heart:

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 35.0.1
  • Operating system and version (e.g., Ubuntu 24.04):
    • Ubuntu 26.04 (upgraded from 24.04)
  • Web server and version (e.g, Apache 2.4.25):
    • Apache/2.4.66
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • none?
  • PHP version (e.g, 8.3):
    • 8.5 (upgraded from 8.3 as part of the Ubuntu update)
  • Is this the first time you’ve seen this error? (Yes / No):
    • yes
  • When did this problem seem to first start?
    • after upgrading to Ubuntu 26.04 from 24.04
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • bare metal
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • no

Summary of the issue you are facing:

After upgrading Ubuntu from 24.04 to 26.04, I get this message trying to access Nextcloud from a browser (Firefox):

Your data directory is not writable.

Permissions can usually be fixed by giving the web server write access to the root directory. See https://docs.nextcloud.com/server/35/go.php?to=admin-dir_permissions.

The link in the error doesn’t work.

I have Nextcloud installed on my OS drive in /var/www/nextcloud, this has permissions:

drwxr-xr-x 15 www-data www-data 4096 Oct  7 20:46 nextcloud/

The data directory is on a separate disk mounted as /home, this has permissions:

drwxr-x---   6 www-data www-data   4096 Oct 14 19:08 nextcloud/

In an attempt to remediate the issue I have run chown recursively on both directories to give ownership to www-data, even though it already appeared to be correct:

sudo chown -R www-data:www-data /var/www/nextcloud
sudo chown -R www-data:www-data ~/nextcloud

If I use the occ command to touch a file in the directory, it fails, but creates the file…:

$ sudo -u www-data php occ files:touch temp -vvv

In Node.php line 153:
                                     
  [OCP\Files\NotPermittedException]  
                                     

Exception trace:
  at /var/www/nextcloud/lib/private/Files/Node/Node.php:153
 OC\Files\Node\Node->touch() at /var/www/nextcloud/apps/files/lib/Command/Touch.php:60
 OCA\Files\Command\Touch->__invoke() at /var/www/nextcloud/lib/private/Console/CommandAdapter.php:279
 OC\Console\CommandAdapter->execute() at /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php:341
 Symfony\Component\Console\Command\Command->run() at /var/www/nextcloud/core/Command/Base.php:222
 OC\Core\Command\Base->run() at /var/www/nextcloud/3rdparty/symfony/console/Application.php:1094
 Symfony\Component\Console\Application->doRunCommand() at /var/www/nextcloud/3rdparty/symfony/console/Application.php:356
 Symfony\Component\Console\Application->doRun() at /var/www/nextcloud/3rdparty/symfony/console/Application.php:195
 Symfony\Component\Console\Application->run() at /var/www/nextcloud/lib/private/Console/Application.php:210
 OC\Console\Application->run() at /var/www/nextcloud/console.php:92
 require_once() at /var/www/nextcloud/occ:15

files:touch [-c|--no-create] [-d|--date DATE] [--] <file>

$ ls -al ~/nextcloud
...
-rw-r--r--  1 www-data www-data       0 Oct 15 12:42 temp
...

Log entries are provided below.

Steps to replicate it (hint: details matter!):

  1. Try to access nextcloud via the browser results in error message and all clients are unable to connect/sync.

Log entries

Nextcloud

Please provide the log entries from your Nextcloud log that are generated during the time of problem (via the Copy raw option from Administration settings->Logging screen or from your nextcloud.log located in your data directory). Feel free to use a pastebin/gist service if necessary.

Repeated entries like this:

{"reqId":"SbKbKTBOwvqezTF1DvUb","level":2,"time":"2026-10-15T19:45:46+00:00","remoteAddr":"<redacted>","user":"--","app":"PHP","method":"GET","url":"/nextcloud/index.php/204","scriptName":"/nextcloud/index.php","message":"fopen(/home/vassago/nextcloud/data_dir_writability_test_6ad12d6a90a0c.tmp): Failed to open stream: Read-only file system at /var/www/nextcloud/lib/private/legacy/OC_Util.php#327","userAgent":"Mozilla/5.0 (Macintosh) mirall/34.0.4 (Nextcloud, macos-27.0.0 ClientArchitecture: arm64 OsArchitecture: arm64)","version":"35.0.1.1","clientReqId":"6297ff1b-490b-4176-9688-8eef69f7100b","data":{"app":"PHP"}}

Web Browser

If the problem is related to the Web interface, open your browser inspector Console and Network tabs while refreshing (reloading) and reproducing the problem. Provide any relevant output/errors here that appear.

N/A

Web server / Reverse Proxy

The output of your Apache/nginx/system log in /var/log/apache2/error.log has repeated entries like:

[Thu Oct 15 11:17:35.839804 2026] [php:warn] [pid 13375:tid 13375] [client 192.168.1.35:63600] PHP Warning:  preg_match(): Allocation of JIT memory failed, PCRE JIT will be disabled. This is likely caused by security restrictions. Either grant PHP permission to allocate executable memory, or set pcre.jit=0 in /var/www/nextcloud/lib/OC.php on line 1338

Configuration

Nextcloud

The output of occ config:list system or similar is best, but, if not possible, the contents of your config.php file from /path/to/nextcloud is fine (make sure to remove any identifiable information!):

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "https:\/\/tardis\/nextcloud",
        "htaccess.RewriteBase": "\/nextcloud",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "tardis"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "35.0.1.1",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "maintenance": false,
        "theme": "",
        "loglevel": 2,
        "logfile": "\/var\/log\/nextcloud.log",
        "default_phone_region": "US",
        "maintenance_window_start": 10
    }
}

Apps

The output of occ app:list (if possible).

Enabled:
  - activity: 8.0.0
  - app_api: 35.0.0
  - appstore: 2.0.0-dev.0
  - circles: 35.0.0
  - cloud_federation_api: 2.0.0-dev.0
  - comments: 2.0.0-dev.0
  - contactsinteraction: 2.0.0-dev.0
  - dashboard: 8.0.0-dev.0
  - dav: 2.0.0-dev.1
  - federatedfilesharing: 2.0.0-dev.1
  - federation: 2.0.0-dev.0
  - files: 3.0.0-dev.0
  - files_downloadlimit: 5.3.0
  - files_lock: 35.0.0
  - files_pdfviewer: 8.0.0
  - files_reminders: 2.0.0-dev.0
  - files_sharing: 2.0.0-dev.1
  - files_trashbin: 2.0.0-dev.0
  - files_versions: 2.0.0-dev.0
  - firstrunwizard: 8.0.0
  - logreader: 8.0.0
  - lookup_server_connector: 2.0.0-dev.0
  - nextcloud_announcements: 7.0.0
  - notifications: 8.0.0
  - oauth2: 2.0.0-dev.0
  - office: 1.1.0
  - password_policy: 7.0.0
  - photos: 8.0.0
  - privacy: 7.0.0
  - profile: 2.0.0-dev.0
  - provisioning_api: 2.0.0-dev.0
  - recommendations: 8.0.0
  - related_resources: 6.0.0
  - serverinfo: 7.0.0
  - settings: 2.0.0-dev.0
  - sharebymail: 2.0.0-dev.0
  - sharing: 1.0.4
  - support: 7.0.0
  - survey_client: 7.0.0
  - systemtags: 2.0.0-dev.0
  - text: 9.0.0
  - theming: 3.0.0-dev.0
  - twofactor_backupcodes: 2.0.0-dev.0
  - twofactor_totp: 17.1.0
  - updatenotification: 2.0.0-dev.0
  - user_status: 2.0.0-dev.0
  - viewer: 8.0.0
  - weather_status: 2.0.0-dev.0
  - webhook_listeners: 2.0.0-dev.0
  - workflowengine: 3.0.0-dev.0
Disabled:
  - admin_audit: 2.0.0-dev.0
  - bruteforcesettings: 8.0.0 (installed 2.0.1)
  - encryption: 3.0.0-dev.0
  - files_external: 2.0.0-dev.0
  - files_rightclick: 0.15.1 (installed 1.6.0)
  - suspicious_login: 13.0.0
  - testing: 1.23.0
  - twofactor_nextcloud_notification: 9.0.0
  - user_ldap: 2.0.0-dev.0

Tips for increasing the likelihood of a response

  • Use the preformatted text formatting option in the editor for all log entries and configuration output.
  • If screenshots are useful, feel free to include them.
    • If possible, also include key error output in text form so it can be searched for.
  • Try to edit log output only minimally (if at all) so that it can be ran through analyzers / formatters by those trying to help you.

hey @vassago and welcome to the beautiful world of nextcloud and it’s community.

your problem seems to be a linux-indicated problem… especially the permissions on your data folder do look wrong… you should try and change the permissions for your folders zu 0750 and for your filed to 0640 … eg. like that:

sudo find /path/to/nextcloud/data -type d -exec chmod 0750
sudo find /path/to/nextcloud/data -type f -exec chmod 0640

if you have your data-directory residing on a exFAT-formatted disk those permissions from above probably won’t work. in this case you could disable the checking in your config.php with this setting check_data_directory_permissions => false

though I haven’t checked the latter setting with v35.

awww… and you please - as usual - take a backup before editing stuff in your configurations, ok?

good luck

We had the same thing. For us it was caused by he new systemd setting ‘ProtectHome=read-only’.

By overriding it to ‘ProtectHome=false’ it is working again.

This happened because the /home directory is now by default read-only for apache. (No idea why they did that.) This new setting is located in /usr/lib/systemd/system/apache2.service. We have overridden it in /etc/systemd/system/apache2.service.d/override.conf. I think we used ‘systemctl edit’.

This is not at all best practice.

Mounting your Nextcloud data directory under /home often causes permission, security, and accessibility errors because web server processes typically lack proper execution or traversal rights inside standard user home directories.

Edit:
Since you use /var/www/nextcloud a better solution wold be the use of /var/nextcloud-data for NC-Data directory even if the nextcloud-data-Files physically are in a subfolder of /home/. The propper solution would be a bind-Mount. E.g.

/home/Nextcloud/     /var/nextcloud_data/     none     bind     0     0

alternatively you could connect local directories as described here:

now its clear you’re not using the snap, but the method is similar regardless of the installation method.