List of Most Common Errors (and Solutions) While Installing OpenStack Image Service GLANCE

Updated on September 1, 2017

I was recently installing OpenStack Icehouse for one of my project by following the official documentation from openstack.org. During the installation of Image service (Glance) on controller node, I was bugged with few errors. After Googling for few minutes, I was able to fix those.

Most of those errors occurred while setting up glance database (it’s normally called as glance database sync), glance service registration with Keystone and while starting the glance-api service and glance-registry service. There were few dependency errors as well, which I’m not going to write in this article. Hopefully, I’ll try to cover those in another article.

For now, here’s the list of errors that I faced during the installation and configuration of Glance.

Solutions for openstack errors

Error when ‘glance-manage db_sync glance’ executed

Here’s the snapshot of the error:

$ glance-manage db_sync glance
/usr/lib/python2.6/site-packages/glance/cmd/manage.py:41: DeprecationWarning: The oslo namespace package is deprecated. Please use oslo_config instead.
  from oslo.config import cfg
/usr/lib64/python2.6/site-packages/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.
  _warn("Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.", PowmInsecureWarning)
2015-02-03 22:00:02.848 8671 CRITICAL glance [-] DbMigrationError: version should be an integer

Solution:
This has something to do with the version of GMP installed. As you can see from the above error, PyCrypto needs libgmp version >=5. To fix this, follow the below steps:

Download and install gmp-6.0.0.a

 $ bunzip2 gmp-6.0.0a.tar.bz2
 $ tar xvf gmp-6.0.0a.tar
 $ cd gmp-6.0.0a.tar
 $ ./configure
 $ make
 $ make check
 $ make install

Now you have the right version of GMP installed and with these libraries you can install PyCrypto. To do that, run the below command.

$ pip install --ignore-installed PyCrypto

Once PyCrpto is installed, you can try Glance database sync again.

ImportError: /usr/lib64/python2.6/site-packages/Crypto/Cipher/_AES.so: undefined symbol: rpl_malloc

When ‘glance-manage db_sync glance‘ executed, I was hit with the below error message:

$ glance-manage db_sync glance
su -s /bin/sh -c "glance-manage db_sync" glance
Traceback (most recent call last):
  File "/usr/bin/glance-manage", line 6, in 
    from glance.cmd.manage import main
  File "/usr/lib/python2.6/site-packages/glance/cmd/manage.py", line 45, in 
    from glance.db import migration as db_migration
  File "/usr/lib/python2.6/site-packages/glance/db/__init__.py", line 21, in 
    from glance.common import crypt
  File "/usr/lib/python2.6/site-packages/glance/common/crypt.py", line 23, in 
    from Crypto.Cipher import AES
  File "/usr/lib64/python2.6/site-packages/Crypto/Cipher/AES.py", line 50, in 
    from Crypto.Cipher import _AES
ImportError: /usr/lib64/python2.6/site-packages/Crypto/Cipher/_AES.so: undefined symbol: rpl_malloc

Solution:

Previously, we fixed libgmp, PyCrypto error by installing GMP version 6.0.0.a and pip install PyCrypto. But that didn’t work as expected. It seems like PyCrypto should be recompiled from source and should not be installed via pip.

Download latest version of PyCrypto and recompile

Untar PyCrypto and set the below environment variable.

$ export ac_cv_func_malloc_0_nonnull=yes

Configure, Build and Install

$ ./configure
$ python setup.py build
$ python setup.py install

Once PyCrypto is installed, try ‘glance-manage db_sync glance‘ again.

Error: ValueError: Tables “migrate_version” have non utf8 collation, please make sure all tables are CHARSET=utf8

# su -s /bin/sh -c “glance-manage db_sync” glance

Note: Whenever you sync database for any service, make sure the corresponding tables are created. For example, when I synced ‘glance’ database using the above command, no tables were created except ‘migrate_version’ and the error log reported as shown in the title of this para.

mysql> show tables;
+------------------+
| Tables_in_glance |
+------------------+
| migrate_version  |
+------------------+
1 row in set (0.00 sec)

Solution:

Login to mysql database as below:

$ mysql -u root -p
mysql > use glance
mysql > alter table migrate_version convert to character set utf8 collate utf8_unicode_ci;

Now, try “db_sync” again.

mysql> show tables;
+------------------+
| Tables_in_glance |
+------------------+
| image_locations  |
| image_members    |
| image_properties |
| image_tags       |
| images           |
| migrate_version  |
| task_info        |
| tasks            |
+------------------+
8 rows in set (0.00 sec)

Error : CRITICAL glance [-] DbMigrationError: version should be an integer

I was still left with few errors while syncing the Glance database.

$ glance-manage db_sync glance
/usr/lib/python2.6/site-packages/glance/cmd/manage.py:41: DeprecationWarning: The oslo namespace package is deprecated. Please use oslo_config instead.
  from oslo.config import cfg
2015-02-04 09:46:14.847 13116 CRITICAL glance [-] DbMigrationError: version should be an integer

Solution:

Instead of executing ‘glance-manage‘ with two arguments, try with one argument ‘db_sync‘ alone.

# glance-manage db_sync

It worked for me.

Error : Expecting an auth URL via either –os-auth-url or env[OS_AUTH_URL

$ keystone user-create --name=glance --pass=<glance_password> --email=<admin_email>
Expecting an auth URL via either --os-auth-url or env[OS_AUTH_URL

Solution : Probably the OpenStack authentication URLs are not set. Try setting the below environment variables.

export OS_USERNAME=admin
export OS_PASSWORD=keystone_password
export OS_TENANT_NAME=admin
export OS_AUTH_URL=http://controller.node.in:35357/v2.0

Once the above variables are set in your shell, try registering the glance service to the keystone again. It worked for me.

$ keystone user-create --name=glance --pass=glance_password --email=admin_email
Expecting an auth URL via either --os-auth-url or env[OS_AUTH_URL

You should see table like the one below
+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|  email   |          admin_email             |
| enabled  |               True               |
|    id    | c8c0212a16084a65469609c857914f8c |
|   name   |              glance              |
| username |              glance              |
+----------+----------------------------------+

Error while starting the glance-api service

$ service openstack-glance-api start [FAILED]

The error log /var/log/glance/openstack-glance-api-startup.log revealed the below message:

Failed to configure store correctly: Store filesystem could not be configured correctly. Reason: Specify at least ‘filesystem_store_datadir’ or ‘filesystem_store_datadirs’ option Disabling add method.

Solution:

  • Open glance-api.conf file. It should be located at /etc/glance/glance-api.conf
  • Look out for ‘filesystem_store_datadir‘ and set ‘/var/lib/glance/images/‘ as value. If already set and commented, just uncomment it.
  • Try starting the service.

Error : Unable to locate paste config file for glance-api

$ service openstack-glance-api start [FAILED]

Solution:

  • Open glance-api.conf file. It should be located at /etc/glance/glance-api.conf
  • Lookout for the line with ‘paste configuration file’ text and uncomment the below line
    config_file=/usr/share/glance/glance-api-dist-paste.ini
  • Try starting the service again.

CRITICAL glance [-] UnicodeError: Message objects do not support str() because they may contain non-ascii characters. Please use unicode() or translate() instead.

$ service openstack-glance-registry start [FAILED]

The log file ‘/var/log/glance/openstack-glance-registry-startup.log‘ revealed the below message:

Solution:

The error occured in the file ‘/usr/lib/python2.6/site-packages/glance/openstack/common/gettextutils.py‘ which was raising ‘UnicodeError‘. You will find more information about the error here.

To fix the issue.

1. Go to this link and copy the modified ‘gettextutils.py’ file.
2. Take a backup of the existing gettextutils.py file as below

cp /usr/lib/python2.6/site-packages/glance/openstack/common/gettextutils.py /usr/lib/python2.6/site-packages/glance/openstack/common/gettextutils.py.bak

3. Replace the file ‘gettextutils.py‘ with the one copied from step 1.
4. Start the glance-registry service as below:

$ service openstack-glance-registry start

Note: If the above command fails with a syntax error, then probably you copied some unwanted characters while copying the modified gettextutils.py script in step 1. For example, the copied file contained some characters such as ‘[docs]‘. To fix the issue, open ‘gettextutils.py‘, search and remove those unwanted characters. Save the file and start the glance-registry service again.

In case, if the service failed to start, then lookout for the fresh error message in the log file.

# tailf /var/log/glance/openstack-glance-registry-startup.log
Traceback (most recent call last):
  File "/usr/bin/glance-registry", line 6, in <module>
    from glance.cmd.registry import main
  File "/usr/lib/python2.6/site-packages/glance/cmd/__init__.py", line 17, in <module>
    gettextutils.install('glance', lazy=True)
TypeError: install() got an unexpected keyword argument 'lazy'

To fix the above error:

$vim /usr/lib/python2.6/site-packages/glance/cmd/__init__.py

and lookout for the function ‘ gettextutils.install(‘glance’, lazy=True)‘ and replace it with the below one:

 gettextutils.install('glance')

save the file and try starting the glance-registry service.

ERROR: Unable to locate paste config file for glance-registry.

# service openstack-glance-registry start
 Starting openstack-glance-registry:                        [FAILED]

The log file revealed the below error:

# tailf /var/log/glance/openstack-glance-registry-startup.log
ERROR: Unable to locate paste config file for glance-registry.

Solution:

  • Open ‘vim /etc/glance/glance-registry.conf‘ and lookout for the line with ‘paste configuration file’ text.
  • Uncomment ‘config_file’. For example : ‘config_file=/usr/share/glance/glance-registry-dist-paste.ini‘ and try starting the service again. It worked for me.

DeprecationWarning: The oslo namespace package is deprecated. Please use oslo_config instead.  from oslo.config import cfg

Solution: Open the below files one by one and replace ‘oslo.config‘ with ‘oslo_config‘ and save it. (Note dot is replaced with underscore)

/usr/lib/python2.6/site-packages/glance/openstack/common/log.py
/usr/lib/python2.6/site-packages/glance/common/wsgi.py:37
/usr/lib/python2.6/site-packages/oslo_config/cfg.py:333
/usr/lib/python2.6/site-packages/oslo_config/cfg.py:333
/usr/lib/python2.6/site-packages/glance/common/config.py:26
/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py:22

Try starting the service and see if you get those warnings.

I hope these findings might help someone out there. Do you have any suggestion? Please share with me in the comment box below.

You might also be interested in : Solutions for Keystone installation errors of OpenStack

And the Bonus is here…

Was this article helpful?

Related Articles

Leave a Comment