Memo

メモ > サーバ > 各論: Vagrant > トラブル

■トラブル
■起動しようとすると「vagrant No usable default provider could be found for your system.」と表示される VirtualBoxやVMWareなどの仮想環境ソフトウェアを先にインストールする ■Oracle VM VirtualBox を起動できない Oracle VM VirtualBox をダブルクリックで起動しても以下のダイアログが表示されて起動できない
[Window Title] プログラム互換性アシスタント [Main Instruction] このアプリはこのデバイスで実行できません [詳細情報] [閉じる(C)]
「詳細情報」をクリックすると以下に遷移する Download_Old_Builds_5_2 - Oracle VM VirtualBox https://www.virtualbox.org/wiki/Download_Old_Builds_5_2 Vagrant、VirtualBox をアンインストールし、それぞれ最新版をインストールする ■起動しようとすると「The virtual machine 'XXXXX' has terminated unexpectedly」のようなエラーになる
>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 (guest) => 2222 (host) (adapter 1) ==> default: Booting VM... There was an error while executing `VBoxManage`, a CLI used by Vagrant for controlling VirtualBox. The command and stderr is shown below. Command: ["startvm", "be217c1e-0540-4fcb-8fb9-32b12b5cd567", "--type", "headless"] Stderr: VBoxManage.exe: error: The virtual machine 'centos6_default_1469071051278_3326' has terminated unexpectedly during startup with exit code -1073741819 (0xc0000005) VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component MachineWrap, interface IMachine
VirtualBoxが開けなくなったら http://yuttariblog.blogspot.jp/2014/07/virtualbox.html Windowsアップデートの影響で動かなくなることがあるらしいが、最新版にすれば動作するらしい Windowsコントロールパネルの「プログラムのアンインストール」から 「Oracle VM VirtualBox 5.0.20」 「vagrant」 をアンインストールし、その時点での最新版の 「VirtualBox-5.1.22-115126-Win.exe」 「vagrant_1.9.5.msi」 をインストールすれば起動するようになった 以前作成した設定や構築したサーバは、そのまま残っていた 2017年12月4日、大きなWindowsアップデートを適用すると起動しなくなった。その時点での 「VirtualBox-5.2.2-119230-Win.exe」 「vagrant_2.0.1_x86_64.msi」 をインストールしなおせば起動するようになった 環境によっては上記の組み合わせでも起動しなかったが 「VirtualBox-5.1.30-118389-Win.exe」 「vagrant_2.0.1_x86_64.msi」 をインストールしなおせば起動するようになった 「とりあえずは最新(5.2)のVirtualBoxと、それにあったVagrantで試す。駄目なら5.1内で最新のVirtualBoxと、それにあったVagrantで試す」 なら、割となんとかなる。ということかもしれない ■起動しようとすると「Vagrant failed to initialize at a very early stage」のようなエラーになる
>vagrant up 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: No such file or directory @ rb_sysopen - C:/Users/refirio/.vagrant.d/gems/2.6.6/gems/micromachine-3.0.0/micromachine.gemspec
Windowsアップデートの直後に起動しなくなった VirtualBoxとVagrantをインストールしなおしても、相変わらず同じエラーになる エラーメッセージ内に
C:/HashiCorp/Vagrant/embedded/gems/2.2.14/gems/vagrant-2.2.14/lib/vagrant/bundler.rb:725:in `write': No such file or directory @ rb_sysopen - C:/Users/refirio/.vagrant.d/gems/2.6.6/gems/micromachine-3.0.0/micromachine.gemspec (Errno::ENOENT) C:/HashiCorp/Vagrant/embedded/gems/2.2.14/gems/vagrant-2.2.14/lib/vagrant/bundler.rb:725:in `write': No such file or directory @ rb_sysopen - C:/Users/refirio/.vagrant.d/gems/2.6.6/gems/vagrant-vbguest-0.24.0/vagrant-vbguest.gemspec (Errno::ENOENT) C:/HashiCorp/Vagrant/embedded/gems/2.2.14/gems/vagrant-2.2.14/lib/vagrant/bundler.rb:725:in `write': No such file or directory @ rb_sysopen - C:/Users/refirio/.vagrant.d/gems/2.6.6/gems/vagrant-vbguest-0.28.0/vagrant-vbguest.gemspec (Errno::ENOENT)
とあるので、
C:/Users/refirio/.vagrant.d/gems/2.6.6/gems/micromachine-3.0.0/micromachine.gemspec C:/Users/refirio/.vagrant.d/gems/2.6.6/gems/vagrant-vbguest-0.24.0/vagrant-vbguest.gemspec C:/Users/refirio/.vagrant.d/gems/2.6.6/gems/vagrant-vbguest-0.28.0/vagrant-vbguest.gemspec
にカラのファイルを作成した (「micromachine-3.0.0」の対応をすると、新たに他のものが表示されたので順次対応した) これで
>vagrant plugin update Updating installed plugins... Successfully uninstalled micromachine-3.0.0 Successfully uninstalled vagrant-vbguest-0.24.0 Successfully uninstalled vagrant-vbguest-0.28.0 All plugins are up to date.
を実行すると、プラグインがアンインストールされた? (場合によっては、コマンドプロンプトを管理者権限で実行する必要があるかもしれない) この後さらに
>vagrant plugin repair >vagrant plugin expunge --reinstall >vagrant plugin update
を実行すると、今度はエラーなく完了できた その後
>vagrant up
を実行すると 「Stderr: VBoxManage.exe: error: Failed to open/create the internal network」 のようなエラーになったが、後述の「ネットワークと共有センター」からの作業を行った その後
>vagrant up
を実行すると 「Vagrant was unable to mount VirtualBox shared folders.」 のようなエラーになったが、後述のマウントエラー対策の作業を行った これで起動できるようになった ■起動しようとすると「Stderr: VBoxManage.exe: error: Failed to open/create the internal network」のようなエラーになる
>vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Importing base box 'centos/7'... ==> default: Matching MAC address for NAT networking... ==> default: Setting the name of the VM: centos7_default_1608985428243_21755 ==> 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: 80 (guest) => 8080 (host) (adapter 1) default: 22 (guest) => 2222 (host) (adapter 1) ==> default: Booting VM... There was an error while executing `VBoxManage`, a CLI used by Vagrant for controlling VirtualBox. The command and stderr is shown below. Command: ["startvm", "e1e1054e-897d-40e3-bd76-97cb2e7868a9", "--type", "headless"] Stderr: VBoxManage.exe: error: Failed to open/create the internal network 'HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter #2' (VERR_INTNET_FLT_IF_NOT_FOUND). VBoxManage.exe: error: Failed to attach the network LUN (VERR_INTNET_FLT_IF_NOT_FOUND) VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole
以下が参考になる VirtualBox で Failed to open/create the internal network 'HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter' が出た時の対処 - Qiita https://qiita.com/ExA_DEV/items/ae80a7d767144c2e1992 上記のとおり、 1. "ネットワークと共有センター" を開く 2. "アダプターの設定の変更" を開く 3. "VirtualBox Host-Only Network #N" のプロパティを開く 4. "VirtualBox NDIS6 Bridged Networking Driver" にチェックを入れる 5. "インターネットプロトコル バージョン6(TCP/IPv6)" のチェックを外す 6. [OK] を押し、プロパティウィンドウを閉じる 7. "VirtualBox Host-Only Network #N" の右クリックメニューで「無効」にする 8. 再度、「有効」にし直す の操作を行うと起動できるようになった 以前に作成した環境も、問題なく起動できるようになった ■起動しようとすると「default: SSH auth method: private key」で止まり、その後「Timed out while waiting for the machine to boot」となる 「VirtualBox-5.2.0-118431-Win.exe」 「vagrant_2.0.1_x86_64.msi」 で発生した 別環境で起動を確認できた 「VirtualBox-5.1.22-115126-Win.exe」 「vagrant_1.9.5.msi」 にバージョンダウンしてみると起動できた VagrantとVirtualBox(もしくはWindowsとVirtualBox?)のバージョンで相性があるようで、マイナーバージョンにすると起動することがある Windows - Vagrantup時に、SSH auth method: private keyでタイムアウトになる(99629)|teratail https://teratail.com/questions/99629 以下は直接の解決では無かったが、参考までに "vagrant up"したら"SSH auth method: private key"で止まった話 - Qiita https://qiita.com/sasurai_usagi3/items/2ba572013b16f2703f6a Vagrant UP時にSSH auth method: private key・・・で詰まった話 - Qiita https://qiita.com/is_ryo/items/d67d29fc56cf3cd07199 問題なく使えていたが、大きなWindowsアップデートを行った後に 「The virtual machine 'XXXXX' has terminated unexpectedly」 のようなエラーになって起動しなくなった。上に記載したように、VirtualBoxとVagrantを最新版にすると起動するようになった 作成済みのBoxを破棄して、再度一から構築すると起動したこともある ■起動しようとすると「Vagrant was unable to mount VirtualBox shared folders.」のようなエラーになる 仮想マシンを起動しようとすると以下のエラーが表示された
==> default: Mounting shared folders... default: /vagrant => C:/vagrant/centos7_test Vagrant was unable to mount VirtualBox shared folders. This is usually because the filesystem "vboxsf" is not available. This filesystem is made available via the VirtualBox Guest Additions and kernel module. Please verify that these guest additions are properly installed in the guest. This is not a bug in Vagrant and is usually caused by a faulty Vagrant box. For context, the command attempted was: mount -t vboxsf -o uid=1000,gid=1000 vagrant /vagrant The error output from the command was: /sbin/mount.vboxsf: mounting failed with the error: No such device
Vagrantでマウントエラーが発生したときの解消方法 - Qiita https://qiita.com/chubura/items/4166585cf3f44e33271d Vagrantで共有フォルダのマウントに失敗するときの対処方法 - Qiita https://qiita.com/ozawan/items/9751dcfd9bd4c470cd82 「ホスト⇔ゲスト間のフォルダ共有機能はGuest Additionsが提供していますが ホスト(VirtualBox)とゲスト(Guest Additions)でバージョン不一致があるとマウントエラーが起きるようです。」 とのこと ミドルウェアをインストールした際にカーネルが一部更新された可能性があり、 つまりは「Guest Additions」というソフトウェアを更新する必要がある。場合によってはカーネルも更新する必要がある vagrant up時に自動的に新しいバージョンのGuest Additionsに更新してくれる「vagrant-vbguest」というプラグインがある Vagrant の Box の Guest Additions を最新化する方法 | https://weblabo.oscasierra.net/vagrant-vbguest-plugin-1/
>vagrant plugin install vagrant-vbguest Installing the 'vagrant-vbguest' plugin. This can take a few minutes... Fetching: vagrant-share-1.1.9.gem (100%) Fetching: micromachine-2.0.0.gem (100%) Fetching: vagrant-vbguest-0.18.0.gem (100%) Installed the plugin 'vagrant-vbguest (0.18.0)'!
その後、仮想マシンを停止&起動すればフォルダ同期もできた
>vagrant halt ==> default: Attempting graceful shutdown of VM... >vagrant up ==> default: Mounting shared folders... default: /vagrant => C:/vagrant/refirio_net default: /var/www/html/test => C:/localhost/home/refirio_net/public_html/test ==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision` ==> default: flag to force provisioning. Provisioners marked to run always will still run.
これでも駄目な場合、いったん立ち上げたサーバにSSHで接続して
>vagrant ssh
サーバ内で以下を実行し、
$ sudo yum install -y kernel kernel-devel gcc
以下のように、サーバから抜けてVagrantを再起動すると大丈夫だった (「vagrant-vbguest」プラグインを導入済みの環境なら、この操作のみで良さそう)
$ exit >vagrant reload
Vagrant was unable to mount VirtualBox shared folders.でvagrantでフォルダがマウント出来ない - Qiita https://qiita.com/pnpk/items/2c4e976cda20610e7096 【Vagrant】 VirtualBoxのGuestAdditionsを自動で更新する - takafumi blog http://takafumi-s.hatenablog.com/entry/2016/01/03/172840 複数のサーバを一度に立ち上げる場合、 Vagrantfile に1台目だけの設定を記載した上で起動して1台目に上記の対応を行い、 Vagrantfile 1台目と2台目の設定を記載した上で起動して1台目と2台目に上記の対応を行い、 Vagrantfile 1台目と2台目と3台目の設定を記載した上で起動して1台目と2台目と3台目に上記の対応を行い …とすれば大丈夫だった Box自体のバージョンアップが必要なのかも(未検証) ■起動しようとすると「No Virtualbox Guest Additions installation found.」「umount: /mnt: not mounted」のようなエラーになる 仮想マシンを起動しようとすると以下のエラーが表示された 「Vagrant was unable to mount VirtualBox shared folders.」と同じ方法で対処できる可能性がある
==> default: Machine booted and ready! [default] No Virtualbox Guest Additions installation found. Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp-srv2.kddilabs.jp * extras: ftp-srv2.kddilabs.jp * updates: ftp-srv2.kddilabs.jp Package centos-release-7-9.2009.0.el7.centos.x86_64 already installed and latest version Nothing to do Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp-srv2.kddilabs.jp * extras: ftp-srv2.kddilabs.jp * updates: ftp-srv2.kddilabs.jp No package kernel-devel-3.10.0-1127.el7.x86_64 available. Error: Nothing to do Unmounting Virtualbox Guest Additions ISO from: /mnt umount: /mnt: not mounted ==> default: Checking for guest additions in VM... default: No guest additions were detected on the base box for this VM! Guest default: additions are required for forwarded ports, shared folders, host only default: networking, and more. If SSH fails on this machine, please install default: the guest additions and repackage the box to continue. default: default: This is not an error message; everything may continue to work properly, default: in which case you may ignore this message. The following SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed! umount /mnt Stdout from the command: Stderr from the command: umount: /mnt: not mounted
■起動しようとすると「[default] GuestAdditions versions on your host (5.1.22) and guest (4.3.6) do not match.」のようなエラーになる /vagrantのマウントに失敗 - その2 | technote http://tech.withsin.net/2017/04/17/vagrant-mount-failed/ ■フォルダ同期の設定を行ったらエラーになる 仮想マシンを起動しようとすると以下のエラーが表示された
==> default: Mounting shared folders... default: /vagrant => C:/vagrant/refirio_net 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
サーバ自体は起動しているのでSSHで接続し、vboxをリビルドする vagrantでmountエラーの解決方法 http://qiita.com/osamu1203/items/10e19c74c912d303ca0b
$ sudo /etc/init.d/vboxadd setup 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 [FAILED] (Look at /var/log/vboxadd-install.log to find out what went wrong) Doing non-kernel setup of the Guest Additions [ OK ]
その後、仮想マシンを停止&起動すればフォルダ同期もできた
>vagrant halt ==> default: Attempting graceful shutdown of VM... >vagrant up ==> default: Mounting shared folders... default: /vagrant => C:/vagrant/refirio_net default: /var/www/html/test => C:/localhost/home/refirio_net/public_html/test ==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision` ==> default: flag to force provisioning. Provisioners marked to run always will still run.
■起動しようとすると「flag to force provisioning. Provisioners marked to run always will still run.」と表示されるがブラウザでアクセスできない
>vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Clearing any previously set forwarded ports... ==> default: Vagrant has detected a configuration issue which exposes a ==> default: vulnerability with the installed version of VirtualBox. The ==> default: current guest is configured to use an E1000 NIC type for a ==> default: network adapter which is vulnerable in this version of VirtualBox. ==> default: Ensure the guest is trusted to use this configuration or update ==> default: the NIC type using one of the methods below: ==> default: ==> default: https://www.vagrantup.com/docs/virtualbox/configuration.html#default-nic-type ==> default: https://www.vagrantup.com/docs/virtualbox/networking.html#virtualbox-nic-type ==> 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: 80 (guest) => 8080 (host) (adapter 1) default: 22 (guest) => 2222 (host) (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: Machine booted and ready! [default] GuestAdditions 5.2.2 running --- OK. ==> default: Checking for guest additions in VM... ==> default: Configuring and enabling network interfaces... ==> default: Rsyncing folder: /cygdrive/c/Users/refirio/Vagrant/refirio_net/ => /vagrant ==> default: Mounting shared folders... default: /var/www => C:/Users/refirio/Vagrant/refirio_net/code ==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision` ==> default: flag to force provisioning. Provisioners marked to run always will still run.
SSHで接続し、Apacheが起動できているかを確認する。後述の「Apacheを自動起動できない」も参照 また、「フォルダ同期の設定を行ったらエラーになる」と同様、以下で起動できたことがあった
>vagrant plugin install vagrant-vbguest >vagrant halt >vagrant up
■起動しようとすると「Path: C:/Users/Refirio/.vagrant.d/data/machine-index/index」と表示される 停電から復旧後、仮想マシンを起動しようとすると以下のエラーが表示された
C:\vagrant\homestead\Homestead>vagrant up The machine index which stores all required information about running Vagrant environments has become corrupt. This is usually caused by external tampering of the Vagrant data folder. Vagrant cannot manage any Vagrant environments if the index is corrupt. Please attempt to manually correct it. If you are unable to manually correct it, then remove the data file at the path below. This will leave all existing Vagrant environments "orphaned" and they'll have to be destroyed manually. Path: C:/Users/Refirio/.vagrant.d/data/machine-index/index
強制終了によりロックファイルが残っている 案内されているように、以下のフォルダ内にあるファイルを削除すれば起動できるようになった C:\Users\Refirio\.vagrant.d\data\machine-index vagrant up実行で,SYSTEM_SERVICE_EXCEPTIONでブルースクリーンになる時 http://nanoappli.com/blog/archives/8114 さらに連続して何度か停電にあった後、起動時に以下のようなエラーが大量に表示されるようになった PC自体を再起動しても表示される VagrantというよりHomesteadに異常が発生していると思われるが要調査
==> homestead-7: Mounting shared folders... homestead-7: /vagrant => C:/localhost/home/asims2/public_html/Homestead homestead-7: /home/vagrant/code => C:/localhost/home/refirio_net/public_html/code C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.4.0/json/common.rb:156:in `parse': 751: unexpected token at '' (JSON::ParserError) from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.4.0/json/common.rb:156:in `parse' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.1/lib/vagrant/action/builtin/mixin_synced_folders.rb:236:in `cached_synced_folders'
■起動しようとすると「default: Warning: Authentication failure. Retrying...」と表示される vagrant upコマンド実行時にAuthentication failure.エラーが発生する - Qiita https://qiita.com/shyse/items/9ec50b868b90f847c75f 上記ページより、以下の原因により鍵認証ができなくなることがあるらしい 鍵を配置し直すことで対応はできるらしい(未検証)
Vagrant 1.7 以降では、vagrant up 時に旧来の insecure_key を検知した場合、 その仮想マシン用の別の鍵ペアを生成して insecure_key を置き換える。 生成した秘密鍵は .vagrant/machines/default/virtualbox/private_key に置かれ、 それ以降そのマシンへのアクセスは新しい鍵が使われるようになり、insecure_key での SSH はできなくなる。
■起動しようとすると「The guest machine entered an invalid state while waiting for it to boot.」と表示される 以下を実行すると起動できた
>vagrant plugin update >vagrant plugin install vagrant-vbguest >vagrant halt >vagrant up
【Vagrant】非常に稀なVagrantの問題が発生した際の解決方法(のうちの一つ) - Qiita https://qiita.com/sola-msr/items/604614353e678f7d2d08 ■起動しようとすると「There was an error when attempting to rsync a synced folder.」と表示される Cygwinとの兼ね合いで正しく起動できないことがあるみたい Vagrantfileの
config.vm.synced_folder "./code", "/var/www"
この部分を以下のように変更すれば起動できた もしくはこの編集なしに、Windowsを再起動することで対応できるかもしれないが未確認
config.vm.synced_folder "./", "/vagrant", type: "virtualbox" config.vm.synced_folder "./code", "/var/www", create: true, type: "virtualbox" config.winnfsd.uid=1 config.winnfsd.gid=1
Windows10+Vagrant+VirtualBoxでrsyncが失敗する - forget for get https://lightwill.hatenablog.com/entry/2018/03/01/010040 ■起動しようとすると「Which interface should the network bridge to?」で止まる 過去何度か普通に起動していた環境だが、突然以下で止まるようになった
C:\vagrant\development>vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Clearing any previously set network interfaces... ==> default: Available bridged network interfaces: 1) Realtek PCIe GBE Family Controller 2) Qualcomm QCA9565 802.11b/g/n Wireless Adapter ==> default: When choosing an interface, it is usually the one that is ==> default: being used to connect to the internet. ==> default: default: Which interface should the network bridge to?
Vagrant public_network を使用する - Why it doesn't work? https://www.whyit.work/entry/2018/06/30/225903 Vagrantで起動時のネットワークインターフェースを指定するには - THINKING MEGANE https://blog.monochromegane.com/blog/2013/05/22/vagrant-specify-network-interface/ 数字でネットワークを指定するような記事があったので、とりあえず適当に「1」と入力してエンター
default: Which interface should the network bridge to? 1 ==> default: Preparing network interfaces based on configuration... default: Adapter 1: nat default: Adapter 2: hostonly default: Adapter 3: bridged ==> default: Forwarding ports... default: 80 (guest) => 8080 (host) (adapter 1) default: 22 (guest) => 2222 (host) (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: Machine booted and ready! [default] GuestAdditions 6.1.24 running --- OK. ==> default: Checking for guest additions in VM... ==> default: Configuring and enabling network interfaces... ==> default: Rsyncing folder: /cygdrive/c/vagrant/development/ => /vagrant ==> default: Mounting shared folders... default: /var/www => C:/vagrant/development/code ==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision` ==> default: flag to force provisioning. Provisioners marked to run always will still run. ==> default: Running provisioner: shell... default: Running: inline script C:\vagrant\development>
無事に起動した 突然この対応が必要になった理由は不明なので、また確認しておきたい 参考までに、別の環境で普通に起動できた時のメッセージは以下のとおり
C:\vagrant\development>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: 80 (guest) => 8080 (host) (adapter 1) default: 22 (guest) => 2222 (host) (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: Machine booted and ready! [default] GuestAdditions 6.1.24 running --- OK. ==> default: Checking for guest additions in VM... ==> default: Configuring and enabling network interfaces... ==> default: Rsyncing folder: /cygdrive/c/vagrant/test/ => /vagrant ==> default: Mounting shared folders... default: /var/www => C:/vagrant/test/code ==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision` ==> default: flag to force provisioning. Provisioners marked to run always will still run.
■Apacheを自動起動できない Apacheの自動起動を設定しても、Vagrantを起動し直すと停止している SSHで接続してから以下を実行すると大丈夫
$ sudo service httpd restart
原因と思われるものが以下に記載されている Vagrantのup時、httpdが自動起動しないとき - Qiita https://qiita.com/ooba1192/items/96b7ab25d2bda1676aaa Vagrant上のCentOSでhttpd.confをVagrant共有ディレクトリのシンボリックリンクにしているとOSブート時にhttpdが自動起動しない #vagrant #apache - nori3tsu's blog http://nori3tsu.hatenablog.com/entry/2014/03/22/123313 「/etc/init.dの起動スクリプトが実行されるタイミングで/vagrantディレクトリがマウントされていないことが原因」とのこと Vagrantfile 内の最後にある「end」の前の行に、以下を追加すれば改善できた これにより、Vagrant起動時にApacheを常に再起動させている
config.vm.provision :shell, run: "always", :inline => <<-EOT sudo service httpd restart EOT
■「yum -y update」を実行するとエラーになる
config.vm.box = "centos72"
の設定でVagrantを立ち上げ、「yum -y update」を実行すると以下のエラーになった
# yum -y update Downloading packages: warning: /var/cache/yum/x86_64/7/puppetlabs-pc1/packages/puppet-agent-1.10.14-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID ef8d349f: NOKEY file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs-PC1 から鍵を取得中です。 The GPG keys listed for the "Puppet Labs PC1 Repository el 7 - x86_64" repository are already installed but they are not correct for this package. Check that the correct key URLs are configured for this repository. Failing package is: puppet-agent-1.10.14-1.el7.x86_64 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs-PC1
リポジトリを追加すればいいらしい yum update できなかったCentOS6 - Qiita https://qiita.com/teru855/items/cfe4b71bf1af14b9b05a 以下でリポジトリを追加してから再度「yum -y update」を実行すると完了できた もしくは、以下を実行しても対応できた が、先のコマンドのほうが一行で済むのでいいかも
# curl -L https://yum.puppetlabs.com/RPM-GPG-KEY-puppet -o /tmp/RPM-GPG-KEY-puppet # gpg --with-fingerprint "/tmp/RPM-GPG-KEY-puppet" # cp /tmp/RPM-GPG-KEY-puppet /etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs-PC1
centos7.2でyum updateした際のエラー - 猫のプロトコル https://protocol.nekono.tokyo/2018/09/13/centos7-2%E3%81%A7yum-update%E3%81%97%E3%81%9F%E9%9A%9B%E3%... ■外部CSSを修正しても反映されない インラインで調整した場合には反映されないが、 丸ごと書き換えるとファイルサイズの差分だけ反映される?ような現象が発生する sendfileでキャッシュされている可能性がある /etc/httpd/conf/httpd.conf で「EnableSendfile off」と設定されていることを確認する。 バーチャルホストやユーザディレクトリを使用している場合、 対象ディレクトリに対して以下の設定を追加する
<Directory "/path/to/target"> EnableMMAP Off EnableSendfile Off </Directory>
その後Webサーバを再起動する
# service httpd restart
Nginxの場合も、以下の設定で同様に調整できる
sendfile off;
VagrantでCSSの更新が反映されない場合の対処法 http://qiita.com/shoyan/items/12389d5beaa8695b1a53

Advertisement