Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 904671

Summary: Packstack fails on mysql installation "Could not open required defaults file: /root/.my.cnf"
Product: Red Hat OpenStack Reporter: Perry Myers <pmyers>
Component: openstack-packstackAssignee: Martin Magr <mmagr>
Status: CLOSED ERRATA QA Contact: Nir Magnezi <nmagnezi>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 2.0 (Folsom)CC: aortega, derekh, mmagr, ykaul
Target Milestone: snapshot2Keywords: Triaged
Target Release: 2.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-packstack-2012.2.2-0.6.dev345.el6ost Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-14 18:25:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Packstack setup log none

Description Perry Myers 2013-01-27 00:22:38 UTC
Created attachment 688189 [details]
Packstack setup log

Description of problem:
Running packstack installation in a 2 node configuration.  A single node for all controller services and a single node for Compute.  So mysql database is on same machine as all other core services.  

Running packstack command line with answer file from same host where mysql and other services will be installed

mysql installation/configuration fails with the following error message:
err: Could not prefetch database_grant provider 'mysql': Execution of '/usr/bin/mysql --defaults-file=/root/.my.cnf mysql -Be describe user' returned 1: Could not open required defaults file: /root/.my.cnf
Fatal error in defaults handling. Program aborted
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

(full log will be attached)

To note, when I checked /root/.my.cnf after the above failure, it was present and listed:

[root@rhos-mgmt pmyers]# more /root/.my.cnf 
[client]
user=root
host=localhost
password=password

[root@rhos-mgmt pmyers]# ls -laZ /root/.my.cnf 
-r--------. root root system_u:object_r:admin_home_t:s0 /root/.my.cnf

So the file does get created.

Running the mysql command above manually worked fine.

Given that the file is not there before the first packstack run, and is there (and is not cleaned up) during the second packstack run, that would explain why it only occurs the first time you run packstack on a given machine where mysql is to be installed

Version-Release number of selected component (if applicable):
openstack-packstack-2012.2.2-0.5.dev318.el6ost.noarch

How reproducible:
If I start with a pristine image (RHEL 6.4, never run packstack before) it is reproducible every time.  However, if I run packstack a second time on that same machine it works fine.

Steps to Reproduce:
1. Run packstack in an 'all in one' configuration on a pristine (never had mysql or Packstack/RHOS previously installed)
2.
3.
  
Actual results:
packstack fails due to missing .my.cnf file

Expected results:
packstack doesn't fail

Additional info:
Packstack answer file
[general]
CONFIG_SSH_KEY=/home/pmyers/.ssh/id_rsa.pub
CONFIG_GLANCE_INSTALL=y
CONFIG_CINDER_INSTALL=y
CONFIG_NOVA_INSTALL=y
CONFIG_HORIZON_INSTALL=y
CONFIG_SWIFT_INSTALL=y
CONFIG_CLIENT_INSTALL=y
CONFIG_MYSQL_HOST=192.168.10.2
CONFIG_MYSQL_USER=root
CONFIG_MYSQL_PW=password
CONFIG_QPID_HOST=192.168.10.2
CONFIG_KEYSTONE_HOST=192.168.10.2
CONFIG_KEYSTONE_ADMINTOKEN=d7b96c9ded57449a83242db047ab4079
CONFIG_KEYSTONE_ADMINPASSWD=password
CONFIG_GLANCE_HOST=192.168.10.2
CONFIG_CINDER_HOST=192.168.10.2
CONFIG_NOVA_API_HOST=192.168.10.2
CONFIG_NOVA_CERT_HOST=192.168.10.2
CONFIG_NOVA_VNCPROXY_HOST=192.168.1.70
CONFIG_NOVA_COMPUTE_HOSTS=192.168.10.1
CONFIG_NOVA_COMPUTE_PRIVIF=virbr1
CONFIG_NOVA_NETWORK_HOST=192.168.10.2
CONFIG_NOVA_NETWORK_PUBIF=eth0
CONFIG_NOVA_NETWORK_PRIVIF=eth2
CONFIG_NOVA_NETWORK_FIXEDRANGE=192.168.32.0/22
CONFIG_NOVA_NETWORK_FLOATRANGE=10.3.4.0/22
CONFIG_NOVA_SCHED_HOST=192.168.10.2
CONFIG_OSCLIENT_HOST=192.168.10.2
CONFIG_HORIZON_HOST=192.168.10.2
CONFIG_SWIFT_PROXY_HOSTS=192.168.10.2
CONFIG_SWIFT_STORAGE_HOSTS=192.168.10.2
CONFIG_SWIFT_STORAGE_ZONES=1
CONFIG_SWIFT_STORAGE_REPLICAS=1
CONFIG_SWIFT_STORAGE_FSTYPE=ext4
CONFIG_USE_EPEL=n
CONFIG_REPO=
CONFIG_RH_USERNAME=
CONFIG_RH_PASSWORD=

Comment 1 Derek Higgins 2013-01-28 11:53:40 UTC
The mysql puppet modules create the file /root/.my.cnf before mysql is installed and expect this to be the case.

I can only reproduce this problem in cases where mysql was installed but /root/.my.cnf wasn't present before packstack was run, can you confirm if this was the case in your setup?

Comment 2 Martin Magr 2013-01-28 12:03:30 UTC
I tried to reproduce this scenario with current master branch and MySQL was installed correctly. Packstack finished installation without any failure.

My ans. file:
[para@virtual-rhel-beta ~]$ cat ans.txt 
[general]

# Path to a Public key to install on servers. If a usable key has not
# been installed on the remote servers the user will be prompted for a
# password and this key will be installed so the password will not be
# required again
CONFIG_SSH_KEY=/home/para/.ssh/id_rsa.pub

# Set to 'y' if you would like Packstack to install Glance
CONFIG_GLANCE_INSTALL=y

# Set to 'y' if you would like Packstack to install Cinder
CONFIG_CINDER_INSTALL=y

# Set to 'y' if you would like Packstack to install Nova
CONFIG_NOVA_INSTALL=y

# Set to 'y' if you would like Packstack to install Horizon
CONFIG_HORIZON_INSTALL=y

# Set to 'y' if you would like Packstack to install Swift
CONFIG_SWIFT_INSTALL=n

# Set to 'y' if you would like Packstack to install the openstack
# client packages. An admin "rc" file will also be installed
CONFIG_CLIENT_INSTALL=y

# The IP address of the server on which to install MySQL
CONFIG_MYSQL_HOST=192.168.122.154

# Username for the MySQL admin user
CONFIG_MYSQL_USER=root

# Password for the MySQL admin user
CONFIG_MYSQL_PW=1a36513e0ab14b94

# The IP address of the server on which to install the QPID service
CONFIG_QPID_HOST=192.168.122.154

# The IP address of the server on which to install Keystone
CONFIG_KEYSTONE_HOST=192.168.122.154

# The password to use for the Keystone to access DB
CONFIG_KEYSTONE_DB_PW=b987203970ae4f7e

# The token to use for the Keystone service api
CONFIG_KEYSTONE_ADMINTOKEN=0692d0e09d274c97b77ad5bff0df6a5a

# The password to use for the Keystone admin user
CONFIG_KEYSTONE_ADMINPASSWD=5f538e425e064269

# The IP address of the server on which to install Glance
CONFIG_GLANCE_HOST=192.168.122.154

# The password to use for the Glance to access DB
CONFIG_GLANCE_DB_PW=918482520b8747b8

# The password to use for the Glance to authenticate with Keystone
CONFIG_GLANCE_KS_PW=6cd1d036ee0849ef

# The IP address of the server on which to install Cinder
CONFIG_CINDER_HOST=192.168.122.154

# The password to use for the Cinder to access DB
CONFIG_CINDER_DB_PW=87a1f6f4e7b04ce6

# The password to use for the Cinder to authenticate with Keystone
CONFIG_CINDER_KS_PW=561e57c005e34900

# The IP address of the server on which to install the Nova API
# service
CONFIG_NOVA_API_HOST=192.168.122.154

# The IP address of the server on which to install the Nova Cert
# service
CONFIG_NOVA_CERT_HOST=192.168.122.154

# The IP address of the server on which to install the Nova VNC proxy
CONFIG_NOVA_VNCPROXY_HOST=192.168.122.154

# A comma separated list of IP addresses on which to install the Nova
# Compute services
CONFIG_NOVA_COMPUTE_HOSTS=192.168.122.234

# Private interface for Flat DHCP on the Nova compute servers
CONFIG_NOVA_COMPUTE_PRIVIF=eth1

# The IP address of the server on which to install the Nova Network
# service
CONFIG_NOVA_NETWORK_HOST=192.168.122.154

# The password to use for the Nova to access DB
CONFIG_NOVA_DB_PW=6e302cf9b26b4de5

# The password to use for the Nova to authenticate with Keystone
CONFIG_NOVA_KS_PW=faae601f984541d6

# Public interface on the Nova network server
CONFIG_NOVA_NETWORK_PUBIF=eth0

# Private interface for Flat DHCP on the Nova network server
CONFIG_NOVA_NETWORK_PRIVIF=eth1

# IP Range for Flat DHCP
CONFIG_NOVA_NETWORK_FIXEDRANGE=192.168.32.0/22

# IP Range for Floating IP's
CONFIG_NOVA_NETWORK_FLOATRANGE=10.3.4.0/22

# The IP address of the server on which to install the Nova Scheduler
# service
CONFIG_NOVA_SCHED_HOST=192.168.122.154

# The IP address of the server on which to install the openstack
# client packages. An admin "rc" file will also be installed
CONFIG_OSCLIENT_HOST=192.168.122.154

# The IP address of the server on which to install Horizon
CONFIG_HORIZON_HOST=192.168.122.154

# The IP address on which to install the Swift proxy service
CONFIG_SWIFT_PROXY_HOSTS=192.168.122.154

# The password to use for the Swift to authenticate with Keystone
CONFIG_SWIFT_KS_PW=9f1f6f47de934996

# A comma separated list of IP addresses on which to install the
# Swift Storage services, each entry should take the format
# <ipaddress>[/dev], for example 127.0.0.1/vdb will install /dev/vdb
# on 127.0.0.1 as a swift storage device, if /dev is omitted Packstack
# will create a loopback device for a test setup
CONFIG_SWIFT_STORAGE_HOSTS=192.168.122.154

# Number of swift storage zones, this number MUST be no bigger than
# the number of storage devices configured
CONFIG_SWIFT_STORAGE_ZONES=1

# Number of swift storage replicas, this number MUST be no bigger
# than the number of storage zones configured
CONFIG_SWIFT_STORAGE_REPLICAS=1

# FileSystem type for storage nodes
CONFIG_SWIFT_STORAGE_FSTYPE=ext4

# Install OpenStack from EPEL. If set to "y" EPEL will be installed
# on each server
CONFIG_USE_EPEL=n

# A comma separated list of URLs to any additional yum repositories
# to install
CONFIG_REPO=

# To subscribe each server with Red Hat subscription manager, include
# this with CONFIG_RH_PASSWORD
CONFIG_RH_USERNAME=

# To subscribe each server with Red Hat subscription manager, include
# this with CONFIG_RH_USERNAME
CONFIG_RH_PASSWORD=


File /root/.my.cnf was created in my case too:
[para@virtual-rhel-beta ~]$ sudo find / -name '.my.cnf' 2>/dev/null
/root/.my.cnf
[para@virtual-rhel-beta ~]$ sudo cat /root/.my.cnf
[client]
user=root
host=localhost
password=1a36513e0ab14b94

Comment 3 Derek Higgins 2013-01-28 12:33:24 UTC
In addition the the details in comment #1, packstack can also ignore the error from puppet in cases where this situation occurs

change proposed upstream
https://review.openstack.org/#/c/20592/

puppet will retry fetching database_grant when needed.

Comment 4 Perry Myers 2013-01-28 12:55:41 UTC
(In reply to comment #1)
> The mysql puppet modules create the file /root/.my.cnf before mysql is
> installed and expect this to be the case.
> 
> I can only reproduce this problem in cases where mysql was installed but
> /root/.my.cnf wasn't present before packstack was run, can you confirm if
> this was the case in your setup?

Yes, that is correct.

The VM image had all RHEL dependencies installed (like mysql-server) prior to running packstack for the first time.

Comment 6 Nir Magnezi 2013-02-13 14:50:37 UTC
Verified NVR: openstack-packstack-2012.2.2-0.8.dev346.el6ost.noarch

Installed OS via Packstack on RHEL6.4 installed with mysql-server, but does not contain the file /root/.my.cnf

packstack ran with no errors.

Comment 8 errata-xmlrpc 2013-02-14 18:25:18 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0260.html