Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Failed to install devstack because it can't connect to MySQL server

I want to install OpenStack in a clean Ubuntu 18.04.1 VM, but failed to do so. Steps to reproduce:

Ran ./stack.sh with default configurations.

I got an error "/opt/stack/requirements/.venv/bin/pip’: No such file or directory". I fixed it by running virtualenv /opt/stack/requirements/.venv/ and reran ./stack.sh. It produced the following error:

[...]
2018-11-21 10:52:08.389 | Configuring and starting MySQL
+lib/databases/mysql:configure_database_mysql:64  is_ubuntu
+functions-common:is_ubuntu:467            [[ -z deb ]]
+functions-common:is_ubuntu:470            '[' deb = deb ']'
+lib/databases/mysql:configure_database_mysql:65  my_conf=/etc/mysql/my.cnf
+lib/databases/mysql:configure_database_mysql:79  is_fedora
+functions-common:is_fedora:440            [[ -z Ubuntu ]]
+functions-common:is_fedora:444            '[' Ubuntu = Fedora ']'
+functions-common:is_fedora:444            '[' Ubuntu = 'Red Hat' ']'
+functions-common:is_fedora:445            '[' Ubuntu = RedHatEnterpriseServer ']'
+functions-common:is_fedora:446            '[' Ubuntu = CentOS ']'
+functions-common:is_fedora:446            '[' Ubuntu = OracleServer ']'
+functions-common:is_fedora:447            '[' Ubuntu = Virtuozzo ']'
+lib/databases/mysql:configure_database_mysql:79  is_suse
+functions-common:is_suse:455              [[ -z Ubuntu ]]
+functions-common:is_suse:459              [[ Ubuntu =~ (openSUSE) ]]
+functions-common:is_suse:459              [[ Ubuntu == \S\U\S\E\ \L\I\N\U\X ]]
+lib/databases/mysql:configure_database_mysql:87  sudo mysqladmin -u root password secret
mysqladmin: connect to server at '127.0.0.1' failed
error: 'Can't connect to MySQL server on '127.0.0.1' (111)'
Check that mysqld is running on 127.0.0.1 and that the port is 3306.
You can check this by doing 'telnet 127.0.0.1 3306'
+lib/databases/mysql:configure_database_mysql:87  true
+lib/databases/mysql:configure_database_mysql:90  sudo mysql -uroot -psecret -h127.0.0.1 -e 'GRANT ALL PRIVILEGES ON *.* TO '\''root'\''@'\''%'\'' identified by '\''secret'\'';'
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)
+lib/databases/mysql:configure_database_mysql:1  exit_trap
+./stack.sh:exit_trap:515                  local r=1
++./stack.sh:exit_trap:516                  jobs -p
+./stack.sh:exit_trap:516                  jobs=
+./stack.sh:exit_trap:519                  [[ -n '' ]]
+./stack.sh:exit_trap:525                  '[' -f /tmp/tmp.QHn6q49fWm ']'
+./stack.sh:exit_trap:526                  rm /tmp/tmp.QHn6q49fWm
+./stack.sh:exit_trap:530                  kill_spinner
+./stack.sh:kill_spinner:425               '[' '!' -z '' ']'
+./stack.sh:exit_trap:532                  [[ 1 -ne 0 ]]
+./stack.sh:exit_trap:533                  echo 'Error on exit'
Error on exit
+./stack.sh:exit_trap:535                  type -p generate-subunit
+./stack.sh:exit_trap:536                  generate-subunit 1542796073 1455 fail
+./stack.sh:exit_trap:538                  [[ -z /opt/stack/logs ]]
+./stack.sh:exit_trap:541                  /opt/stack/devstack/tools/worlddump.py -d /opt/stack/logs
World dumping... see /opt/stack/logs/worlddump-2018-11-21-105209.txt for details
+./stack.sh:exit_trap:550                  exit 1

It suggested me to run telnet 127.0.0.1 3306, the command returned an error.

$ telnet 127.0.0.1 3306
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused

$ netstat -paln|grep :3306
tcp        1      0 127.0.0.1:51934         127.0.0.1:3306          CLOSE_WAIT  9105/placementuWSGI 
tcp        1      0 127.0.0.1:51936         127.0.0.1:3306          CLOSE_WAIT  9104/placementuWSGI 
tcp        1      0 127.0.0.1:51902         127.0.0.1:3306          CLOSE_WAIT  7136/nova-apiuWSGI  
tcp        1      0 127.0.0.1:52300         127.0.0.1:3306          CLOSE_WAIT  21045/python        
tcp        1      0 127.0.0.1:52080         127.0.0.1:3306          CLOSE_WAIT  8316/python         
tcp        1      0 127.0.0.1:49704         127.0.0.1:3306          CLOSE_WAIT  110015/keystoneuWSG 
tcp        1      0 127.0.0.1:51904         127.0.0.1:3306          CLOSE_WAIT  7135/nova-apiuWSGI  
tcp        1      0 127.0.0.1:52290         127.0.0.1:3306          CLOSE_WAIT  18344/nova-api-meta 
tcp        1      0 127.0.0.1:51880         127.0.0.1:3306          CLOSE_WAIT  5662/glance-apiuWSG 
tcp        1      0 127.0.0.1:52082         127.0.0.1:3306          CLOSE_WAIT  8316/python         
tcp        1      0 127.0.0.1:52192         127.0.0.1:3306          CLOSE_WAIT  8315/python         
tcp        1      0 127.0.0.1:49718         127.0.0.1:3306          CLOSE_WAIT  110016/keystoneuWSG 
tcp        1      0 127.0.0.1:52288         127.0.0.1:3306          CLOSE_WAIT  18345/nova-api-meta 
tcp        1      0 127.0.0.1:52276         127.0.0.1:3306          CLOSE_WAIT  17617/python        
tcp        1      0 127.0.0.1:52048         127.0.0.1:3306          CLOSE_WAIT  8315/python         
tcp        1      0 127.0.0.1:51888         127.0.0.1:3306          CLOSE_WAIT  5661/glance-apiuWSG

The content of the worlddump file can be viewed here.

What can I do to install devstack?