Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Waiting for confirmation of MySQL service startup #118

Open
phenixita opened this issue Jun 9, 2021 · 8 comments
Open

Waiting for confirmation of MySQL service startup #118

phenixita opened this issue Jun 9, 2021 · 8 comments

Comments

@phenixita
Copy link

Hi!

if I run the image inside a kubernetes cluster it gets stuck at:

Waiting for confirmation of MySQL service startup

image

apiVersion: apps/v1
kind: Deployment
metadata:
  name: myphpapp
spec:
  selector:
    matchLabels:
      app: myphpapp
  template:
    metadata:
      labels:
        app: myphpapp
    spec:
      containers:
      - name: myphpapp
        image: mattrayner/lamp:latest-1804
        imagePullPolicy: Always
        resources:
          limits:
            memory: "128Mi"
            cpu: "500m"
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: myphpapp
spec:
  type: LoadBalancer
  selector:
    app: myphpapp
  ports:
  - port: 8888
    targetPort: 80

image

@pzhlkj6612
Copy link
Contributor

Hi. It seems that the execution was sticking at this command:

    mysql -uroot -e "status" > /dev/null 2>&1

mysql -uroot -e "status" > /dev/null 2>&1

The failure may be caused by the MySQL service daemon not started or not working properly. The script executed /usr/bin/mysqld_safe > /dev/null 2>&1 & to start mysqld but we cannot see its output.

Can you please modify the script, rebuild the image and test it yourself? I think you can temporarily change that line to /usr/bin/mysqld_safe and see what happened.

@mattrayner
Copy link
Owner

@phenixita, were you able to fix your issue?

@hzeig
Copy link

hzeig commented Mar 25, 2022

I am having this very same issue! Caught in loop waiting for confirmation of MySQL service startup. I will try your solution.

@hzeig
Copy link

hzeig commented Mar 25, 2022

I am having this very same issue! Caught in loop waiting for confirmation of MySQL service startup. I will try your solution.

Alright I've deleted /dev/null 2>&1 & and just left /usr/bin/mysqld_safe > but I can't even test if it makes a difference.

The container won't run from the downloaded image. Our 3000 port is taken, so I had to change ports to 3003, and then upon running docker run -dp "3003:80" mattrayner/lamp:latest it just exits. Not sure why, it starts up fine but then immediately won't run. Same issue regardless of whether I apply your edits to the support file.

@pzhlkj6612
Copy link
Contributor

Hi @hzeig .

... just left /usr/bin/mysqld_safe > ...

Well, it should be /usr/bin/mysqld_safe .

... and then upon running docker run -dp "3003:80" mattrayner/lamp:latest it just exits.

You were using -d , and it means detach, so you won't see any output after starting the container. To do so, you have two ways:

  • docker run -p "3003:80" mattrayner/lamp:latest (Ctrl-C will take the container down) , or
  • docker run -dp "3003:80" --name 'my_lamp' mattrayner/lamp:latest && docker logs -f 'my_lamp' .

@elulcao
Copy link

elulcao commented Mar 28, 2022

I modified the file mentioned, rebuild the image and started again but other error has been displayed

➜ docker-lamp (master) ✗ docker run -dp "3003:80" --name 'my_lamp' ci_web2004-php7:latest
c2041abad35d80e33c761d44b4ab7e2f13a402a207afb272fef4d9f927a14e50
➜ docker-lamp (master) ✗ docker run -dp "3003:80" --name 'mylamp' ci_web2004-php7:latest
➜ docker-lamp (master) ✗ docker logs -f 'my_lamp'
Updating for PHP 7.4
Replacing CLI php.ini values
Editing APACHE_RUN_GROUP environment variable
Editing phpmyadmin config
Setting up MySQL directories
Allowing Apache/PHP to write to the app
Allowing Apache/PHP to write to MySQL
Editing MySQL config
=> An empty or uninitialized MySQL volume is detected in /var/lib/mysql
=> Installing MySQL ...
=> Done!
=> Waiting for confirmation of MySQL service startup
2022-03-28T03:56:37.455340Z mysqld_safe Logging to '/var/log/mysql/error.log'.
2022-03-28T03:56:37.465749Z mysqld_safe A mysqld process already exists
=> Waiting for confirmation of MySQL service startup
2022-03-28T03:56:42.537526Z mysqld_safe Logging to '/var/log/mysql/error.log'.
2022-03-28T03:56:42.549376Z mysqld_safe A mysqld process already exists
=> Waiting for confirmation of MySQL service startup
2022-03-28T03:56:47.620223Z mysqld_safe Logging to '/var/log/mysql/error.log'.
2022-03-28T03:56:47.632442Z mysqld_safe A mysqld process already exists
=> Waiting for confirmation of MySQL service startup
2022-03-28T03:56:52.702146Z mysqld_safe Logging to '/var/log/mysql/error.log'.
2022-03-28T03:56:52.716204Z mysqld_safe A mysqld process already exists
=> Waiting for confirmation of MySQL service startup
2022-03-28T03:56:57.787764Z mysqld_safe Logging to '/var/log/mysql/error.log'.
2022-03-28T03:56:57.800889Z mysqld_safe A mysqld process already exists
=> Waiting for confirmation of MySQL service startup
^C%
➜ docker-lamp (master) ✗ sed -n 7,11p supporting_files/create_mysql_users.sh
    echo "=> Waiting for confirmation of MySQL service startup"
    sleep 5
    #mysql -uroot -e "status" > /dev/null 2>&1
    /usr/bin/mysqld_safe 
    RET=$?

container log:

➜ docker-lamp (master) ✗ docker ps
CONTAINER ID   IMAGE                    COMMAND     CREATED         STATUS         PORTS                            NAMES
c2041abad35d   ci_web2004-php7:latest   "/run.sh"   6 minutes ago   Up 6 minutes   3306/tcp, 0.0.0.0:3003->80/tcp   my_lamp
➜ docker-lamp (master) ✗ docker exec -it c2041 cat /var/log/mysql/error.log
2022-03-28T03:51:15.549017Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.28-0ubuntu0.20.04.3) initializing of server in progress as process 18415
2022-03-28T03:51:15.557969Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-03-28T03:51:15.972079Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-03-28T03:51:17.035321Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2022-03-28T03:51:18.136108Z 6 [System] [MY-013172] [Server] Received SHUTDOWN from user boot. Shutting down mysqld (Version: 8.0.28-0ubuntu0.20.04.3).
2022-03-28T03:51:22.332396Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.28-0ubuntu0.20.04.3) starting as process 18467
2022-03-28T03:51:22.349338Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-03-28T03:51:22.497842Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-03-28T03:51:22.577947Z 0 [ERROR] [MY-011292] [Server] Plugin mysqlx reported: 'Preparation of I/O interfaces failed, X Protocol won't be accessible'
2022-03-28T03:51:22.577980Z 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-03-28T03:51:22.689233Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2022-03-28T03:51:22.689268Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2022-03-28T03:51:22.690489Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/tmp' in the path is accessible to all OS users. Consider choosing a different directory.
2022-03-28T03:51:22.706958Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.28-0ubuntu0.20.04.3'  socket: '/tmp/tmp.PHNYNuViQ5/mysqld.sock'  port: 0  (Ubuntu).
2022-03-28T03:51:22.781826Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.28-0ubuntu0.20.04.3).
2022-03-28T03:51:24.218179Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.28-0ubuntu0.20.04.3)  (Ubuntu).
2022-03-28T03:51:25.345613Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.28-0ubuntu0.20.04.3) starting as process 18536
2022-03-28T03:51:25.353020Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-03-28T03:51:25.481304Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-03-28T03:51:25.554862Z 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-03-28T03:51:25.595046Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2022-03-28T03:51:25.595546Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2022-03-28T03:51:25.597737Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/tmp' in the path is accessible to all OS users. Consider choosing a different directory.
2022-03-28T03:51:25.619683Z 7 [System] [MY-013172] [Server] Received SHUTDOWN from user boot. Shutting down mysqld (Version: 8.0.28-0ubuntu0.20.04.3).
2022-03-28T03:51:25.620672Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '127.0.0.1' port: 33060
2022-03-28T03:51:27.085060Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.28-0ubuntu0.20.04.3)  (Ubuntu).
2022-03-28T03:56:28.992654Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.28-0ubuntu0.20.04.3) initializing of server in progress as process 28
2022-03-28T03:56:28.999355Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-03-28T03:56:29.282362Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-03-28T03:56:30.191007Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2022-03-28T03:56:32.689801Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.28-0ubuntu0.20.04.3) starting as process 219
2022-03-28T03:56:32.697525Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-03-28T03:56:32.811335Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-03-28T03:56:32.949602Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2022-03-28T03:56:32.949637Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2022-03-28T03:56:32.964939Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.28-0ubuntu0.20.04.3'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu).
2022-03-28T03:56:32.964948Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
➜ docker-lamp (master) ✗

The correct change I guess is to add the complete command inside the loop, otherwise the mysqld_safe fails because of the mysqld process already exists :

➜ docker-lamp (master) ✗ sed -n 1,11p supporting_files/create_mysql_users.sh
#!/bin/bash

/usr/bin/mysqld_safe > /dev/null 2>&1 &

RET=1
while [[ RET -ne 0 ]]; do
    echo "=> Waiting for confirmation of MySQL service startup"
    sleep 5
    #mysql -uroot -e "status" > /dev/null 2>&1
    /usr/bin/mysqld_safe > /dev/null 2>&1 &
    RET=$?
➜ docker-lamp (master) ✗

After that change, I rebuild the image and started again:

➜ docker-lamp (master) ✗ docker run -dp "3003:80" --name 'my_lamp' ci_web2004-php7:latest
bd28fb11a7f0d448d6fa60408e2ad4118a3aa7ebc44d9caa2f041addc60ca9c7
➜ docker-lamp (master) ✗ docker logs -f 'my_lamp'
Updating for PHP 7.4
Replacing CLI php.ini values
Editing APACHE_RUN_GROUP environment variable
Editing phpmyadmin config
Setting up MySQL directories
Allowing Apache/PHP to write to the app
Allowing Apache/PHP to write to MySQL
Editing MySQL config
=> An empty or uninitialized MySQL volume is detected in /var/lib/mysql
=> Installing MySQL ...
=> Done!
=> Waiting for confirmation of MySQL service startup
=> Creating MySQL admin user with random password
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY ''' at line 1
=> Done!
========================================================================
You can now connect to this MySQL Server with HWTqqsLCA0AR

    mysql -uadmin -pHWTqqsLCA0AR -h<host> -P<port>

Please remember to change the above password as soon as possible!
MySQL user 'root' has no password but only allows local connections

enjoy!
========================================================================
Starting supervisord

@hzeig
Copy link

hzeig commented Mar 28, 2022

Hi @pzhlkj6612

I deleted the extra > and ran the image according your recommendations:

You were using -d , and it means detach, so you won't see any output after starting the container. To do so, you have two ways:

  • docker run -p "3003:80" mattrayner/lamp:latest (Ctrl-C will take the container down) , or
  • docker run -dp "3003:80" --name 'my_lamp' mattrayner/lamp:latest && docker logs -f 'my_lamp' .

(These commands called the repo image rather than the locally built image, not sure if that was intentional. I just changed them to call my editedrebuilt version of the image)

When I ran the rebuilt image unedited, I got the same "waiting for confirmation..." loop. After editing I got this error:
standard_init_linux.go:228: exec user process caused: no such file or directory

My locally built image is called "mattrayner.lamp.ammended" using the command docker run -it mattrayner.lamp.ammended

@hzeig
Copy link

hzeig commented Mar 29, 2022

Hi @pzhlkj6612

It seems that the image expects an empty MySQL folder for initialization. When I initialize using an empty MySQL folder, everything starts up swimmingly and my app is hosted on the browser. Now the issue of accessing the database.

I succeeded in getting the .sql file into the mysql folder, but it's not communicating with the app and when I run mysql I get
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

I've googled for solutions to this that work in the context of using an uneditable image/docker container to no avail... any advice?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants