centos/6 on Vagrant

Vagrantにおいて表題のboxがいつの間にか存在していたようだ。

■ 環境

  • Vagrant 1.9.7
  • Mac OSX El Capitan

■ vagrant

以前は、公式のboxは7系しかないと思っていたのだが、現在は6系も公式で配布されているようだ。

Vagrant box centos/6 – Vagrant Cloud
https://app.vagrantup.com/centos/boxes/6

$ vagrant box add centos/6

一覧。

$ vagrant box list
bento/centos-6.7 (virtualbox, 2.2.7)
centos/6         (virtualbox, 1707.01)
centos/7         (virtualbox, 1707.01)
  :
$

今まではDownload数が多いboxを利用させてもらっていたのだが、今後6系を使う時はこれを使用するようにしていこう。

以上。

■ 関連

upgradeしたらエラー

upgradeしたらエラー

Vagrantにおいて表題の通り。

■ 環境

  • Vagrant 1.7.5, 1.7.7
  • Mac OSX El Capitan

■ vagrant

versionを確認したところ、新しいのが出ているようであった。

$ vagrant version
Installed Version: 1.9.5
Latest Version: 1.9.7

To upgrade to the latest version, visit the downloads page and
download and install the latest version of Vagrant from the URL
below:

  https://www.vagrantup.com/downloads.html

If you're curious what changed in the latest release, view the
CHANGELOG below:

  https://github.com/mitchellh/vagrant/blob/v1.9.7/CHANGELOG.md
$

upgradeした。再度versionを確認したところ下記のようであった。

$ vagrant version
Vagrant failed to initialize at a very early stage:

The plugins failed to initialize correctly. This may be due to manual
modifications made within the Vagrant home directory. Vagrant can
attempt to automatically correct this issue by running:

  vagrant plugin repair

If Vagrant was recently updated, this error may be due to incompatible
versions of dependencies. To fix this problem please remove and re-install
all plugins. Vagrant can attempt to do this automatically by running:

  vagrant plugin expunge --reinstall

Error message given during initialization: Unable to resolve dependency: user requested 'vagrant-vbguest (> 0)'
$

使用しているプラグイン”vagrant-vbguest“がどうやらダメだったようだ。出力されたメッセージにあるとおり実行してみる。

$ vagrant plugin repair
Repairing currently installed plugins. This may take a few minutes...
Fetching: vagrant-share-1.1.9.gem (100%)
Fetching: micromachine-2.0.0.gem (100%)
Fetching: vagrant-vbguest-0.14.2.gem (100%)
Installed plugins successfully repaired!
$

再度versionを確認。

$ vagrant version
Installed Version: 1.9.7
Latest Version: 1.9.7

You're running an up-to-date version of Vagrant!
$

これで問題ないであろう。

以上。

box update後にdestroyが必要って。。。

Vagrantにおいて単なる愚痴である。

■ 環境

  • Vagrant 1.9.5
  • Mac OSX El Capitan

■ vagrant up

とあるVMを久しぶりに起動したところ、下記メッセージが表示された。

$ vagrant up
  :
==> default: A newer version of the box 'ubuntu/xenial64' is available! You currently
==> default: have version '20170508.0.0'. The latest is version '20170610.0.0'. Run
==> default: `vagrant box update` to update.
  :
$

新しいBoxのversionがあるとのころで、せっかくなので`update`する。

$ vagrant box update

でも、この起動しているVMは以前のBoxのversionをそのまま使用する。当たり前といえば当たり前なのだが、だったらここで教える必要なくない?と思ってしまうのは自分だけであろうか…。

$ vagrant box list
  :
ubuntu/xenial64  (virtualbox, 20170508.0.0)
ubuntu/xenial64  (virtualbox, 20170610.0.0)
$
$ vagrant box remove ubuntu/xenial64 --box-version 20170508.0.0
Box 'ubuntu/xenial64' (v20170508.0.0) with provider 'virtualbox' appears
to still be in use by at least one Vagrant environment. Removing
the box could corrupt the environment. We recommend destroying
these environments first:

default (ID: a756f0d03c1341fbbfbc5XXXXXXXXXXX)

Are you sure you want to remove this box? [y/N] N
$

当たり前であるが`reload`してももちろん変わらない。今はまだこのVMを`destroy`したくないのでBoxのversionは古いままである。仕方がないのであろうか…。

以上。

Ubuntu@Vagrantにおけるubuntuユーザのパスワード

少々わかりづらいが、表題の通りである。Vagrantで起動しているUbuntu 16.04がある。`vagrant ssh`でログインされる”ubuntu“ユーザのパスワードを知りたい。

■ 環境

  • Ubuntu 16.04
  • Vagrant 1.9.4

■ Ubuntu

使用しているBoxは下記のものである。

$ vagrant box list
ubuntu/xenial64  (virtualbox, 20170331.0.0)
$

このBoxにおける”ubuntu“ユーザのパスワードについては下記のファイルに書かれていた。

$ cat ~/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-xenial64/20170331.0.0/virtualbox/Vagrantfile
# Front load the includes
include_vagrantfile = File.expand_path("../include/_Vagrantfile", __FILE__)
load include_vagrantfile if File.exist?(include_vagrantfile)

Vagrant.configure("2") do |config|
  config.vm.base_mac = "026F8338C1E5"
  config.ssh.username = "ubuntu"
  config.ssh.password = "e43b35d5be0112aeaa005902"

  config.vm.provider "virtualbox" do |vb|
     vb.customize [ "modifyvm", :id, "--uart1", "0x3F8", "4" ]
     vb.customize [ "modifyvm", :id, "--uartmode1", "file", File.join(Dir.pwd, "ubuntu-xenial-16.04-cloudimg-console.log") ]
  end
end
$

この”Vagrantfile“の”config.ssh.password“である。試しにこのパスワードを用いて`su`してみると下記のようになった。

$ vagrant ssh
Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-75-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

8 packages can be updated.
0 updates are security updates.


Last login: Thu May  11 19:17:14 2017 from 10.0.2.2
ubuntu@ubuntu-xenial:~$
ubuntu@ubuntu-xenial:~$ su - ubuntu
Password: e43b35d5be0112aeaa005902
ubuntu@ubuntu-xenial:~$

ちなみに先日のエントリでどのversionのBoxを使用しているか知りたかったのかは、今回のエントリの為である。

以上。

■ 関連

VagrantでVMが使用しているBoxのversion

VagrantでVMが使用しているBoxのversion

表題を知りたい。

■ 環境

  • Vagrant 1.9.4
  • Mac OSX El Capitan

■ vagrant box list

Boxは下記のように複数のversionをまだ持っている。

$ vagrant box list
bento/centos-6.7 (virtualbox, 2.2.7)
centos/7         (virtualbox, 1608.02)
ubuntu/trusty64  (virtualbox, 20170222.0.0)
ubuntu/trusty64  (virtualbox, 20170405.0.0)
ubuntu/xenial64  (virtualbox, 20170331.0.0)
ubuntu/xenial64  (virtualbox, 20170419.0.0)
$

現在稼動しているVMが”ubuntu/xenial64“を使用しているのであるが、どちらのversionのBoxを利用しているのかを知りたい。何か良い手段はないものだろうか?とコマンドを探るも得られそうなコマンドがない。下記のように`suspend`->`up`としてみた。

$ vagrant suspend
==> default: Saving VM state and suspending execution...
$
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/xenial64' is up to date...
==> default: A newer version of the box 'ubuntu/xenial64' is available! You currently
==> default: have version '20170419.0.0'. The latest is version '20170508.0.0'. Run
==> default: `vagrant box update` to update.
==> default: Resuming suspended 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: ubuntu
    default: SSH auth method: password
==> default: Machine booted and ready!
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
$

現在ローカルにある最新のversionは”20170419.0.0“で、最新の”20170508.0.0“がリリースされているよと教えてくれているようであるが、確かにローカルの最新は”20170419.0.0“ではあるのだが実際に稼動しているVMが使用しているBoxは”20170331.0.0“であるようだ…。というのも下記を実行した時のメッセージによる。

$ vagrant box prune
The following boxes will be kept...
bento/centos-6.7 (virtualbox, 2.2.7)
centos/7         (virtualbox, 1608.02)
ubuntu/trusty64  (virtualbox, 20170405.0.0)
ubuntu/xenial64  (virtualbox, 20170508.0.0)

Checking for older boxes...

Box 'ubuntu/xenial64' (v20170331.0.0) with provider 'virtualbox' appears
to still be in use by at least one Vagrant environment. Removing
the box could corrupt the environment. We recommend destroying
these environments first:

default (ID: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX)

Are you sure you want to remove this box? [y/N] N
Removing box 'ubuntu/xenial64' (v20170419.0.0) with provider 'virtualbox'...
$

この表記によると、現在はまだ”v20170331.0.0“で動いているからこいつを先に停止してからにしろよ、と理解した。しかし現時点ではまだ`destroy`したくはないVMである。`vagrant reload`を実行しても変化はなかった。作り直すのが手っ取り早いのであろう…。VMであるからそれは当然といえば当然なのだが…さてどうしたものか。

というわけで本題のBoxのversionを知りたいのだが、まだ解決できずである。

VMのあるディレクトリ配下の下記ファイルを確認したがパッと見ではよくわからない。

$ ls -1 .vagrant/machines/default/virtualbox/
action_provision
action_set_name
creator_uid
id
index_uuid
private_key
synced_folders
$

今後に持ち越しである。

以上。

■ 関連

VagrantのBOXをupdate

Ubuntu@Vagrantにおけるubuntuユーザのパスワード