mysql icon indicating copy to clipboard operation
mysql copied to clipboard

Unable to upgrade to 8.0.30+

Open Maannniii opened this issue 2 years ago • 6 comments

Currently I'm using mysql:8.0.29 we want to use latest image for mysql. However when image tag was changed in docker-compose file and brought up it tries to change ownership of ./sys dir and exits as it is read-only. This is a airgapped environment hence docker image is pushed by saving and loading the images as follows

  1. docker pull mysql:8.0.30
  2. docker save mysql:8.0.30 -o mysql-8.0.30.tar.gz
  3. mysql-8.0.30.tar.gz is downloaded in client server
  4. docker load -i mysql-8.0.30.tar.gz

Docker images were updated from 8.0.23 to 8.0.29 following same methid and we didn't face any. From 8.0.30 this issue pops up and looks like it is spread till latest tag. Log attached for reference.

chown: changing ownership of './sys/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:98/power/autosuspend_delay_ms': Read-only file system
chown: changing ownership of './sys/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:98/power/runtime_status': Read-only file system
chown: changing ownership of './sys/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:98/power/runtime_usage': Read-only file system
chown: changing ownership of './sys/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:98/power/runtime_suspended_time': Read-only file system
chown: changing ownership of './sys/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:98/subsystem': Read-only file system
chown: changing ownership of './sys/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:98/status': Read-only file system
chown: changing ownership of './sys/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:98/uevent': Read-only file system
chown: changing ownership of './sys/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:8a': Read-only file system
chown: changing ownership of './sys/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:8a/adr': Read-only file system
chown: changing ownership of './sys/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:8a/path': Read-only file system
chown: changing ownership of './sys/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:8a/device:8b': Read-only file system
chown: changing ownership of './sys/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:8a/device:8b/adr': Read-only file system
chown: changing ownership of './sys/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:8a/device:8b/sun': Read-only file system
chown: changing ownership of './sys/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:8a/device:8b/path': Read-only file system
chown: changing ownership of './sys/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:8a/device:8b/eject': Read-only file system
chown: changing ownership of './sys/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:8a/device:8b/power': Read-only file system
chown: changing ownership of './sys/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:8a/device:8b/power/control': Read-only file system
---- truncated for ease of readablity ---
chown: changing ownership of './sys/module/nf_conntrack_ipv4/sections/.note.gnu.build-id': Read-only file system
chown: changing ownership of './sys/module/nf_conntrack_ipv4/sections/__kcrctab_gpl': Read-only file system
chown: changing ownership of './sys/module/nf_conntrack_ipv4/sections/__ksymtab_gpl': Read-only file system
chown: changing ownership of './sys/module/nf_conntrack_ipv4/sections/.exit.text': Read-only file system
chown: changing ownership of './sys/module/nf_conntrack_ipv4/sections/__ksymtab_strings': Read-only file system
chown: changing ownership of './sys/module/nf_conntrack_ipv4/sections/.data..read_mostly': Read-only file system
chown: changing ownership of './sys/module/nf_conntrack_ipv4/parameters': Read-only file system
chown: changing ownership of './sys/module/nf_conntrack_ipv4/parameters/hashsize': Read-only file system
chown: changing ownership of './sys/module/nf_conntrack_ipv4/refcnt': Read-only file system
chown: changing ownership of './sys/module/nf_conntrack_ipv4/uevent': Read-only file system
chown: changing ownership of './sys/module/nf_conntrack_ipv4/holders': Read-only file system
chown: changing ownership of './sys/module/nf_conntrack_ipv4/initsize': Read-only file system
chown: changing ownership of './sys/hypervisor': Read-only file system

Issue observed across:

mysql:8.0.30 mysql:8.0.31

Expected Behaviour:

Mysql docker container should start and run normally.

Maannniii avatar Oct 21 '22 04:10 Maannniii

Can you show your docker-compse.yml file?

wglambert avatar Oct 24 '22 19:10 wglambert

docker-compose file:

version: '3.6'
services:
  mysql8:
    image: mysql:8.0.29
    environment:
      - MYSQL_LOG_CONSOLE=true
      - MYSQL_PORT=3306
    container_name: MySQL
    logging:
      driver: "json-file"
      options:
        max-size: "5m"
        max-file: "1"
    restart: always
    volumes:
      - /drive1/MySQL/data:/var/lib/mysql
      - /drive1/MySQL/config/my.cnf:/etc/mysql/conf.d/my.cnf:ro
      - /usr/share/zoneinfo/Asia/Kolkata:/etc/localtime:ro
      - /usr/share/zoneinfo/Asia/Kolkata:/etc/timezone:ro
    ports:
      - 3360:3306
    network_mode: bridge
    security_opt:
      - seccomp:unconfined

my.cnf

[mysqld]
default_authentication_plugin=mysql_native_password
sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"
lower_case_table_names=1
max_connections = 10000
max_allowed_packet = 512M
connect_timeout = 60
net_read_timeout = 120
port = 3306
bind-address= 0.0.0.0
transaction-isolation = READ-COMMITTED
innodb_buffer_pool_size = 5G # (adjust value here, 50%-70% of total RAM)
innodb_log_file_size = 5G
innodb_flush_log_at_trx_commit = 1 # may change to 2 or 0
innodb_flush_method = O_DIRECT
innodb_autoinc_lock_mode =2
log-bin=bin.log
log-bin-index=bin-log.index
max_binlog_size=1G
binlog_format=row
expire-logs-days = 14
server_id = 0

remmina_Cloud VNC_13 127 137 134_2022119-65719 426747

Maannniii avatar Nov 09 '22 07:11 Maannniii

Same here. Upgraded docker image from 8.0.28 > 8.0.31. Getting a ton of

# docker logs -f --tail 100 mysql
chown: changing ownership of './usr/lib/mysqlsh/lib/python3.9/site-packages/oci/data_labeling_service_dataplane/models/update_annotation_details.py': Read-only file system
chown: changing ownership of './usr/lib/mysqlsh/lib/python3.9/site-packages/oci/data_labeling_service_dataplane/models/dataset_format_details.py': Read-only file system
chown: changing ownership of './usr/lib/mysqlsh/lib/python3.9/site-packages/oci/data_labeling_service_dataplane/models/annotation_analytics_aggregation.py': Read-only file system
chown: changing ownership of './usr/lib/mysqlsh/lib/python3.9/site-packages/oci/data_labeling_service_dataplane/models/generic_entity.py': Read-only file system
chown: changing ownership of './usr/lib/mysqlsh/lib/python3.9/site-packages/oci/data_labeling_service_dataplane/models/initial_record_generation_configuration.py': Read-only file system
chown: changing ownership of './usr/lib/mysqlsh/lib/python3.9/site-packages/oci/data_labeling_service_dataplane/models/image_dataset_format_details.py': Read-only file system
chown: changing ownership of './usr/lib/mysqlsh/lib/python3.9/site-packages/oci/data_labeling_service_dataplane/models/image_metadata.py': Read-only file system
chown: changing ownership of './usr/lib/mysqlsh/lib/python3.9/site-packages/oci/data_labeling_service_dataplane/models/annotation_collection.py': Read-only file system
chown: changing ownership of './usr/lib/mysqlsh/lib/python3.9/site-packages/oci/data_labeling_service_dataplane/models/image_object_selection_entity.py': Read-only file system
chown: changing ownership of './usr/lib/mysqlsh/lib/python3.9/site-packages/oci/data_labeling_service_dataplane/models/record_aggregation_dimensions.py': Read-only file system
...

Like on every single file in the container. Of course, running container with read_only: True and mounting only required volumes with rw

roman-vynar avatar Nov 09 '22 10:11 roman-vynar

Figured out. Unlike any previous 8.0.x image it was never required to set user: mysql as a docker container option. Now it is required.

roman-vynar avatar Nov 09 '22 14:11 roman-vynar

@roman-vynar attaching any reference to documentation would be helpful.

Maannniii avatar Nov 09 '22 17:11 Maannniii

@roman-vynar thanks a lot! I had the same issue, making mysql run the container fixed it.

AdrienPoupa avatar Dec 08 '22 19:12 AdrienPoupa

as i understand correctly the fix is to add "user: mysql" under the mysql8 service

services:
  mysql8:
    image: mysql:8.0.35
    user: mysql   

the "user: mysql" option is specified under the mysql8 service. This option ensures that the MySQL process inside the Docker container runs with the mysql user instead of the default root user. This is a recommended security practice to limit potential vulnerabilities.

pymen avatar Aug 14 '23 09:08 pymen