質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

VirtualBox

VirtualBoxは、現在米オラクル社が開発している、 x86仮想化ソフトウェア・パッケージの一つです。

Vagrant

Vagrantは、VirtualBox上の仮想マシンを コマンドラインから作成してくれるソフトウェアです。 ビルド環境など容易に構築が可能です。

Q&A

解決済

3回答

2077閲覧

vagrant+virtual boxによる仮想環境構築のエラー

tmtmshohei

総合スコア16

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

VirtualBox

VirtualBoxは、現在米オラクル社が開発している、 x86仮想化ソフトウェア・パッケージの一つです。

Vagrant

Vagrantは、VirtualBox上の仮想マシンを コマンドラインから作成してくれるソフトウェアです。 ビルド環境など容易に構築が可能です。

0グッド

0クリップ

投稿2017/07/08 13:06

編集2017/07/09 03:37

###前提・実現したいこと
現在お天気アプリを開発中です。

macで仮想環境を構築中です。
vagrant+virtual boxで作成中ですが
ローカル環境で

vagrant rerload ```を実行すると 下記のエラーが発生します。 どなたか解決へのアドバイスをいただけたら嬉しいです。 何卒お力添えよろしくお願いいたします。 ###発生している問題・エラーメッセージ ```ここに言語を入力 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: mount: unknown filesystem type 'vboxsf'

###該当のソースコード
手順はこれの通りに行なっています
http://qiita.com/SanoHiroshi/items/892a8516f4a6445e1e05

「追記」Vagrantfileの中身

# -*- mode: ruby -*- # vi: set ft=ruby : # All Vagrant configuration is done below. The "2" in Vagrant.configure # configures the configuration version (we support older styles for # backwards compatibility). Please don't change it unless you know what # you're doing. Vagrant.configure("2") do |config| # The most common configuration options are documented and commented below. # For a complete reference, please see the online documentation at # https://docs.vagrantup.com. # Every Vagrant development environment requires a box. You can search for # boxes at https://vagrantcloud.com/search. config.vm.box = "bento/centos-7.1" # Disable automatic box update checking. If you disable this, then # boxes will only be checked for updates when the user runs # `vagrant box outdated`. This is not recommended. # config.vm.box_check_update = false # Create a forwarded port mapping which allows access to a specific port # within the machine from a port on the host machine. In the example below, # accessing "localhost:8080" will access port 80 on the guest machine. # NOTE: This will enable public access to the opened port # config.vm.network "forwarded_port", guest: 80, host: 8080 # Create a forwarded port mapping which allows access to a specific port # within the machine from a port on the host machine and only allow access # via 127.0.0.1 to disable public access config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" # Create a private network, which allows host-only access to the machine # using a specific IP. # config.vm.network "private_network", ip: "192.168.33.10" # Create a public network, which generally matched to bridged network. # Bridged networks make the machine appear as another physical device on # your network. # config.vm.network "public_network" # Share an additional folder to the guest VM. The first argument is # the path on the host to the actual folder. The second argument is # the path on the guest to mount the folder. And the optional third # argument is a set of non-required options. config.vm.synced_folder "../centos7", "/rails_projects" # Provider-specific configuration so you can fine-tune various # backing providers for Vagrant. These expose provider-specific options. # Example for VirtualBox: # # config.vm.provider "virtualbox" do |vb| # # Display the VirtualBox GUI when booting the machine # vb.gui = true # # # Customize the amount of memory on the VM: # vb.memory = "1024" # end # # View the documentation for the provider you are using for more # information on available options. # Enable provisioning with a shell script. Additional provisioners such as # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the # documentation for more information about their specific syntax and use. # config.vm.provision "shell", inline: <<-SHELL # apt-get update # apt-get install -y apache2 # SHELL end

###試したこと
http://qiita.com/kazuemasaki/items/c2328fda9d88756a3e4f
上記のことはしてみましたが、結果変わらずでした。

###補足情報(言語/FW/ツール等のバージョンなど)
Ruby [2.3.0]
rails [5.1.2]
Virtual box[5.1.22]
Vagrant[1.9.6]
エディタ:atom

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答3

0

ベストアンサー

Vagrantがデフォルトで採用しているVirtualBoxの共有機能(synced_folder)はゴミクズなんで別の手法に乗り換えましょう。
Macならば候補はnfsかrsyncの二択です。
私が当時お世話になった記事は下記です。


さて、Dockerを導入するという方法も解決策の一つです。
どうみてもVagrantよりDockerのがスマートなローカル開発環境の構築になるので
私はVagrantは捨ててDockerを使った開発手法に切り替えています。

ただし、Dockerは覚える事が非常に多いです。
前居た会社では既にDockerでバリバリ開発していましたので、ジョインした後輩に図を描きながら説明しましたが、中々理解してもらえませんでした。

以下2つのリンクは私の拙い文章と図で説明したDockerを使った環境構築やその概念等を説明しています。

質問者さんはRailsとのことなのでMySQLがデータベースになるんですかね。
そうなるとdocker-composeも併用することになるので、実践的には下記のリンクも併用して見ることで環境構築が捗るかと思います。
docker for macをインストールするとdocker-composeがひっついてくるので特に意識しなくても使えますね。

投稿2017/07/08 20:36

miyabi-sun

総合スコア21158

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

tmtmshohei

2017/07/09 03:42

改善策を教えていただきありがとうございます。 Dockerはいずれ勉強しようと思っていたので nfsかrsyncの記事と合わせて 読ませていただきます。 ご丁寧なアドバイスありがとうございます。
guest

0

ゲストマシンに VirtualBox Guest Additions がインストールされていないか、
ホストマシンの VirtualBox とのバージョンが一致していないと思われます。

以下のコマンドを実行し、vagrant-vbguest プラグインをインストールしてみてください。

vagrant plugin install vagrant-vbguest

エラーの原因が上述の推測の通りであれば、これで解決できるはずです。

それでも解決できない場合、Vagrantfile の内容(可能な限り全文)を質問文に追記してみてください。

投稿2017/07/08 17:36

KiyoshiMotoki

総合スコア4791

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

tmtmshohei

2017/07/09 03:43 編集

ご回答ありがとうございます。 上記のコマンドを試して見ましたが 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: mount: unknown filesystem type 'vboxsf' といった同様のエラーが出ております。。 vagrantfileの中身を該当のソースコードに記載いたしましたので もし可能であればご助言賜れますと嬉しいです。
guest

0

この問題は、Vagrant / VirtualBox / ホストOS / ゲストOS それぞれの
バージョンの組み合わせでも状況が変わったりして、一筋縄ではいきません。
ある日うまくいっても、その後ツールのバージョンを上げたら再発したり。
ぶっちゃけ、私も昨日新しい VM を作っていて同じ目に遭いました。

ただ、このエラーは単に「ホストOSとゲストOS間でディレクトリの共有に
失敗した」だけなので、この機能を除けば普通に使えます。

私はゲスト OS 上のファイル編集には vim を使っています。かつてはホスト
OS 上のエディタを使っていましたが、どうせ本番環境だと結局 vim(vi) を
知らないと仕事にならないので、必要最小限は覚えてしまいました。

どうしてもホスト OS 上のツールを使いたいという向きには、ホスト OS が
Windows なら WinSCP を紹介していますが、Mac だと何を使えばいいんで
しょうね。SSH プロトコルでファイル共有できるツールがあればいいんですが。

解決策じゃなくて申し訳ないですが、『このエラーが出ているから先に進めない
わけじゃない』ということを言いたかったまでです。それではがんばってください。

投稿2017/07/08 14:35

hotta

総合スコア1613

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

tmtmshohei

2017/07/08 16:03

ご回答ありがとうございます。 おっしゃるように使えないことはないんですよね。。 ただ今回はローカル上で仮想環境のファイルをなるべく簡単に 編集したいとおもっていまして。。 エディタはatomを使っていて、やりようによっては ゲスト側に繋げないこともないんですが、 少し手間がかかるのでどうしたものかなと思っていました。。 vimも少しいじってみます。 ご助言ありがとうございます。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問