Unknown (generic) error from engine while initialnizing nextcloud 18

OS system: Windows server 2019 Datecenter (v1809, 17763.805)
Docker: Docker for windows 2.2.0.3 (Engine: 19.03.5, Compose: 1.25.4)
Mariadb: Docker (mariadb:latest)
Nextcloud: 18.0.1 (nextcloud:latest)

My compose.yml

version: '3'

services:

  redis:
    image: redis
    container_name: nextcloud-redis
    restart: unless-stopped
    networks:
      - default
    expose:
      - '6379'

  nextcloud:
    image: nextcloud
    container_name: nextcloud
    restart: unless-stopped
    depends_on:
      - redis
    volumes:
      - /D/Docker/nextcloud/data:/var/www/html/data
    expose:
      - '80'
    networks:
      - default

  mariadb:
    image: mariadb:latest
    container_name: mariadb
    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --innodb-flush-method=fsync
    environment:
      - MYSQL_ROOT_PASSWORD=rootpassword  # Requested, set the root's password of MySQL service.
      - MYSQL_LOG_CONSOLE=true
    volumes:
      - /C/Docker/mariadb:/var/lib/mysql  # Requested, specifies the path to MySQL data persistent store.
      - /C/Docker/mariadb-conf/my.cnf:/etc/my.cnf
    restart: unless-stopped
    networks:
      - default

networks:
  default:
    external:
      name: shared

I tried deploying nextcloud 18 with MySQL for windows 8 Community Server and all things work except for some performance problems (Posted before).

Later now, I realized running database in windows is terrible. Something wrong happen while containers access database passthrough “container -> Docker Host -> sharing file system in Windows Docker -> MySQL for Windows”

So I convert it to recommended MariaDB and put it back into docker. But I stuck in the very beginning of initializing NextCloud via web interface. It turns out like the following: " An exception occurred while executing ‘ALTER TABLE oc_admin_settings CHANGE id id BIGINT AUTO_INCREMENT NOT NULL’ " and blahblahblah.

Entering NextCloud by using SQLite and it runs well. As the same, the errors appear while I try to convert db-type to MySQL

The logs:

root@c2ddfe0dab0f:/var/www/html# php occ db:convert-type --password password --all-apps mysql nextcloud mariadb nextcloud
Creating schema in new database

In AbstractMySQLDriver.php line 106:

  An exception occurred while executing 'ALTER TABLE oc_admin_settings CHANGE `id` id BIGINT AUTO_INCREMENT NOT NULL':                                                     

  SQLSTATE[HY000]: General error: 1025 Error on rename of './nextcloud/oc_admin_settings' to './nextcloud/#sql2-1-56f' (errno: 168 "Unknown (generic) error from engine")  

In PDOConnection.php line 90:

  SQLSTATE[HY000]: General error: 1025 Error on rename of './nextcloud/oc_admin_settings' to './nextcloud/#sql2-1-56f' (errno: 168 "Unknown (generic) error from engine")  

In PDOConnection.php line 88:

  SQLSTATE[HY000]: General error: 1025 Error on rename of './nextcloud/oc_admin_settings' to './nextcloud/#sql2-1-56f' (errno: 168 "Unknown (generic) error from engine") 

It is really weird. After some period of time, the db-type convert succeeded. Maybe I did something like upgrading the Docker Windows to v2.2.0.4 and it fixed the problem?

Did you do something to resolve this? I am facing the same error. But I am running on Arch Linux without docker.

Sorry, I didn’t know this post was followed until today one year later. But I still didn’t figure out why.

Now I already migrate the physic platform to Unraid and use the docker fuction to run nextcloud and has no problem with it. ( v24.0.6)

I guess it was some kind of file system issue with docker for windows. As the volumes of nextcloud container are mounted to external windows NTFS file system, there are many weird errors happened during reading or writing data via smb sharing ( this is how docker for windows deals with data transfer between inside container and outside windows NTFS)

Maybe this is one of the reasons why.