Skip to content

can't create lock file /var/run/mysqld/mysqlx.sock.lock #887

Closed
@ptr727

Description

@ptr727

I use watchtower to keep containers up to date, and I use the latest tag.
I just noticed Home Assistant reporting History integration disabled.

Troubleshooting shows that MySQL is no longer working:

2022-07-10 02:13:29+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.29-1.el8 started.
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
2022-07-10T02:13:30.216474Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.29) starting as process 1
2022-07-10T02:13:30.219843Z 0 [Warning] [MY-010122] [Server] One can only use the --user switch if running as root
2022-07-10T02:13:30.230068Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-07-10T02:13:30.421841Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-07-10T02:13:30.559703Z 0 [ERROR] [MY-011300] [Server] Plugin mysqlx reported: 'Setup of socket: '/var/run/mysqld/mysqlx.sock' failed, can't create lock file /var/run/mysqld/mysqlx.sock.lock'
2022-07-10T02:13:30.672953Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2022-07-10T02:13:30.673008Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2022-07-10T02:13:30.673560Z 0 [ERROR] [MY-010273] [Server] Could not create unix socket lock file /var/run/mysqld/mysqld.sock.lock.
2022-07-10T02:13:30.673593Z 0 [ERROR] [MY-010268] [Server] Unable to setup unix socket lock file.
2022-07-10T02:13:30.673909Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-07-10T02:13:32.078735Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.29)  MySQL Community Server - GPL.

Error seems to be [ERROR] [MY-011300] [Server] Plugin mysqlx reported: 'Setup of socket: '/var/run/mysqld/mysqlx.sock' failed, can't create lock file /var/run/mysqld/mysqlx.sock.lock'

Other than the MySQL version chaging, my system did not change.
Here is the Ansible script I use to deploy:

- name: 'Create MySQL data directory'
  file:
    path: "{{ appdata_dir }}/mysql/data"
    state: directory

- name: 'Install MySQL'
  community.docker.docker_container:
    name: mysql
    image: mysql:latest
    pull: yes
    hostname: mysql
    domainname: "{{ ansible_domain }}"
    restart_policy: unless-stopped
    user: "{{ user_id }}:{{ group_id }}" 
    env:
      MYSQL_ROOT_PASSWORD: "{{ mysql_password }}"
    volumes:
      - "{{ appdata_dir }}/mysql/data:/var/lib/mysql"
    networks:
      - name: "{{ docker_local_network }}"
    published_ports:
      # External routing via published ports
      - 3306:3306
    labels:
      traefik.enable: "false"
      com.centurylinklabs.watchtower.enable: "true"
    recreate: "{{ docker_container_recreate }}"

I use the user directive to run with a user that is not root and has file permissions.
I verified permissions and they are fine.

I noticed in community reviews some reports of switching to Oracle Linux, and users reporting permission errors if the user is not hardcoded to 999, could it be related?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions