[Snap] Cannot write into “config” directory! error after upgrading Nextcloud and PHP

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 34.0.5snap3 54531 latest/stable
  • Operating system and version (e.g., Ubuntu 24.04):
    • Ubuntu Core 18
  • Web server and version (e.g, Apache 2.4.25):
    • from snap
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • from snap
  • PHP version (e.g, 8.3):
    • from snap
  • Is this the first time you’ve seen this error? (Yes / No):
    • y
  • When did this problem seem to first start?
    • occ upgrade from browser, and same from CLI
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • Nextcloud snap on Ubuntu Core
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • no

Summary of the issue you are facing:

Trying to run last upgrade

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

  1. snap refresh

  2. F5 on browser did not display anything so i did a restart

  3. sudo snap restart nextcloud

  4. F5 on browser prompt a full screen notification to upgrade (and says i can run .occ upgrade)

  5. I click the upgrade button, error on config writting, so i try from CLI

  6. sudo nextcloud.occ upgrade -vvv
    
  7. Fails. More details below

Log entries

Nextcloud upgrade log:

sudo nextcloud.occ upgrade -vvv
2026-10-24T08:11:38+00:00 Setting log level to debug
2026-10-24T08:11:38+00:00 
2026-10-24T08:11:38+00:00 In Config.php line 313:
2026-10-24T08:11:38+00:00                                                                                                                             
2026-10-24T08:11:38+00:00   [Exception]                                                                                                               
2026-10-24T08:11:38+00:00   /var/snap/nextcloud/54531/nextcloud/config/ does not have enough space for writing the config file! Not writing it back!  
2026-10-24T08:11:38+00:00                                                                                                                             
2026-10-24T08:11:38+00:00 
2026-10-24T08:11:38+00:00 Exception trace:
2026-10-24T08:11:38+00:00   at /snap/nextcloud/54531/htdocs/lib/private/Config.php:313
2026-10-24T08:11:38+00:00  OC\Config->writeData() at /snap/nextcloud/54531/htdocs/lib/private/Config.php:142
2026-10-24T08:11:38+00:00  OC\Config->setValue() at /snap/nextcloud/54531/htdocs/lib/private/SystemConfig.php:140
2026-10-24T08:11:38+00:00  OC\SystemConfig->setValue() at /snap/nextcloud/54531/htdocs/lib/private/AllConfig.php:46
2026-10-24T08:11:38+00:00  OC\AllConfig->setSystemValue() at /snap/nextcloud/54531/htdocs/lib/private/Updater.php:79
2026-10-24T08:11:38+00:00  OC\Updater->upgrade() at /snap/nextcloud/54531/htdocs/core/Command/Upgrade.php:196
2026-10-24T08:11:38+00:00  OC\Core\Command\Upgrade->execute() at /snap/nextcloud/54531/htdocs/3rdparty/symfony/console/Command/Command.php:326
2026-10-24T08:11:38+00:00  Symfony\Component\Console\Command\Command->run() at /snap/nextcloud/54531/htdocs/3rdparty/symfony/console/Application.php:1098
2026-10-24T08:11:38+00:00  Symfony\Component\Console\Application->doRunCommand() at /snap/nextcloud/54531/htdocs/3rdparty/symfony/console/Application.php:324
2026-10-24T08:11:38+00:00  Symfony\Component\Console\Application->doRun() at /snap/nextcloud/54531/htdocs/3rdparty/symfony/console/Application.php:175
2026-10-24T08:11:38+00:00  Symfony\Component\Console\Application->run() at /snap/nextcloud/54531/htdocs/lib/private/Console/Application.php:209
2026-10-24T08:11:38+00:00  OC\Console\Application->run() at /snap/nextcloud/54531/htdocs/console.php:92
2026-10-24T08:11:38+00:00  require_once() at /snap/nextcloud/54531/htdocs/occ:33
2026-10-24T08:11:38+00:00 
2026-10-24T08:11:38+00:00 upgrade
2026-10-24T08:11:38+00:00 

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": {
        "apps_paths": [
            {
                "path": "\/snap\/nextcloud\/current\/htdocs\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/snap\/nextcloud\/current\/nextcloud\/extra-apps",
                "url": "\/extra-apps",
                "writable": true
            }
        ],
        "supportedDatabases": [
            "mysql"
        ],
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0
        },
        "log_type": "file",
        "logfile": "\/media\/nextclouda\/logs\/nextcloud.log",
        "logfilemode": 416,
        "maintenance_window_start": 1,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "***REMOVED SENSITIVE VALUE***",
            "***REMOVED SENSITIVE VALUE***"
        ],
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "34.0.3.2",
        "overwrite.cli.url": "***REMOVED SENSITIVE VALUE***",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpsecure": "tls",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpauth": 1,
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "maintenance": false,
        "config_preset": 2,
        "defaultapp": "dashboard,files,calendar,cospend,mail,deck,intravox",
        "app_install_overwrite": [],
        "default_locale": "fr_FR",
        "default_language": "fr",
        "theme": "",
        "loglevel": 2,
        "has_internet_connection": "true"
    }
}

Apps

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

Tips for increasing the likelihood of a response

  • I wish I could configure nextcloud to use a config file somewhere else (like in /media/my_ssd_with_backup_and_writable

  • I think i tryed once with symlink but failed when snap upgrades

  • This works : sudo vi /var/snap/nextcloud/54531/nextcloud/config/config.php

    • So maybe I can update this file manualy to dodge the error for this update?
    • But it will do the same error next time :cry:
  • Tryed to add read-only=>true in the config just to try, fails:

    sudo nextcloud.occ upgrade -vvv
    2026-10-24T08:05:14+00:00 Setting log level to debug
    2026-10-24T08:05:14+00:00
    2026-10-24T08:05:14+00:00 In Config.php line 339:
    2026-10-24T08:05:14+00:00
    2026-10-24T08:05:14+00:00   [OCP\HintException]
    2026-10-24T08:05:14+00:00   Config is set to be read-only via option "config_is_read_only".
    2026-10-24T08:05:14+00:00
    2026-10-24T08:05:14+00:00
    2026-10-24T08:05:14+00:00 Exception trace:
    2026-10-24T08:05:14+00:00   at /snap/nextcloud/54531/htdocs/lib/private/Config.php:339
    2026-10-24T08:05:14+00:00  OC\Config->checkReadOnly() at /snap/nextcloud/54531/htdocs/lib/private/Config.php:281
    2026-10-24T08:05:14+00:00  OC\Config->writeData() at /snap/nextcloud/54531/htdocs/lib/private/Config.php:142
    2026-10-24T08:05:14+00:00  OC\Config->setValue() at /snap/nextcloud/54531/htdocs/lib/private/SystemConfig.php:140
    2026-10-24T08:05:14+00:00  OC\SystemConfig->setValue() at /snap/nextcloud/54531/htdocs/lib/private/AllConfig.php:46
    2026-10-24T08:05:14+00:00  OC\AllConfig->setSystemValue() at /snap/nextcloud/54531/htdocs/lib/private/Updater.php:79
    2026-10-24T08:05:14+00:00  OC\Updater->upgrade() at /snap/nextcloud/54531/htdocs/core/Command/Upgrade.php:196
    2026-10-24T08:05:14+00:00  OC\Core\Command\Upgrade->execute() at /snap/nextcloud/54531/htdocs/3rdparty/symfony/console/Command/Command.php:326
    2026-10-24T08:05:14+00:00  Symfony\Component\Console\Command\Command->run() at /snap/nextcloud/54531/htdocs/3rdparty/symfony/console/Application.php:1098
    2026-10-24T08:05:14+00:00  Symfony\Component\Console\Application->doRunCommand() at /snap/nextcloud/54531/htdocs/3rdparty/symfony/console/Application.php:324
    2026-10-24T08:05:14+00:00  Symfony\Component\Console\Application->doRun() at /snap/nextcloud/54531/htdocs/3rdparty/symfony/console/Application.php:175
    2026-10-24T08:05:14+00:00  Symfony\Component\Console\Application->run() at /snap/nextcloud/54531/htdocs/lib/private/Console/Application.php:209
    2026-10-24T08:05:14+00:00  OC\Console\Application->run() at /snap/nextcloud/54531/htdocs/console.php:92
    2026-10-24T08:05:14+00:00  require_once() at /snap/nextcloud/54531/htdocs/occ:33
    2026-10-24T08:05:14+00:00
    2026-10-24T08:05:14+00:00 upgrade
    2026-10-24T08:05:14+00:00
    
    
    

Hey @cm-t welcome back :waving_hand:

certainly time to upgrade your ancient host → no one should be running internet facing EOL hosts!

we’ve recently upgraded Nextcloud snap to snapd core22, you’re is sitting on core18 and no longer supported by mysql

be sure to make a backup now and save it somewhere safe…

Procedure

  • stop Nextcloud snap sudo snap stop nextcloud
  • save Nextcloud snap sudo snap save nextcloud
  • copy/move snapshot (*.zip) in /var/lib/snapd/snapshots to wherever

and migrate to an new host

see Backup and Restore · nextcloud-snap/nextcloud-snap Wiki · GitHub

Hi, thank you for the anwser.

The initial install was set with core 18 so cat /etc/*ease will return Core 18.

But the upper Core snaps are well UP:

image
I’m not sure what i can do more to have a safer host when i have a old hardware with only a core18 image (see official doc linking only a core18) :confused:

Maybe here is an missunderstanding. Ubuntu Core is not Ubuntu 18.04 LTS.

While LTS Support without ESM is 5 Years, Ubuntu Core 18 will reached its standard End of Life (EOL) in January 2028 (10 years after its initial release).

So if it is Ubuntu Core 18 it is not EOL.

@adelaar thanks for clearing that up…

nonetheless mysql has ended support for core18, which is the reason the snap team needed to upgrade the snapd core to 20 and later to core22 → we’ll be moving up to core24 and the core26 next, so that we can keep mysql upgrade ability and support current Nextcloud versions.

@cm-t could try to upgrade to a later version of snapd… see here nextcloud stopped working after update to 34.0.5snap1 · Issue #3684 · nextcloud-snap/nextcloud-snap · GitHub

see discussion on our GitHub for details on why core18 is no longer supported

sorry about that… you’ll have to consider new hardware

I confirm it is Ubuntu Core 18, immutable system, snap based Ubuntu
See more at: Ubuntu Core | Ubuntu

All snaps are already up to date. For instance, snapd is 2.77.1

snap list
Name                         Version                 Rev    Tracking       Publisher          Notes

canonical-livepatch          v11.0.2                 414    latest/stable  canonical✓         -
core                         16-2.61.4-20260225      17292  latest/stable  canonical✓         core
core18                       20260901                3084   latest/stable  canonical✓         base
core20                       20260901                2922   latest/stable  canonical✓         base
core22                       20260909                2987   latest/stable  canonical✓         base
core24                       20260824                2124   latest/stable  canonical✓         base
core26                       20260925                646    latest/stable  canonical✓         base

nextcloud                    34.0.5snap3             54531  latest/stable  nextcloud✓         -
pc                           18-2                    104    18/stable               -

(hidding some personnal snaps)

Note: just noticing there is an issue updating the snap canonical-livepatch, not sure it is related; beside others snap are up to date

In addition to the arguments of @scubamuc regarding MySQL, you should also check which version of PHP is running on your system.

The reason for this is quite clear: php2shell. If you are not using a patched version of PHP, your system is at high risk.

The purpose of doing the nextcloud snap upgrade is literally having the php update.
The nextcloud snap define itself what version it will use.

More context from here:

That gets you onto 34.0.5snap3, which includes PHP 8.4.27 (the PHP2Shell fix). 34.0.4 still has the vulnerable PHP, so staying held is risky right now.

@adelaar latest/stable: 34.0.5snap3 2026-10-21 (54531) is the patched release!

you are 100% correct, sorry for having misunderstood the initial context…

bar any experience with IoT core devices are out of scope here, this would require support from the canonical folks.

well done, thanks for checking!

maybe @kyrofa has some suggestions

this issue is being discussed on GitHub so we’re closing it here… no need for redundancy?