vagrant 2.1.2 アップグレード後にプラグインが更新できない場合の対処法
環境
OS:macOS Hige Sierra
vagrant:2.1.2
問題
vagrantを2.1.2に、アップグレードして、vagrant statusすると何やらメッセージが表示された
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
Or you may want to try updating the installed plugins to their latest
versions:
vagrant plugin update
Error message given during initialization: Unable to resolve dependency: user requested 'vagrant-s3auth (> 0)'
Vagrantfileには、プラグインのインストールを行う様に定義してあって
#
# https://github.com/WhoopInc/vagrant-s3auth#auto-install
#
unless Vagrant.has_plugin?('vagrant-s3auth')
# Attempt to install ourself. Bail out on failure so we don't get stuck in an
# infinite loop.
system('vagrant plugin install vagrant-s3auth') || exit!
# Relaunch Vagrant so the plugin is detected. Exit with the same status code.
exit system('vagrant', *ARGV)
end
メッセージの通り 「vagrant plugin repair」や「vagrant plugin update」してみるものの
エラーが出てしまう
$ vagrant plugin repair
Exec error: fork/exec /opt/vagrant/embedded/bin/ruby: argument list too long
$ vagrant plugin update
Exec error: fork/exec /opt/vagrant/embedded/bin/ruby: argument list too long
エラーメッセージでググってみると検索ヒット
https://github.com/hashicorp/vagrant/issues/9972#issuecomment-408274948
どうやらsystem関数の引数が増えた様です。
「:chdir=>"/tmp"」を追加して
#
# https://github.com/WhoopInc/vagrant-s3auth#auto-install
#
unless Vagrant.has_plugin?('vagrant-s3auth')
# Attempt to install ourself. Bail out on failure so we don't get stuck in an
# infinite loop.
system('vagrant plugin install vagrant-s3auth', :chdir=>"/tmp") || exit!
# Relaunch Vagrant so the plugin is detected. Exit with the same status code.
exit system('vagrant', *ARGV)
end
再度「vagrant plugin update」すると無事成功
$ vagrant plugin update
Installing the 'vagrant-s3auth' plugin. This can take a few minutes...
Fetching: jmespath-1.4.0.gem (100%)
Fetching: aws-sigv4-1.0.3.gem (100%)
Fetching: aws-sdk-core-2.6.50.gem (100%)
Fetching: aws-sdk-resources-2.6.50.gem (100%)
Fetching: aws-sdk-2.6.50.gem (100%)
Fetching: vagrant-s3auth-1.3.2.gem (100%)
Fetching: micromachine-2.0.0.gem (100%)
Fetching: vagrant-vbguest-0.15.2.gem (100%)
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:
Unable to resolve dependency: user requested 'vagrant-vbguest (= 0.14.2)'
「vagrant up」すると、フォルダ共有の部分でも何やらメッセージ出ますがこれは別の問題でエラーではなさそうです。
Vagrant is currently configured to create VirtualBox synced folders with
the `SharedFoldersEnableSymlinksCreate` option enabled. If the Vagrant
guest is not trusted, you may want to disable this option. For more
information on this option, please refer to the VirtualBox manual:
https://www.virtualbox.org/manual/ch04.html#sharedfolders
This option can be disabled globally with an environment variable:
VAGRANT_DISABLE_VBOXSYMLINKCREATE=1
or on a per folder basis within the Vagrantfile:
config.vm.synced_folder '/host/path', '/guest/path', SharedFoldersEnableSymlinksCreate: false
synced_folderのデフォルトの共有を停止する部分が、変わった様です。
# 旧
config.vm.synced_folder '.', '/vagrant', disabled: true
# 新
config.vm.synced_folder '.', '/vagrant', disabled: true, SharedFoldersEnableSymlinksCreate: false
以上、回避方法でした〜。