大訂正
CentOS だろうがなんだろうが一緒でした。結論としては以下のとおりです。
プロビジョニングのための準備がまだ整っていないので、しばらく(場合によっては10分近く)待つ必要がある(だけ)
例えば、ConoHa の CentOS の場合は以下のようにしばらく怒られ続けます。しかし辛抱強く待っているとプロビジョニングが始まります。
(省略) DEBUG : stdout | Loaded plugins: fastestmirror, langpacks DEBUG : stdout | Existing lock /var/run/yum.pid: another copy is running as pid 1178. DEBUG : stdout | Another app is currently holding the yum lock; waiting for it to exit... DEBUG : stdout | The other application is: yum DEBUG : stdout | Memory : 28 M RSS (424 MB VSZ) DEBUG : stdout | Started: Sun Jan 14 10:17:41 2018 - 01:19 ago DEBUG : stdout | State : Sleeping, pid: 1178 DEBUG : stdout | Another app is currently holding the yum lock; waiting for it to exit... DEBUG : stdout | The other application is: yum DEBUG : stdout | Memory : 28 M RSS (424 MB VSZ) DEBUG : stdout | Started: Sun Jan 14 10:17:41 2018 - 01:21 ago DEBUG : stdout | State : Sleeping, pid: 1178 DEBUG : stdout | Another app is currently holding the yum lock; waiting for it to exit... DEBUG : stdout | The other application is: yum DEBUG : stdout | Memory : 28 M RSS (424 MB VSZ) DEBUG : stdout | Started: Sun Jan 14 10:17:41 2018 - 01:23 ago DEBUG : stdout | State : Sleeping, pid: 1178 DEBUG : stdout | Another app is currently holding the yum lock; waiting for it to exit... DEBUG : stdout | The other application is: yum DEBUG : stdout | Memory : 28 M RSS (424 MB VSZ) DEBUG : stdout | Started: Sun Jan 14 10:17:41 2018 - 01:25 ago DEBUG : stdout | State : Sleeping, pid: 1178 DEBUG : stdout | Another app is currently holding the yum lock; waiting for it to exit... DEBUG : stdout | The other application is: yum DEBUG : stdout | Memory : 28 M RSS (424 MB VSZ) DEBUG : stdout | Started: Sun Jan 14 10:17:41 2018 - 01:27 ago DEBUG : stdout | State : Sleeping, pid: 1178 DEBUG : stdout | Another app is currently holding the yum lock; waiting for it to exit... DEBUG : stdout | The other application is: yum DEBUG : stdout | Memory : 28 M RSS (424 MB VSZ) DEBUG : stdout | Started: Sun Jan 14 10:17:41 2018 - 01:29 ago DEBUG : stdout | State : Sleeping, pid: 1178 DEBUG : stdout | Another app is currently holding the yum lock; waiting for it to exit... (省略)
vagrant-conoha の場合
vagrant-conoha で Ubuntu を建てようとした場合の話になります。
Ubuntu を作る場合の注意
これはなにも vagrant-conoha
に限った話ではないのですが、Vagrant で Ubuntu を建てようとすると以下のようなメッセージが出ることがあります。
==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 123.123.123.123:22 default: SSH username: root default: SSH auth method: private key default: Warning: Connection refused. Retrying... default: Warning: Remote connection disconnect. Retrying... default: Warning: Connection reset. Retrying... default: Warning: Remote connection disconnect. Retrying... default: Warning: Connection reset. Retrying... default: Warning: Remote connection disconnect. Retrying... default: Warning: Connection reset. Retrying... default: Warning: Remote connection disconnect. Retrying... default: Warning: Connection reset. Retrying... default: Warning: Remote connection disconnect. Retrying... default: Warning: Connection reset. Retrying... default: Warning: Remote connection disconnect. Retrying... default: Warning: Authentication failure. Retrying... ==> default: Machine booted and ready! ==> default: Rsyncing folder: /home/foobar/vagrant/ => /vagrant ==> default: Running provisioner: shell... default: Running: inline script ==> default: sudo: unable to resolve host 123-123-123-123 ==> default: E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable) ==> default: E: Unable to lock directory /var/lib/apt/lists/ ==> default: E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) ==> default: E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
unable to resolve host
とあることからも分かるように、これは /etc/hostname
の記述が誤っているのが原因です*1。具体的に /etc/hostname
の記述は以下のようになっています。
$ cat /etc/hostname 123-123-123-123
当然これを $ dig
なりしてもレコードは返ってきません。
なお、CentOS のイメージだと次のように返ってきます。この場合は config.vm.provision
は問題なく実行できます。
$ cat /etc/hostname 123-123-123-123.conoha.io
結論
Vagrant
は単に仮想マシンを建てるだけにとどめておき、プロビジョニングは Itamae
(など)を用いましょう。その方が「疎」ですしね。
*1:「誤っている」と断言するのもどうかとは思いますが