hacks/エラーメッセージ
2011年08月12日
動いてた物が動かなくなる
Amazon RDS用の運用スクリプトを書いていた時の出来事。 作業場所を移動して作業を再開したタイミングでエラーが出て動かなくなってしまった。 原因調査の旅の始まり。
エラーメッセージ
<ErrorResponse xmlns="http://rds.amazonaws.com/doc/2010-07-28/">
<Error>
<Type>Sender</Type>
<Code>RequestExpired</Code>
<Message>Request has expired. Timestamp date: 2011-08-12T02:28:49.000Z</Message>
</Error>
<RequestId>04efc58a-c48d-11e0-951b-dfc50e2855f7</RequestId>
</ErrorResponse>
検証環境
- Ubuntu 10.04.3 Server LTS
- right_aws 2.1.0
- ruby 1.8.7p249
- virtualbox 4.0.2 r72916
- windows 7 (32bit)
結論から述べれば、実行環境の時間がズレていた
スクリプトの動作的に問題はないはずだと思っていたので、時刻問題だと推測。 時刻を確認してみると、、およそ15分遅れていた。
$ sudo ntpdate -b time.nist.gov 12 Aug 11:45:43 ntpdate[8462]: step time server 192.43.244.18 offset 946.878185 sec
時刻を同期させあとは、スクリプトが期待する動きになった。
あと書き
単なる凡ミス。手元の開発環境だからと言う理由で時刻同期設定をサボっていた自分が悪い。
インプレスジャパン
売り上げランキング: 13026
2011年03月30日
PostgreSQLのインストールに失敗?
chrootを利用してVMイメージを作成している時、PostgreSQの環境が不十分である事に気付いた。 その内容は、コマンドの配置までは上手く行くが、設定ファイルとDBデータが構築されないと言う物。その為、postmasterが起動しない。どうにか問題を解決すべく、インストールスクリプトを追いかける旅が始まった。
原因調査の旅
▼検証環境
- Ubuntu 10.04.2 Server LTS
- postgresql 8.4.7-0ubuntu0.10.04
今回の問題は、/etc/postgresql/8.4/は/var/lib/postgresql/8.4/ が生成されていない事。そこで、/var/lib/postgresql/8.4/ を生成しているのはどこかを調査して行く。Debian系では/var/lib/dpkg/info/*.*inst を見れば検討が付く。
▼/var/lib/dpkg/info/postgresql-8.4.postinst
...省略...
19 . /usr/share/postgresql-common/maintscripts-functions
20
21 configure_version $VERSION "$2"
/usr/share/postgresql-common/maintscripts-functionsを読み込んでいる事が分かる。
▼/usr/share/postgresql-common/maintscripts-functions
17 # arguments:
18 configure_version() {
19 VERSION="$1"
20
21 # Create a main cluster for given version ($1) if no cluster already exists
22 # for that version and we are installing from scratch.
23 [ "$VERSION" ] || { echo "Error: configure_version: need version parameter" >&2; exit 1; }
24 if [ ! -d "/etc/postgresql/$VERSION" ] || [ -z "$(ls /etc/postgresql/$VERSION)" ] || \
25 [ -z "$(ls /etc/postgresql/$VERSION/*/postgresql.conf 2>/dev/null)" ]; then
26 [ "$2" ] || /usr/bin/pg_createcluster -u postgres $VERSION main || {
27 echo "Error: could not create default cluster. Please create it manually with
28
29 pg_createcluster $VERSION main --start
30
31 or a similar command (see 'man pg_createcluster')." >&2
32 }
33 fi
34
35 _link_manpages "$VERSION" "postgresql-$VERSION" postmaster.1.gz
36 }
29行目の「/usr/bin/pg_createcluster -u postgres $VERSION main」が該当するようだ。コマンドを実行してみる。
# /usr/bin/pg_createcluster -u postgres 8.4 main
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Error: The locale requested by the environment is invalid.
# echo $?
1
ロケールを要求しているようだ。ロケールを指定して再度実行してみる。
# export LC_ALL=C # /usr/bin/pg_createcluster -u postgres 8.4 main Creating new cluster (configuration: /etc/postgresql/8.4/main, data: /var/lib/postgresql/8.4/main)... Moving configuration file /var/lib/postgresql/8.4/main/postgresql.conf to /etc/postgresql/8.4/main... Moving configuration file /var/lib/postgresql/8.4/main/pg_hba.conf to /etc/postgresql/8.4/main... Moving configuration file /var/lib/postgresql/8.4/main/pg_ident.conf to /etc/postgresql/8.4/main... Configuring postgresql.conf to use port 5432... # echo $? 0
成功した。環境変数「LC_ALL」が良い影響を与えたのが分かる。
あらかじめ環境変数「LC_ALL」を設定しておけば、apt-get時でも/var/lib/postgresql/8.4/を生成してくれる事を確認した。
# export LC_ALL=C # apt-get install postgresql-8.4
あと書き
これ以降、自分のルールとして、chroot環境で作業をする際は「export LC_ALL=C」を実行するようにした。
2011年03月11日
[Puppet][エラーメッセージ] Exported resource File[/var/lib/puppet/modules/cluster/app/i-00000001] cannot override local resource on node $(puppet-agent-hostname)
エラーメッセージ
▼検証環境
- Ubuntu 10.04.2 Server LTS
- Puppet 2.6.4-2ubuntu1
- storeconfigs = true
- external_nodes = /etc/puppet/contrib/node_classifier
- node_terminus = exec
▼puppet agent実行結果
err: Could not retrieve catalog from remote server: Error 400 on SERVER: E xported resource File[/var/lib/puppet/modules/cluster/app/i-00000001] cannot override local resource on node $(puppet-agent-hostname)
原因と対応方法
▼背景
- 関連するインスタンスのIPアドレスを登録・収集する為、storeconfigsを利用
- IPアドレスを含んだファイルを、サーバ用途に応じたtagを指定してexport。DBであれば、tagにdbを指定。
@@file { "${NODESDIR}/cluster/app/${hostname}": ensure => present, content => "${ipaddress}\n", tag => "cluster::app", } - 依存するノードのIPアドレスを収集する為、tag指定でcollect
File <<| tag == "cluster::app" |>>
- IPアドレスを含んだファイルを、サーバ用途に応じたtagを指定してexport。DBであれば、tagにdbを指定。
- 次に挙げる状況を回避する為、puppet agent実行時の引数には「--fqdn サービスに紐づいた文字列」を指定していた。
- IaaS環境であり、インスタンスのUNIXホスト名が同じ
- UNIXホスト名が同一でも、処理させるマニフェストが異なる
$ puppet agent -v -d --test --fqdn サービスに紐づいた文字列
▼原因
- exportされたFileパス重複
- export時のFileパスが、agentの『${hostname}』で一意に決まる物だった。
- puppet agent実行するたびにfqdnが異なっており、fqdnに対するcollect結果のパスが既に存在していると、上書き出来ない。
▼対応方法
- puppet agent実行時のfqdnを統一
- サービスに紐づいた文字列生成は維持
あと書き
- 本来あるべきpuppetの使い方を超えてるが故にハマってしまったのだろう。
- 状況説明がとても難しい。
参考ページ
- Puppet errors explained
- Bug #5212: Exported facts are overriding local facts
- https://github.com/jordansissel/puppet/commit/3b4e72036e7ae9a2cfda781e24ee39648709f548
2011年02月13日
エラーメッセージ
▼検証環境
- Ubuntu-10.04 Server
- lp:nova Branched 515 revision(s)
▼前提条件
- OpenStackインストール先は「/home/openstack」であるものとする
- novaが起動しているものとする
▼screen window 3番(compute)の出力より
libvir: Domain Config error : internal error no supported architecture for os type 'hvm'
ERROR:root:Uncaught exception
Traceback (most recent call last):
File "/home/openstack/nova/nova/exception.py", line 83, in _wrap
return f(*args, **kw)
File "/home/openstack/nova/nova/virt/libvirt_conn.py", line 355, in spawn
self._conn.createXML(xml, 0)
File "/usr/lib/python2.6/dist-packages/libvirt.py", line 1289, in createXML
if ret is None:raise libvirtError('virDomainCreateXML() failed', conn=self)
libvirtError: internal error no supported architecture for os type 'hvm'
ERROR:root:instance instance-1308883741: Failed to spawn
Traceback (most recent call last):
File "/home/openstack/nova/nova/compute/manager.py", line 146, in run_instance
self.driver.spawn(instance_ref)
File "/home/openstack/nova/nova/exception.py", line 89, in _wrap
raise Error(str(e))
Error: internal error no supported architecture for os type 'hvm'
libvir: QEMU error : Domain not found: no domain with matching name 'instance-1308883741'
エラーメッセージからは推測し辛い内容なので困った。
原因と対応方法
▼原因
- 未対応ハイパーバイザを指定していた事
- 具体的には、kvm未対応環境でkvmを指定していた
▼対応方法
- nova起動時に、対応しているハイパーバイザを指定
あと書き
- 対応しているハイパーバイザをしっかり確認しておく事
- kvmの場合は、kvm-okコマンドで確認可能
2011年01月11日
エラーメッセージ
▼検証環境
- Ubuntu-10.04.1 Desktop
- lp:nova Branched 515 revision(s)
- lvm2 2.02.54-1ubuntu
▼user_smoketests.py実行結果
※screen window 6番(volume)の出力より
ERROR:root:Recovering from a failed execute.Try number 1
Traceback (most recent call last):
File "/home/openstack/nova/nova/volume/driver.py", line 70, in _try_execute
self._execute(command)
File "/home/openstack/nova/nova/utils.py", line 143, in execute
cmd=cmd)
ProcessExecutionError: Unexpected error while running command.
Command: sudo lvcreate -L 1G -n vol-wt8e25j9 nova-volumes
Exit code: 5
Stdout: ''
Stderr: ' Insufficient free extents (23) in volume group nova-volumes: 256 required\n'
DEBUG:root:Running cmd (subprocess): sudo lvcreate -L 1G -n vol-wt8e25j9 nova-volumes
DEBUG:root:Result was 5
ERROR:root:Recovering from a failed execute.Try number 2
Traceback (most recent call last):
File "/home/openstack/nova/nova/volume/driver.py", line 70, in _try_execute
self._execute(command)
File "/home/openstack/nova/nova/utils.py", line 143, in execute
cmd=cmd)
ProcessExecutionError: Unexpected error while running command.
Command: sudo lvcreate -L 1G -n vol-wt8e25j9 nova-volumes
Exit code: 5
Stdout: ''
Stderr: ' Insufficient free extents (23) in volume group nova-volumes: 256 required\n'
DEBUG:root:Running cmd (subprocess): sudo lvcreate -L 1G -n vol-wt8e25j9 nova-volumes
DEBUG:root:Result was 5
原因と対応方法
▼原因
- user_smoketestにおけるvolumeテストでは、LG名『nova-volumes』から1GbサイズのLVを作成する。
sudo lvcreate -L 1G -n vol-wt8e25j9 nova-volumes
- 本エラーでは、1Gbサイズを確保出来なくてエラー判定となった。
▼対応方法
- nova-volumesの空き容量を、1Gb以上にする
- 最小サイズでも8Gbサイズ程度の容量を用意しておくべきだろうか
あと書き
- 容量をケチったからこそ、稀なエラーケースに遭遇出来た
2011年01月05日
きっかけはnova(OpenStack)環境構築
▼検証環境
- Ubuntu 10.04.1 LTS Desktop
- USBメモリ
nova.sh installを実行したら、エラーが発生
lvm2が依存するinitramfs-toolsのインストールに失敗していた。
▼説明の為、lvm2の部分だけ再現。
$ sudo apt-get -y install lvm2
.....
Setting up watershed (5) ...
update-initramfs: deferring update (trigger activated)
gzip: /initrd.img.gz: No such file or directory
cp: cannot stat `/vmlinuz': No such file or directory
dpkg: error processing watershed (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of lvm2:
lvm2 depends on watershed (>= 2); however:
Package watershed is not configured yet.
dpkg: error processing lvm2 (--configure):
dependency problems - leaving unconfigured
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
No apport report written because the error message indicates its a followup error from a previous failure.
Processing triggers for initramfs-tools ...
update-initramfs: Generating /boot/initrd.img-2.6.32-24-generic
cp: cannot stat `/vmlinuz': No such file or directory
dpkg: error processing initramfs-tools (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
watershed
lvm2
initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)
/vmlinuzが無いと言われている。
一見、/vmlinuzが存在しているようにみえているが、実態はシンボリックリンク先。
つまり、シンボリックリンク元が存在しない訳だ。
$ ls -la /vmlinuz lrwxrwxrwx 1 root root 30 2010-08-16 10:07 /vmlinuz -> boot/vmlinuz-2.6.32-24-generic
解決策はシンボリックリンクを張り直す
$ sudo ln -sf /cdrom/casper/vmlinuz /vmlinuz $ ls -la /vmlinuz lrwxrwxrwx 1 root root 21 2011-01-05 07:47 /vmlinuz -> /cdrom/casper/vmlinuz
この手順に従えばinitramfs-toolsのインストールは成功する。
そして、novaのインストールにも成功するようになる。
目出度し。

