Nextcloud restore fails: ERROR 1180 "Operation not permitted" during COMMIT, after failed upgrade

What app is this about, and its version: Nextcloud, v31.x
What YunoHost version are you running: 12.1.39
What type of hardware are you using: Old laptop or computer
MariaDB: 10.11.14

Describe your issue

Hi, I had an issue when trying to upgrade Nextcloud from 31 to 32; I ended up with Nextcloud uninstalled except for /home/yunohost.app/nextcloud/data which seems intact.

(This post was drafted by Claude, please forgive any nonhumanisms :slight_smile: )

The upgrade failed due to incompatible NC apps (that’s fine), then the automatic backup restore failed with:

ERROR 1180 (HY000) at line 324814: Got error 1 “Operation not permitted” during COMMIT

The error always occurs at the same line - an INSERT into oc_reactions table (2 rows with emoji reactions).

What I checked:

  • Disk space: plenty available (12% used on /)
  • AppArmor: not active (aa-status | grep mysql returns empty)
  • MySQL write permissions: sudo -u mysql touch /var/lib/mysql/test_write works
  • MySQL error log: empty
  • innodb_force_recovery: 0
  • Test DB creation/insert/drop: works fine
  • SELinux: not installed

What I tried:

  • yunohost backup restore nextcloud-pre-upgrade1 --apps nextcloud → same error
  • Manual import: mysql nextcloud < db.sql → same error at same line
  • Split SQL file to skip the problematic INSERT → works until next table, then encoding errors (separate issue, Latin1 chars in UTF8 dump)
  • Import with --default-character-set=latin1 → same error

Any ideas?

Share relevant logs or error messages

  1. Backup (success): https://paste.yunohost.org/raw/xuxegapixi
  2. Upgrade (failure): https://paste.yunohost.org/raw/xukorawogo
  3. Remove (success): hastebin
  4. Restore (failure): https://paste.yunohost.org/raw/ewaxutajuy

Perhaps you can try edit manually the file and look at line 324814

But you said you have try split these lines ?? It seems very hard to edit a mysql file…

If you can you execute mysql commands on the db ?? ( I am not sure… or perhaps it’s possible…)

Looking and remplacement of caracters Latin‑1 inside a SQL file for a base UTF‑8 mb4

  1. Make a copy of the db

    cp dump.sql dump.sql.bak

  2. Detect octets non‑UTF‑8 (Latin‑1)

    #show lines with octets outside UTF‑8

    grep -P "[\x80-\xFF]" -n dump.sql

  3. Convert all file from Latin‑1 to UTF‑8

    iconv -f latin1 -t utf8mb4 dump.sql > dump_utf8.sql

  4. Vérify conversion
    #Looking for caracters still wrongs
    grep -P "[\x80-\xFF]" -n dump_utf8.sql

  5. Remplace caracters problematics singulars (ex. « é », « ç », etc.)

    #Example : replace é (0xE9) with é on UTF‑8
    sed -i 's/\xE9/Ă©/g' dump_utf8.sql

  6. Import inside the base UTF‑8 mb4

    mysql -u nextcloud -p --default-character-set=utf8mb4 nextcloud < dump_utf8.sql