首頁 > 軟體

apt-get install openstack pkg 故障解決

2020-06-16 17:55:26

作業系統為Ubuntu 14.04

在Openstack軟體包安裝過程中,主機的DNS沒問題,軟體源的倉庫也是正確的,為什麼總是出現軟體包安裝錯誤呢?

報錯如下:

# apt-get install cinder-api cinder-scheduler cinder-volume python-cinderclient -y

Reading package lists... Done
Building dependency tree
Reading state information... Done
cinder-api is already the newest version.
cinder-scheduler is already the newest version.
cinder-volume is already the newest version.
python-cinderclient is already the newest version.
The following packages were automatically installed and are no longer required:
  libboost-iostreams1.46.1 libclass-isa-perl libswitch-perl
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 27 not upgraded.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US:en",
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Setting up cinder-common (1:2015.1.0-0ubuntu1~cloud0) ...
/usr/lib/python2.7/dist-packages/oslo_messaging/_drivers/base.py:20: DeprecationWarning: The oslo namespace package is deprecated. Please use oslo_config instead.
  from oslo.config import cfg
Traceback (most recent call last):
  File "/usr/bin/cinder-manage", line 6, in <module>
    from cinder.cmd.manage import main
  File "/usr/lib/python2.7/dist-packages/cinder/cmd/manage.py", line 74, in <module>
    from cinder.common import config  # noqa
  File "/usr/lib/python2.7/dist-packages/cinder/common/config.py", line 105, in <module>
    help=_("DEPRECATED: Deploy v1 of the Cinder API.")),
  File "/usr/lib/python2.7/dist-packages/oslo_i18n/_factory.py", line 80, in f
    return _message.Message(msg, domain=domain)
  File "/usr/lib/python2.7/dist-packages/oslo_i18n/_message.py", line 51, in __new__
    msgtext = Message._translate_msgid(msgid, domain)
  File "/usr/lib/python2.7/dist-packages/oslo_i18n/_message.py", line 91, in _translate_msgid
    system_locale = locale.getdefaultlocale()
  File "/usr/lib/python2.7/locale.py", line 543, in getdefaultlocale
    return _parse_localename(localename)
  File "/usr/lib/python2.7/locale.py", line 475, in _parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8
dpkg: error processing package cinder-common (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of cinder-volume:
 cinder-volume depends on cinder-common (= 1:2015.1.0-0ubuntu1~cloud0); however:
  Package cinder-common is not configured yet.


dpkg: error processing package cinder-volume (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of cinder-api:
 cinder-api depends on cinder-common (= 1:2015.1.0-0ubuntu1~cloud0); however:
  Package cinder-common is not configured yet.


dpkg: error processing package cinder-api (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of cinder-scheduler:
 cinder-scheduler depends on cinder-common (= 1:2015.1.0-0ubuntu1~cloud0); however:
  Package cinder-common is not configured yet.


dpkg: error processing package cinder-scheduler (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because MaxReports is reached already
                                    Errors were encountered while processing:
 cinder-common
 cinder-volume
 cinder-api
 cinder-scheduler

E: Sub-process /usr/bin/dpkg returned an error code (1)

 


螢幕上的報錯,一下跳到最後,怎麼檢查都沒查出來。

於是回頭分析報錯的根源:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US:en",
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory


這幾個警告是提示系統環境的locale設定,太常見很容易忽略。

Setting up cinder-common (1:2015.1.0-0ubuntu1~cloud0) ...
/usr/lib/python2.7/dist-packages/oslo_messaging/_drivers/base.py:20: DeprecationWarning: The oslo namespace package is deprecated. Please use oslo_config instead.
  from oslo.config import cfg
Traceback (most recent call last):
  File "/usr/bin/cinder-manage", line 6, in <module>
    from cinder.cmd.manage import main
  File "/usr/lib/python2.7/dist-packages/cinder/cmd/manage.py", line 74, in <module>
    from cinder.common import config  # noqa
  File "/usr/lib/python2.7/dist-packages/cinder/common/config.py", line 105, in <module>
    help=_("DEPRECATED: Deploy v1 of the Cinder API.")),
  File "/usr/lib/python2.7/dist-packages/oslo_i18n/_factory.py", line 80, in f
    return _message.Message(msg, domain=domain)
  File "/usr/lib/python2.7/dist-packages/oslo_i18n/_message.py", line 51, in __new__
    msgtext = Message._translate_msgid(msgid, domain)
  File "/usr/lib/python2.7/dist-packages/oslo_i18n/_message.py", line 91, in _translate_msgid
    system_locale = locale.getdefaultlocale()
  File "/usr/lib/python2.7/locale.py", line 543, in getdefaultlocale
    return _parse_localename(localename)
  File "/usr/lib/python2.7/locale.py", line 475, in _parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8


但這部分已經說軟體包由於系統環境的編碼格式導致錯誤。

如果不處理,那在apt安裝其他軟體時還會報相同的錯。

很多時候,我們會把這部分與上面的警告混在一起,從而轉移注意力到其他地方。

解決方法為:

echo 'LC_ALL="en_US.UTF-8"' >> /etc/default/locale


註:此環境的OS為ubuntu14.04。其他OS根據實際環境設定。

退出當前終端,重新登入,檢視當前終端環境的locale:

# locale
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

再次使用apt-get安裝即可成功。

下面是小編為你精選的Openstack相關知識,看看是否有你喜歡的

在Ubuntu 12.10 上安裝部署Openstack http://www.linuxidc.com/Linux/2013-08/88184.htm

Ubuntu 12.04 OpenStack Swift單節點部署手冊 http://www.linuxidc.com/Linux/2013-08/88182.htm

OpenStack雲端計算快速入門教學 http://www.linuxidc.com/Linux/2013-08/88186.htm

企業部署OpenStack:該做與不該做的事 http://www.linuxidc.com/Linux/2013-09/90428.htm

CentOS 6.5 x64bit 快速安裝OpenStack http://www.linuxidc.com/Linux/2014-06/103775.htm

本文永久更新連結地址http://www.linuxidc.com/Linux/2015-08/121660.htm


IT145.com E-mail:sddin#qq.com