Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-130028

mysqld doesn't start in image mode due to missing/invalid user

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • rhel-9.8
    • mysql
    • None
    • rhel-databases
    • None
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • Unspecified
    • Unspecified
    • Unspecified
    • All
    • None

      What were you trying to do that didn't work?

      :: [ 20:24:05 ] :: [  BEGIN   ] :: Running 'mysqlStart'
      :: [ 20:24:05 ] :: [  BEGIN   ] :: Running 'rlServiceStart "mysqld"'
      Redirecting to /bin/systemctl status mysqld.service
      Redirecting to /bin/systemctl start mysqld.service
      Job for mysqld.service failed because the control process exited with error code.
      See "systemctl status mysqld.service" and "journalctl -xeu mysqld.service" for details.
      :: [ 20:24:05 ] :: [   ERROR  ] :: rlServiceStart: Starting service mysqld failed
      :: [ 20:24:05 ] :: [   ERROR  ] :: Status of the failed service:
      :: [ 20:24:05 ] :: [   LOG    ] ::   Redirecting to /bin/systemctl status mysqld.service
      :: [ 20:24:05 ] :: [   LOG    ] ::   ● mysqld.service - MySQL 8.0 database server
      :: [ 20:24:05 ] :: [   LOG    ] ::   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; preset: disabled)
      :: [ 20:24:05 ] :: [   LOG    ] ::   Active: activating (auto-restart) (Result: exit-code) since Thu 2025-11-20 20:24:05 UTC; 32ms ago
      :: [ 20:24:05 ] :: [   LOG    ] ::   Process: 3886 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=217/USER)
      :: [ 20:24:05 ] :: [   LOG    ] ::   Process: 3887 ExecStopPost=/usr/libexec/mysql-wait-stop (code=exited, status=217/USER)
      :: [ 20:24:05 ] :: [   LOG    ] ::   CPU: 2ms
      :: [ 20:24:05 ] :: [   FAIL   ] :: Command 'rlServiceStart "mysqld"' (Expected 0, got 1)
      :: [ 20:24:05 ] :: [  BEGIN   ] :: Running 'service mysqld status'
      Redirecting to /bin/systemctl status mysqld.service
      ● mysqld.service - MySQL 8.0 database server
           Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; preset: disabled)
           Active: activating (auto-restart) (Result: exit-code) since Thu 2025-11-20 20:24:05 UTC; 98ms ago
          Process: 3886 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=217/USER)
          Process: 3887 ExecStopPost=/usr/libexec/mysql-wait-stop (code=exited, status=217/USER)
              CPU: 2ms
      :: [ 20:24:05 ] :: [   FAIL   ] :: Command 'service mysqld status' (Expected 0, got 3)
      :: [ 20:24:05 ] :: [   FAIL   ] :: Command 'mysqlStart' (Expected 0, got 3)
      Nov 20 20:24:05 dd2b574a-b52e-46f5-9cc3-b713481c67b3 systemd[1]: Starting MySQL 8.0 database server...
      ░░ Subject: A start job for unit mysqld.service has begun execution
      ░░ Defined-By: systemd
      ░░ Support: https://access.redhat.com/support
      ░░ 
      ░░ A start job for unit mysqld.service has begun execution.
      ░░ 
      ░░ The job identifier is 1752.
      Nov 20 20:24:05 dd2b574a-b52e-46f5-9cc3-b713481c67b3 systemd[3886]: mysqld.service: Failed to determine user credentials: No such process
      Nov 20 20:24:05 dd2b574a-b52e-46f5-9cc3-b713481c67b3 systemd[3886]: mysqld.service: Failed at step USER spawning /usr/libexec/mysql-check-socket: No such process
      ░░ Subject: Process /usr/libexec/mysql-check-socket could not be executed
      ░░ Defined-By: systemd
      ░░ Support: https://access.redhat.com/support
      ░░ 
      ░░ The process /usr/libexec/mysql-check-socket could not be executed and failed.
      ░░ 
      ░░ The error number returned by this process is ERRNO.
      Nov 20 20:24:05 dd2b574a-b52e-46f5-9cc3-b713481c67b3 systemd[1]: mysqld.service: Control process exited, code=exited, status=217/USER
      ░░ Subject: Unit process exited
      ░░ Defined-By: systemd
      ░░ Support: https://access.redhat.com/support
      ░░ 
      ░░ An ExecStartPre= process belonging to unit mysqld.service has exited.
      ░░ 
      ░░ The process' exit code is 'exited' and its exit status is 217.
      Nov 20 20:24:05 dd2b574a-b52e-46f5-9cc3-b713481c67b3 systemd[3887]: mysqld.service: Failed to determine user credentials: No such process
      Nov 20 20:24:05 dd2b574a-b52e-46f5-9cc3-b713481c67b3 systemd[3887]: mysqld.service: Failed at step USER spawning /usr/libexec/mysql-wait-stop: No such process
      ░░ Subject: Process /usr/libexec/mysql-wait-stop could not be executed
      ░░ Defined-By: systemd
      ░░ Support: https://access.redhat.com/support
      ░░ 
      ░░ The process /usr/libexec/mysql-wait-stop could not be executed and failed.
      ░░ 
      ░░ The error number returned by this process is ERRNO.
      Nov 20 20:24:05 dd2b574a-b52e-46f5-9cc3-b713481c67b3 systemd[1]: mysqld.service: Control process exited, code=exited, status=217/USER
      ░░ Subject: Unit process exited
      ░░ Defined-By: systemd
      ░░ Support: https://access.redhat.com/support
      ░░ 
      ░░ An ExecStopPost= process belonging to unit mysqld.service has exited.
      ░░ 
      ░░ The process' exit code is 'exited' and its exit status is 217.
      Nov 20 20:24:05 dd2b574a-b52e-46f5-9cc3-b713481c67b3 systemd[1]: mysqld.service: Failed with result 'exit-code'.
      ░░ Subject: Unit failed
      ░░ Defined-By: systemd
      ░░ Support: https://access.redhat.com/support
      ░░ 
      ░░ The unit mysqld.service has entered the 'failed' state with result 'exit-code'.
      Nov 20 20:24:05 dd2b574a-b52e-46f5-9cc3-b713481c67b3 systemd[1]: Failed to start MySQL 8.0 database server.
      ░░ Subject: A start job for unit mysqld.service has failed
      ░░ Defined-By: systemd
      ░░ Support: https://access.redhat.com/support
      ░░ 
      ░░ A start job for unit mysqld.service has finished with a failure.
      ░░ 
      ░░ The job identifier is 1752 and the job result is failed.

       

      AI investigation:

      The error is clear: exit status 217/USER means systemd failed to determine user credentials for the mysql user. The error "Failed to determine user credentials: No
       such process" indicates the mysql user doesn't exist in the image.

       Since /usr is read-only in image mode, you can't modify system files or create new users in the traditional way. Here are your options:

       Option 1: Use an overlayfs or tmpfs for writable paths (Recommended)

       Create writable directories for MySQL's runtime needs:

       # Create overlay or temp directories for MySQL
       mkdir -p /var/run/mysqld
       mkdir -p /var/lib/mysql
       chmod 777 /var/run/mysqld
       chmod 777 /var/lib/mysql

       # Start mysqld directly instead of via systemd
       mysqld --user=root --datadir=/var/lib/mysql --socket=/var/run/mysqld/mysqld.sock &

       Option 2: Modify the service file to not require a specific user

       If you have write access to /etc/systemd/system/, create an override:

       mkdir -p /etc/systemd/system/mysqld.service.d/
       cat > /etc/systemd/system/mysqld.service.d/override.conf << EOF
       [Service]
       User=root
       Group=root
       EOF

       systemctl daemon-reload
       systemctl start mysqld

       Option 3: Use a different initialization approach

       Instead of systemd, use a custom script in your test setup:

       # Run MySQL without systemd
       mysqld_safe --skip-grant-tables --datadir=/tmp/mysql &
       # or
       mysqld --user=root --datadir=/tmp/mysql --socket=/tmp/mysql.sock &

       For image mode specifically:

       The cleanest approach is to pre-create necessary users and directories during the image build phase (if possible), or use Option 1 to set up temporary writable
       locations at test runtime before starting mysqld.

      mariadb works as expected in IM.

      What is the impact of this issue to you?

      I can't test my components which require mysql

      Please provide the package NVR for which the bug is seen:

      mysql-server-8.0.43-1.el9_6

      How reproducible is this bug?:

      Always

      Steps to reproduce

      1.  testing-farm request --arch x86_64 --git-url https://gitlab.com/redhat/rhel/tests/perl-DBD-MySQL/ --git-ref master --compose RHEL-9.8.0-image-mode --context distro=RHEL-9.8.0 --plan plans/general --context deployment-mode=image --tmt-environment TMT_POLICY_NAME=rhel-ci --no-wait
      2.  
      3.  

      Expected results

      Actual results

              mschorm@redhat.com Michal Schorm
              mkyral@redhat.com Martin Kyral
              Michal Schorm Michal Schorm
              Vaclav Danek Vaclav Danek
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated: