Useradd should include a UID, cannot cleanly upgrade from 10.5.11 to 10.5.13
Summary
Unable to cleanly upgrade from MariaDB 10.5.11 to 10.5.13 because 10.5.13 runs as a different user ID and group ID resulting in access denied errors. Without specifying a uid and gid in the useradd command, the number is assigned by the OS based on existing accounts. In this case, 10.5.11 is running as 997:995, while 10.5.13 us running as 998:996
Steps to reproduce
Execute the following commands:
docker run -d --name mariadb -p 3306:3306 -v mariadb_data:/var/lib/mysql registry1.dso.mil/ironbank/opensource/mariadb/mariadb:10.5.11
docker stop mariadb
docker rm mariadb
docker run -d --name mariadb -p 3306:3306 -v mariadb_data:/var/lib/mysql registry1.dso.mil/ironbank/opensource/mariadb/mariadb:10.5.13
Startup of 10.5.13 will fail
What is the current bug behavior?
MariaDB fails to start, container exits with code 1
What is the expected correct behavior?
MariaDB starts
Relevant logs and/or screenshots
Warning: World-writable config file '/etc/my.cnf' is ignored
2022-02-04 23:18:01 0 [Note] mysqld (mysqld 10.5.13-MariaDB) starting as process 1 ...
2022-02-04 23:18:01 0 [Warning] Can't create test file /var/lib/mysql/76ac975eb2c9.lower-test
2022-02-04 23:18:01 0 [ERROR] mysqld: File '/var/lib/mysql/aria_log_control' not found (Errcode: 13 "Permission denied")
2022-02-04 23:18:01 0 [ERROR] mysqld: Got error 'Can't open file' when trying to use aria control file '/var/lib/mysql/aria_log_control'
2022-02-04 23:18:01 0 [ERROR] Plugin 'Aria' init function returned error.
2022-02-04 23:18:01 0 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
2022-02-04 23:18:01 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2022-02-04 23:18:01 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2022-02-04 23:18:01 0 [ERROR] Plugin 'InnoDB' init function returned error.
2022-02-04 23:18:01 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2022-02-04 23:18:01 0 [Note] Plugin 'FEEDBACK' is disabled.
2022-02-04 23:18:01 0 [ERROR] Could not open mysql.plugin table: "Table 'mysql.plugin' doesn't exist". Some plugins may be not loaded
2022-02-04 23:18:01 0 [ERROR] Failed to initialize plugins.
2022-02-04 23:18:01 0 [ERROR] Aborting
Possible fixes
https://repo1.dso.mil/dsop/opensource/mariadb/mariadb105/-/blob/development/Dockerfile#L17
Change line 17 and 18 of the Dockerfile from this:
RUN groupadd -r mysql && \
useradd -r -g mysql mysql && \
to something like this:
RUN groupadd -r -g 995 mysql && \
useradd -r -u 997 -g 995 mysql && \
Using 997:995 will solve the immediate problem, but I have no idea if using those IDs will cause conflict with another system account in the future (they don't appear to be used in the 10.5.13 image that was deployed). It does however need to be the same for each release.
Defintion of Done
-
Bug has been identified and corrected within the container
/cc @ironbank-notifications/bug