ドルヲタ系インフラエンジニア じーふーの備忘録

クラウドをメインに扱うインフラエンジニアが書くメモやら雑感、たまにドルヲタ的活動記録残します。最近の推しはAzureのData Factory(V2)です。

【Python / Ansible】 Ansible実行時、pycryptoのバージョンによりAttributeError

pycrypto(バージョン2.4以上)をインストールしている状態でansibleを実行すると、下記エラーが出るみたい?
pycrypto 2.3 をインストールすると正常に動作することを確認し、2.4、2.6.1(執筆時点での最新バージョン)インストール状態で動作確認した際はエラーとなりました。

[vagrant@vagrant-centos65 ~]$ ansible all -i 'localhost,' -c local -m ping
Traceback (most recent call last):
  File "/usr/bin/ansible", line 36, in <module>
    from ansible.runner import Runner
  File "/usr/lib/python2.6/site-packages/ansible/runner/__init__.py", line 62, in <module>
    from Crypto.Random import atfork
  File "/usr/lib64/python2.6/site-packages/Crypto/Random/__init__.py", line 29, in <module>
    from Crypto.Random import _UserFriendlyRNG
  File "/usr/lib64/python2.6/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 38, in <module>
    from Crypto.Random.Fortuna import FortunaAccumulator
  File "/usr/lib64/python2.6/site-packages/Crypto/Random/Fortuna/FortunaAccumulator.py", line 39, in <module>
    import FortunaGenerator
  File "/usr/lib64/python2.6/site-packages/Crypto/Random/Fortuna/FortunaGenerator.py", line 34, in <module>
    from Crypto.Util.number import ceil_shift, exact_log2, exact_div
  File "/usr/lib64/python2.6/site-packages/Crypto/Util/number.py", line 56, in <module>
    if _fastmath is not None and not _fastmath.HAVE_DECL_MPZ_POWM_SEC:
AttributeError: 'module' object has no attribute 'HAVE_DECL_MPZ_POWM_SEC'

追記(2015/04/30)

下記issue内にてエラー発生源の処理をコメントアウトする方法で対応した方もいましたので、そちらも紹介致します。
※紹介先サイトで対応した方も、正しい対応かはわからないけど...と言っていますので、こちらの対応が正かどうかは自信ありません。申し訳ございません
下記対応を入れた状態で、pycryptoのバージョンを2.4以上のものにアップデートして、正常に動作することを確認しました。

github.com

/usr/lib64/python2.6/site-packages/Crypto/Util/number.pyの下記処理(56~57行目)をコメントアウト

  55 # You need libgmp v5 or later to get mpz_powm_sec.  Warn if it's not available.
  56 if _fastmath is not None and not _fastmath.HAVE_DECL_MPZ_POWM_SEC:
  57     _warn("Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing a     ttack vulnerability.", PowmInsecureWarning)

  55 # You need libgmp v5 or later to get mpz_powm_sec.  Warn if it's not available.
  56 #if _fastmath is not None and not _fastmath.HAVE_DECL_MPZ_POWM_SEC:
  57 #    _warn("Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing a     ttack vulnerability.", PowmInsecureWarning)

追記ここまで


環境

  • CentOS 6.5(64bit)
  • ansible 1.9.0.1

実行ログ

[vagrant@vagrant-centos65 ~]$ sudo pip install pycrypto==2.6.1
Collecting pycrypto==2.6.1
/usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Using cached pycrypto-2.6.1.tar.gz
Installing collected packages: pycrypto
  Running setup.py install for pycrypto
Successfully installed pycrypto-2.6.1
[vagrant@vagrant-centos65 ~]$
[vagrant@vagrant-centos65 ~]$
[vagrant@vagrant-centos65 ~]$
[vagrant@vagrant-centos65 ~]$
[vagrant@vagrant-centos65 ~]$ ansible all -i 'localhost,' -c local -m ping
Traceback (most recent call last):
  File "/usr/bin/ansible", line 36, in <module>
    from ansible.runner import Runner
  File "/usr/lib/python2.6/site-packages/ansible/runner/__init__.py", line 62, in <module>
    from Crypto.Random import atfork
  File "/usr/lib64/python2.6/site-packages/Crypto/Random/__init__.py", line 29, in <module>
    from Crypto.Random import _UserFriendlyRNG
  File "/usr/lib64/python2.6/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 38, in <module>
    from Crypto.Random.Fortuna import FortunaAccumulator
  File "/usr/lib64/python2.6/site-packages/Crypto/Random/Fortuna/FortunaAccumulator.py", line 39, in <module>
    import FortunaGenerator
  File "/usr/lib64/python2.6/site-packages/Crypto/Random/Fortuna/FortunaGenerator.py", line 34, in <module>
    from Crypto.Util.number import ceil_shift, exact_log2, exact_div
  File "/usr/lib64/python2.6/site-packages/Crypto/Util/number.py", line 56, in <module>
    if _fastmath is not None and not _fastmath.HAVE_DECL_MPZ_POWM_SEC:
AttributeError: 'module' object has no attribute 'HAVE_DECL_MPZ_POWM_SEC'
[vagrant@vagrant-centos65 ~]$
[vagrant@vagrant-centos65 ~]$
[vagrant@vagrant-centos65 ~]$
[vagrant@vagrant-centos65 ~]$
[vagrant@vagrant-centos65 ~]$ sudo pip uninstall pycrypto

~省略~

[vagrant@vagrant-centos65 ~]$ sudo pip install pycrypto==2.4
Collecting pycrypto==2.4
/usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading pycrypto-2.4.tar.gz (382kB)
    100% |????????????????????????????????| 385kB 178kB/s
Installing collected packages: pycrypto
  Running setup.py install for pycrypto
Successfully installed pycrypto-2.4
[vagrant@vagrant-centos65 ~]$
[vagrant@vagrant-centos65 ~]$
[vagrant@vagrant-centos65 ~]$
[vagrant@vagrant-centos65 ~]$ ansible all -i 'localhost,' -c local -m ping
Traceback (most recent call last):
  File "/usr/bin/ansible", line 36, in <module>
    from ansible.runner import Runner
  File "/usr/lib/python2.6/site-packages/ansible/runner/__init__.py", line 62, in <module>
    from Crypto.Random import atfork
  File "/usr/lib64/python2.6/site-packages/Crypto/Random/__init__.py", line 29, in <module>
    from Crypto.Random import _UserFriendlyRNG
  File "/usr/lib64/python2.6/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 38, in <module>
    from Crypto.Random.Fortuna import FortunaAccumulator
  File "/usr/lib64/python2.6/site-packages/Crypto/Random/Fortuna/FortunaAccumulator.py", line 39, in <module>
    import FortunaGenerator
  File "/usr/lib64/python2.6/site-packages/Crypto/Random/Fortuna/FortunaGenerator.py", line 34, in <module>
    from Crypto.Util.number import ceil_shift, exact_log2, exact_div
  File "/usr/lib64/python2.6/site-packages/Crypto/Util/number.py", line 56, in <module>
    if _fastmath is not None and not _fastmath.HAVE_DECL_MPZ_POWM_SEC:
AttributeError: 'module' object has no attribute 'HAVE_DECL_MPZ_POWM_SEC'
[vagrant@vagrant-centos65 ~]$ sudo pip uninstall pycrypto

~省略~

[vagrant@vagrant-centos65 ~]$
[vagrant@vagrant-centos65 ~]$
[vagrant@vagrant-centos65 ~]$
[vagrant@vagrant-centos65 ~]$
[vagrant@vagrant-centos65 ~]$
[vagrant@vagrant-centos65 ~]$ sudo pip install pycrypto==2.3
Collecting pycrypto==2.3
  Using cached pycrypto-2.3.tar.gz
Installing collected packages: pycrypto
  Running setup.py install for pycrypto
Successfully installed pycrypto-2.3
[vagrant@vagrant-centos65 ~]$
[vagrant@vagrant-centos65 ~]$
[vagrant@vagrant-centos65 ~]$
[vagrant@vagrant-centos65 ~]$ ansible all -i 'localhost,' -c local -m ping
localhost | success >> {
    "changed": false,
    "ping": "pong"
}

[vagrant@vagrant-centos65 ~]$

【vagrant】 Vagrant up時に ゲストOSのGuest Additions moduleビルドに失敗する

vagrant up時にプラグインvagrant-vbguest」をインストールしておくと、ゲストOSのVirtualBox Guest Additionsのバージョンチェック&更新をしてくれる。
しかし、利用しているBoxイメージによってはkernelのversionが古いためにGuest Additions moduleのビルドに失敗する様子。

そのため、この状態では共有ディレクトリのマウントに失敗します。
対応方法をいろんな人が同じような記事を書いていますが自分もメモ。

環境

実行時のログ

C:\Users\hoge\03.development\201505_redmine>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'centos_6.5'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: 201505_redmine_default_1430182361123_21382
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
GuestAdditions versions on your host (4.3.26) and guest (4.3.6) do not match.
Loaded plugins: fastestmirror, versionlock
Determining fastest mirrors
 * base: ftp.nara.wide.ad.jp
 * epel: mirrors.vinahost.vn
 * extras: ftp.nara.wide.ad.jp
 * updates: ftp.nara.wide.ad.jp
http://mirrors.vinahost.vn/epel/6/x86_64/repodata/cfcca6b966c751e691f3d49fed9be85b67cda7962b4a9b20666ce98d640263ab-primary.sqlite.bz2: [Errno 12] Timeout on http://mirrors.vinahost.vn/epel/6/x86_64/re
podata/cfcca6b966c751e691f3d49fed9be85b67cda7962b4a9b20666ce98d640263ab-primary.sqlite.bz2: (28, 'Operation too slow. Less than 1 bytes/sec transfered the last 30 seconds')
Trying other mirror.
Setting up Install Process
No package kernel-devel-2.6.32-431.3.1.el6.x86_64 available.
Package 1:make-3.81-20.el6.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package gcc.x86_64 0:4.4.7-4.el6 will be updated
--> Processing Dependency: gcc = 4.4.7-4.el6 for package: gcc-gfortran-4.4.7-4.el6.x86_64
--> Processing Dependency: gcc = 4.4.7-4.el6 for package: gcc-c++-4.4.7-4.el6.x86_64
---> Package gcc.x86_64 0:4.4.7-11.el6 will be an update
--> Processing Dependency: libgomp = 4.4.7-11.el6 for package: gcc-4.4.7-11.el6.x86_64
--> Processing Dependency: cpp = 4.4.7-11.el6 for package: gcc-4.4.7-11.el6.x86_64
--> Processing Dependency: libgcc >= 4.4.7-11.el6 for package: gcc-4.4.7-11.el6.x86_64
---> Package perl.x86_64 4:5.10.1-136.el6 will be updated
--> Processing Dependency: perl = 4:5.10.1-136.el6 for package: 1:perl-Pod-Simple-3.13-136.el6.x86_64
--> Processing Dependency: perl = 4:5.10.1-136.el6 for package: 3:perl-version-0.77-136.el6.x86_64
--> Processing Dependency: perl = 4:5.10.1-136.el6 for package: 1:perl-Module-Pluggable-3.90-136.el6.x86_64
--> Processing Dependency: perl = 4:5.10.1-136.el6 for package: 1:perl-Pod-Escapes-1.04-136.el6.x86_64
--> Processing Dependency: perl = 4:5.10.1-136.el6 for package: 4:perl-libs-5.10.1-136.el6.x86_64
---> Package perl.x86_64 4:5.10.1-136.el6_6.1 will be an update
--> Running transaction check
---> Package cpp.x86_64 0:4.4.7-4.el6 will be updated
---> Package cpp.x86_64 0:4.4.7-11.el6 will be an update
---> Package gcc-c++.x86_64 0:4.4.7-4.el6 will be updated
---> Package gcc-c++.x86_64 0:4.4.7-11.el6 will be an update
--> Processing Dependency: libstdc++-devel = 4.4.7-11.el6 for package: gcc-c++-4.4.7-11.el6.x86_64
--> Processing Dependency: libstdc++ = 4.4.7-11.el6 for package: gcc-c++-4.4.7-11.el6.x86_64
---> Package gcc-gfortran.x86_64 0:4.4.7-4.el6 will be updated
---> Package gcc-gfortran.x86_64 0:4.4.7-11.el6 will be an update
--> Processing Dependency: libgfortran = 4.4.7-11.el6 for package: gcc-gfortran-4.4.7-11.el6.x86_64
---> Package libgcc.x86_64 0:4.4.7-4.el6 will be updated
---> Package libgcc.x86_64 0:4.4.7-11.el6 will be an update
---> Package libgomp.x86_64 0:4.4.7-4.el6 will be updated
---> Package libgomp.x86_64 0:4.4.7-11.el6 will be an update
---> Package perl-Module-Pluggable.x86_64 1:3.90-136.el6 will be updated
---> Package perl-Module-Pluggable.x86_64 1:3.90-136.el6_6.1 will be an update
---> Package perl-Pod-Escapes.x86_64 1:1.04-136.el6 will be updated
---> Package perl-Pod-Escapes.x86_64 1:1.04-136.el6_6.1 will be an update
---> Package perl-Pod-Simple.x86_64 1:3.13-136.el6 will be updated
---> Package perl-Pod-Simple.x86_64 1:3.13-136.el6_6.1 will be an update
---> Package perl-libs.x86_64 4:5.10.1-136.el6 will be updated
---> Package perl-libs.x86_64 4:5.10.1-136.el6_6.1 will be an update
---> Package perl-version.x86_64 3:0.77-136.el6 will be updated
---> Package perl-version.x86_64 3:0.77-136.el6_6.1 will be an update
--> Running transaction check
---> Package libgfortran.x86_64 0:4.4.7-4.el6 will be updated
---> Package libgfortran.x86_64 0:4.4.7-11.el6 will be an update
---> Package libstdc++.x86_64 0:4.4.7-4.el6 will be updated
---> Package libstdc++.x86_64 0:4.4.7-11.el6 will be an update
---> Package libstdc++-devel.x86_64 0:4.4.7-4.el6 will be updated
---> Package libstdc++-devel.x86_64 0:4.4.7-11.el6 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                  Arch      Version                    Repository  Size
================================================================================
Updating:
 gcc                      x86_64    4.4.7-11.el6               base        10 M
 perl                     x86_64    4:5.10.1-136.el6_6.1       updates     10 M
Updating for dependencies:
 cpp                      x86_64    4.4.7-11.el6               base       3.7 M
 gcc-c++                  x86_64    4.4.7-11.el6               base       4.7 M
 gcc-gfortran             x86_64    4.4.7-11.el6               base       4.7 M
 libgcc                   x86_64    4.4.7-11.el6               base       102 k
 libgfortran              x86_64    4.4.7-11.el6               base       267 k
 libgomp                  x86_64    4.4.7-11.el6               base       133 k
 libstdc++                x86_64    4.4.7-11.el6               base       294 k
 libstdc++-devel          x86_64    4.4.7-11.el6               base       1.6 M
 perl-Module-Pluggable    x86_64    1:3.90-136.el6_6.1         updates     40 k
 perl-Pod-Escapes         x86_64    1:1.04-136.el6_6.1         updates     32 k
 perl-Pod-Simple          x86_64    1:3.13-136.el6_6.1         updates    212 k
 perl-libs                x86_64    4:5.10.1-136.el6_6.1       updates    578 k
 perl-version             x86_64    3:0.77-136.el6_6.1         updates     51 k

Transaction Summary
================================================================================
Upgrade      15 Package(s)

Total download size: 37 M
Downloading Packages:
--------------------------------------------------------------------------------
Total                                           219 kB/s |  37 MB     02:51
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : libgcc-4.4.7-11.el6.x86_64                                  1/30
  Updating   : libstdc++-4.4.7-11.el6.x86_64                               2/30
  Updating   : libstdc++-devel-4.4.7-11.el6.x86_64                         3/30
  Updating   : 1:perl-Pod-Escapes-1.04-136.el6_6.1.x86_64                  4/30
  Updating   : 3:perl-version-0.77-136.el6_6.1.x86_64                      5/30
  Updating   : 4:perl-libs-5.10.1-136.el6_6.1.x86_64                       6/30
  Updating   : 1:perl-Module-Pluggable-3.90-136.el6_6.1.x86_64             7/30
  Updating   : 1:perl-Pod-Simple-3.13-136.el6_6.1.x86_64                   8/30
  Updating   : 4:perl-5.10.1-136.el6_6.1.x86_64                            9/30
  Updating   : cpp-4.4.7-11.el6.x86_64                                    10/30
  Updating   : libgfortran-4.4.7-11.el6.x86_64                            11/30
  Updating   : libgomp-4.4.7-11.el6.x86_64                                12/30
  Updating   : gcc-4.4.7-11.el6.x86_64                                    13/30
  Updating   : gcc-c++-4.4.7-11.el6.x86_64                                14/30
  Updating   : gcc-gfortran-4.4.7-11.el6.x86_64                           15/30
  Cleanup    : gcc-c++-4.4.7-4.el6.x86_64                                 16/30
  Cleanup    : gcc-gfortran-4.4.7-4.el6.x86_64                            17/30
  Cleanup    : libstdc++-devel-4.4.7-4.el6.x86_64                         18/30
  Cleanup    : 1:perl-Module-Pluggable-3.90-136.el6.x86_64                19/30
  Cleanup    : 1:perl-Pod-Simple-3.13-136.el6.x86_64                      20/30
  Cleanup    : 1:perl-Pod-Escapes-1.04-136.el6.x86_64                     21/30
  Cleanup    : 3:perl-version-0.77-136.el6.x86_64                         22/30
  Cleanup    : 4:perl-libs-5.10.1-136.el6.x86_64                          23/30
  Cleanup    : 4:perl-5.10.1-136.el6.x86_64                               24/30
  Cleanup    : gcc-4.4.7-4.el6.x86_64                                     25/30
  Cleanup    : libstdc++-4.4.7-4.el6.x86_64                               26/30
  Cleanup    : libgcc-4.4.7-4.el6.x86_64                                  27/30
  Cleanup    : cpp-4.4.7-4.el6.x86_64                                     28/30
  Cleanup    : libgomp-4.4.7-4.el6.x86_64                                 29/30
  Cleanup    : libgfortran-4.4.7-4.el6.x86_64                             30/30
  Verifying  : libstdc++-4.4.7-11.el6.x86_64                               1/30
  Verifying  : libgcc-4.4.7-11.el6.x86_64                                  2/30
  Verifying  : libstdc++-devel-4.4.7-11.el6.x86_64                         3/30
  Verifying  : 1:perl-Pod-Escapes-1.04-136.el6_6.1.x86_64                  4/30
  Verifying  : 3:perl-version-0.77-136.el6_6.1.x86_64                      5/30
  Verifying  : libgomp-4.4.7-11.el6.x86_64                                 6/30
  Verifying  : 4:perl-libs-5.10.1-136.el6_6.1.x86_64                       7/30
  Verifying  : gcc-c++-4.4.7-11.el6.x86_64                                 8/30
  Verifying  : 1:perl-Module-Pluggable-3.90-136.el6_6.1.x86_64             9/30
  Verifying  : 4:perl-5.10.1-136.el6_6.1.x86_64                           10/30
  Verifying  : gcc-4.4.7-11.el6.x86_64                                    11/30
  Verifying  : 1:perl-Pod-Simple-3.13-136.el6_6.1.x86_64                  12/30
  Verifying  : libgfortran-4.4.7-11.el6.x86_64                            13/30
  Verifying  : cpp-4.4.7-11.el6.x86_64                                    14/30
  Verifying  : gcc-gfortran-4.4.7-11.el6.x86_64                           15/30
  Verifying  : 1:perl-Module-Pluggable-3.90-136.el6.x86_64                16/30
  Verifying  : gcc-gfortran-4.4.7-4.el6.x86_64                            17/30
  Verifying  : 4:perl-5.10.1-136.el6.x86_64                               18/30
  Verifying  : libstdc++-4.4.7-4.el6.x86_64                               19/30
  Verifying  : libstdc++-devel-4.4.7-4.el6.x86_64                         20/30
  Verifying  : cpp-4.4.7-4.el6.x86_64                                     21/30
  Verifying  : 1:perl-Pod-Simple-3.13-136.el6.x86_64                      22/30
  Verifying  : libgfortran-4.4.7-4.el6.x86_64                             23/30
  Verifying  : gcc-c++-4.4.7-4.el6.x86_64                                 24/30
  Verifying  : libgomp-4.4.7-4.el6.x86_64                                 25/30
  Verifying  : gcc-4.4.7-4.el6.x86_64                                     26/30
  Verifying  : 3:perl-version-0.77-136.el6.x86_64                         27/30
  Verifying  : 1:perl-Pod-Escapes-1.04-136.el6.x86_64                     28/30
  Verifying  : 4:perl-libs-5.10.1-136.el6.x86_64                          29/30
  Verifying  : libgcc-4.4.7-4.el6.x86_64                                  30/30

Updated:
  gcc.x86_64 0:4.4.7-11.el6           perl.x86_64 4:5.10.1-136.el6_6.1

Dependency Updated:
  cpp.x86_64 0:4.4.7-11.el6
  gcc-c++.x86_64 0:4.4.7-11.el6
  gcc-gfortran.x86_64 0:4.4.7-11.el6
  libgcc.x86_64 0:4.4.7-11.el6
  libgfortran.x86_64 0:4.4.7-11.el6
  libgomp.x86_64 0:4.4.7-11.el6
  libstdc++.x86_64 0:4.4.7-11.el6
  libstdc++-devel.x86_64 0:4.4.7-11.el6
  perl-Module-Pluggable.x86_64 1:3.90-136.el6_6.1
  perl-Pod-Escapes.x86_64 1:1.04-136.el6_6.1
  perl-Pod-Simple.x86_64 1:3.13-136.el6_6.1
  perl-libs.x86_64 4:5.10.1-136.el6_6.1
  perl-version.x86_64 3:0.77-136.el6_6.1

Complete!
Copy iso file C:\Program Files/Oracle/VirtualBox/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
Installing Virtualbox Guest Additions 4.3.26 - guest version is 4.3.6
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.3.26 Guest Additions for Linux............
VirtualBox Guest Additions installer
Removing installed version 4.3.6 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox non-DKMS kernel modules[  OK  ]
Building the VirtualBox Guest Additions kernel modules
The headers for the current running kernel were not found. If the following
module compilation fails then this could be the reason.
The missing package can be probably installed with
yum install kernel-devel-2.6.32-431.3.1.el6.x86_64

Building the main Guest Additions module[FAILED]
(Look at /var/log/vboxadd-install.log to find out what went wrong)
Doing non-kernel setup of the Guest Additions[  OK  ]
Installing the Window System drivers
Could not find the X.Org or XFree86 Window System, skipping.
An error occurred during installation of VirtualBox Guest Additions 4.3.26. Some functionality may not work as intended.
In most cases it is OK that the "Window System drivers" installation failed.
Restarting VM to apply changes...
==> default: Attempting graceful shutdown of VM...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => C:/Users/keisuke.fujikawa/03.development/201505_redmine
Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:

mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant

The error output from the last command was:

/sbin/mount.vboxsf: mounting failed with the error: No such device

C:\Users\hoge\03.development\201505_redmine>

問題個所

The headers for the current running kernel were not found. If the following
module compilation fails then this could be the reason.
The missing package can be probably installed with
yum install kernel-devel-2.6.32-431.3.1.el6.x86_64

Building the main Guest Additions module[FAILED]
(Look at /var/log/vboxadd-install.log to find out what went wrong)

対策

ずばり、kernel-devel-2.6.32-431.3.1.el6.x86_64インストール

自分は下記サイトからrpm取得。

http://rpm.pbone.net/index.php3?stat=26&dist=43&size=9182560&name=kernel-devel-2.6.32-431.3.1.el6.x86_64.rpm

結果

C:\Users\hoge\03.development\201505_redmine>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
GuestAdditions versions on your host (4.3.26) and guest (4.3.6) do not match.
Loaded plugins: fastestmirror, versionlock
Loading mirror speeds from cached hostfile
 * base: ftp.nara.wide.ad.jp
 * epel: mirrors.vinahost.vn
 * extras: ftp.nara.wide.ad.jp
 * updates: ftp.nara.wide.ad.jp
Setting up Install Process
Package gcc-4.4.7-11.el6.x86_64 already installed and latest version
Package 1:make-3.81-20.el6.x86_64 already installed and latest version
Package 4:perl-5.10.1-136.el6_6.1.x86_64 already installed and latest version
Nothing to do
Copy iso file C:\Program Files/Oracle/VirtualBox/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
Installing Virtualbox Guest Additions 4.3.26 - guest version is 4.3.6
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.3.26 Guest Additions for Linux............
VirtualBox Guest Additions installer
Removing installed version 4.3.26 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox non-DKMS kernel modules[  OK  ]
Building the VirtualBox Guest Additions kernel modules
Building the main Guest Additions module[  OK  ]
Building the shared folder support module[  OK  ]
Building the OpenGL support module[  OK  ]
Doing non-kernel setup of the Guest Additions[  OK  ]
Starting the VirtualBox Guest Additions [  OK  ]
Installing the Window System drivers
Could not find the X.Org or XFree86 Window System, skipping.
An error occurred during installation of VirtualBox Guest Additions 4.3.26. Some functionality may not work as intended.
In most cases it is OK that the "Window System drivers" installation failed.
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => C:/Users/hoge/03.development/201505_redmine
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: to force provisioning. Provisioners marked to run always will still run.

C:\Users\hoge\03.development\201505_redmine>

【vmware】 1つの仮想マシンに設定できる仮想NIC数上限(vSphere5.5)

vSphere ESXi上の一つの仮想マシンに仮想NICはいくつ追加できるのか調べてみました。

環境

vSphere 5.5

上限

仮想NICの上限値は 10

公式ドキュメントを見ると 10^6と表記されていてると見間違えてしまったが、実際は注釈でしたので、最大10個まで仮想NICは設定できるみたいです。 http://www.vmware.com/files/jp/pdf/vsphere-55-configuration-maximums.pdf

【Oracle】 DBインスタンス起動時に予めバッファーキャッシュに指定テーブルの表データを格納するトリガー

概要

DBインスタンスを起動する際に、事前に指定テーブルの表データをバッファキャッシュに格納するためのトリガー設定
ヒント句を用いて対象テーブルをフルスキャンかけてキャッシュに読み込ませる。

トリガー

create or replace trigger "<schema>"."<trigger_name>" after
startup on database declare
cnt     number(10);

begin
                            
select /*+ full(<schema>.<table>) */ count(*) into cnt                                    
from <schema>.<table>                                   

end;
/

参考

Oracle Technology Network (OTN) Japan - 掲示板 : DBインスタンス起動時にDBBCへのデー ...

Oracle startup trigger tips

【Oracle】 RACバックグラウンドプロセス(11gR2)

RAC関連のバックグラウンドプロセス

  • RAC Background Processes
  • Lock Monitor Processes (LMON)
  • Lock Monitor Services (LMS)
  • Lock Monitor Daemon Process ( LMD)
  • LCKn ( Lock Process)
  • DIAG (Diagnostic Daemon)

OracleRAC関連の隠しパラメータによく_lm_hoge_fugaみたいに、lmから始まるものが多くて、lmって何の略だろうと思っていたが、Lock Monitorの略ってことでいいのかな?

参考

Oracle Real Application Clustersの概要

Oracle RAC Specific Processes

Oracle RAC Background Processes : Live Desk

【Oracle】 カーディナリティ・フィードバック(Cardinality Feedback)

同じSQLを実行しても同じ実行計画が選択されない場合がある。 そのような状況が発生している場合、11gR2より実装されたカーディナリティ・フィードバック機能(Cardinality Feedback)が影響している可能性がある。

カーディナリティ・フィードバック(Cardinality Feedback)

  • 実行計画を生成するCBOのインプット情報に実データのカーディナリティを加えることによって、より最適な実行計画を生成する機能
  • ハードパース時、統計情報と実データのカーディナリティにかい離がある場合、そのカーディナリティを記録し、その後実行される同一SQLの実行計画は、実データを加味して最適になるように変更される可能性がある

引用: http://www.oracle.com/technetwork/jp/ondemand/db-new/b-14-consulsql-1448421-ja.pdf

設定方法

※ 隠しパラメータは通常、「サポートセンターの指示なしでは設定すべきでない」パラメータですのでご注意ください
隠しパラメータ _optimizer_use_feedback をTRUEに設定する(デフォルト値はTRUE)

参考

http://dioncho.blogspot.jp/2009/12/oracle-11gr2cardinaliy-feedback.html