0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

VagrantでCentOS8環境を構築し sync_folder しようとしたらエラーが出たので解決した

Posted at

sync_folderで発生したエラーと解決策

Vagrantfileの定義にsync_folderを指定してphpのCodeIgniterを使ったシステム開発をしようかなと思ったら、エラーが出てしまった。

以下はVagrantfileの定義です。

Vagrantfile
Vagrant.configure("2") do |config|
  config.vm.box = "centos/8"
  config.vm.network "private_network", ip: "192.168.33.10"
  config.vm.provider "virtualbox" do |vb|
    vb.customize ["modifyvm", :id, "--memory", "2048"]
  end
  config.vm.provision :shell, :path => "./provision.sh", :privileged => true

  config.vm.synced_folder "./codeigniter", "/var/www/html/codeigniter"
end

vagrant upすると最後のほうで赤文字で以下のエラーが出ていました。

vagrantupで出たエラー
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

/usr/sbin/rcvboxadd setup

Stdout from the command:

VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel 
modules.  This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup <version>
VirtualBox Guest Additions: or
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Building the modules for kernel 
4.18.0-193.19.1.el8_2.x86_64.

VirtualBox Guest Additions: Look at /var/log/vboxadd-setup.log to find out what 
went wrong


Stderr from the command:

modprobe vboxguest failed
The log file /var/log/vboxadd-setup.log may contain further information.

このエラーメッセージが指摘しているように/var/log/vboxadd-setup.logのファイルの中身を見てみます。
vagrant sshで起動したCentOSにアクセスし、ログを確認します。

less /var/log/vboxadd-setup.log

Building the main Guest Additions 6.1.12 module for kernel 4.18.0-193.19.1.el8_2.x86_64.
Error building the module.  Build output follows.
make V=1 CONFIG_MODULE_SIG= CONFIG_MODULE_SIG_ALL= -C /lib/modules/4.18.0-193.19.1.el8_2.x86_64/build M=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 -j1 modules
Makefile:978: *** "Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel".  Stop.
make: *** [/tmp/vbox.0/Makefile-footer.gmk:117: vboxguest] Error 2
Could not find the X.Org or XFree86 Window System, skipping.
modprobe vboxguest failed

このエラーの中で重要な部分は、

please install libelf-dev, libelf-devel or elfutils-libelf-devel

で、libelf-devなどの依存関係がインストールに失敗するのでなんとかして。ということらしいです。
試しにdnf -y install libelf-devとしてみると、そんなの無いよと怒られました。

調べてみると、elfutils-libelf-develというのに変わっているようなので、これをインストールしてみます。

dnf install -y elfutils-libelf-devel

いったんCentOSから抜けてvagrant reloadを実行します。
これでsync_folderのエラーが解消できました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?