intel / ACON

Apache License 2.0
56 stars 16 forks source link

[`Acond`] Encounter `chown` issues when enabling `MySQL` container #3

Closed billionairiam closed 10 months ago

billionairiam commented 1 year ago

When I run MySQL docker as a mysql user inside Acon. I encountered a chown issues:

find: '/var/lib/mysql-files': Permission denied
chown: changing ownership of '/var/run/mysqld': Invalid argument
chown: changing ownership of '/var/run/mysqld/.wh..wh..opq': Invalid argument
chown: changing ownership of '/var/lib/mysql-files': Invalid argument
chown: changing ownership of '/var/lib/mysql/': Invalid argument
chown: changing ownership of '/var/lib/mysql/.wh..wh..opq': Invalid argument
chown: changing ownership of '/var/lib/mysql/auto.cnf': Invalid argument
chown: changing ownership of '/var/lib/mysql/binlog.index': Invalid argument
chown: changing ownership of '/var/lib/mysql': Invalid argument
chown: changing ownership of '/var/lib/mysql/.wh..wh..opq': Invalid argument
chown: changing ownership of '/var/lib/mysql/auto.cnf': Invalid argument
chown: changing ownership of '/var/lib/mysql/binlog.index': Invalid argument

It seems that the entrypoint script will give the user mysql root authority which is not allowed.

Maybe it is caused by the pty

o   sh: cannot set terminal process group (-1): Inappropriate ioctl for device
o   sh: no job control in this shell
o   sh: /root/.profile: Permission denied

Tasks

xiangquanliu commented 11 months ago

This issue can be fixed by running 'chown' in acond. Another issue is that there is no soft link /dev/fd and below are the detail logs.

2023-10-09T05:17:56.200536Z 0 [System] [MY-015018] [Server] MySQL Server Initialization - end. 2023-10-09 05:17:56+00:00 [Note] [Entrypoint]: Database files initialized 2023-10-09 05:17:56+00:00 [Note] [Entrypoint]: Starting temporary server mysqld will log errors to /var/lib/mysql/vm.err mysqld is running as pid 123 2023-10-09T05:17:56.750646Z 0 [System] [MY-015016] [Server] MySQL Server - end. 2023-10-09 05:17:56+00:00 [Note] [Entrypoint]: Temporary server started. '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock' mysql: [ERROR] Failed to open required defaults file: /dev/fd/63 mysql: [ERROR] Fatal error in defaults handling. Program aborted!

One solution is - to create the soft link before starting the container since /dev is a bind mount. @binxing, what's your suggestion?

binxing commented 11 months ago

acond may run as /init so must be able to create symlinks like /dev/fd, /dev/stdin, /dev/stdout, etc.

xiangquanliu commented 11 months ago

Submitted a PR - https://github.com/intel/ACON/pull/35