LoginSignup
4
5

More than 5 years have passed since last update.

いろいろあり、vagrantの再々インストールから、RubyOnRailsまで。

Last updated at Posted at 2016-04-06

vagrant up 時に以下が出る。(なぜか出ない時もある)

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

上記が出る場合、vagrant ssh出来ない(サーバに繋がらない)。
しかし、vagrant statusを見ると、普通に上がっている。

vagrant upしなおすと普通に上がったりする。

以前から気になっていた点として・・・

フォルダ構成

MyVagrant---
-- .vagrant
-- Package →このファイルは謎。vagrant packageで作ったboxではない。0kb。
-- Vagrantfile
-- mycentos
-- .vagrant
-- Vagrantfile

つまり、vagrantをインストールし直した(しかも、違う場所に)関係で、vagrant一式が2つあるという。(vagrant up自体は、mycentos内で行っている。)

ドットインストール様
http://dotinstall.com/lessons/basic_localdev_win
の補足情報、
「更新後「Failed to mount folders in Linux guest...」というエラーが出る場合」
により、

vagrant plugin install vagrant-vbguest

を実行する。これ、どこで実行するのか分からなかったのでとりあえず、

C:\Users\ユーザー名 配下で実行。無事終了、と思ったのだが・・・

その後のvagrantコマンドがすべて、

C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant.rb:59:in require': cannot load such file -- childprocess (LoadError)
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant.rb:59:in
'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/bin/vagrant:105:in require'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/bin/vagrant:105:in
'

もうどうにも拉致があかない、ということでvagrant再々インストール

  • アンインストール

アプリと機能より

C:\HashiCorpが当然消えますね。

  • 不要のファイル削除

上記の「気になっていた点」は、まあ前回再インストール時に、MyVagrant以下を削除してないからですよね、当たり前ですね。

がっさり消す

そして、~/.vagrant.dも前回消してなかった。

がっさり消す。
これで、完全にきれいさっぱりなはず。

これ以降は、ドットインストールにて。

公式よりダウンロードしたwindows版(vagrant_1.8.1.msi)を使用。

vagrant box add とvagrant init の違いがいまいち分からんな~。
とりあえず、ドットインストールにあるようにvagrant init で。

boxですが、いままで32bit windows10であることから、

bento/centos-6.7-i386

を使っていたのですが、よく見るとx64ベースプロセッサと書いてある!ので、

bento/centos-6.7

にしてみる。ここら辺は、私たちのようなシロウト+若干アルファにとっては分かりにくい。

vagrant init bento/centos-6.7

vagrant up
で普通に上がった!

続けて
http://dotinstall.com/lessons/basic_localdev_win/30806

これがまた、マシンパワーがないからか、時間がかかるんですね。(1時間ほど)

gem install rails
50分ほど。普通の機械なら、もっと全然早いです。
参考までに、使用マシンはASUS EeeBook X205TAとなります。

http://dotinstall.com/lessons/basic_rails_v2/24903
$ rails new myapp
$ rails s
サーバは、普通に上がった。
この環境では、therubyracerは必要ない模様。
http://dev.2oh.com:3000/
ポート3000番でアクセスするが、「ウェルカム画面」が見れない。
→Rails 4.2.5.1のため、サーバ起動は、以下のオプションを指定する必要があるとのこと。
$ rails s -b 0.0.0.0
http://dev.2oh.com:3000/
Welcome aboard!
出てきた。
http://dotinstall.com/lessons/basic_rails_v2/24904
rails generate scaffold User name:string score:integer
rake db:migrate
で、http://dev.2oh.com:3000/Usersに繋ぐと、
Routing Error
No route matches [GET] "/Users"
という感じでエラーになった。
http://dev.2oh.com:3000/users
としたら、OK。
scaffoldコマンドではUserという風に大文字で始めるが、アドレスの指定では、usersという風に全て小文字にするようだ。
http://dotinstall.com/lessons/basic_rails_v2/24905

4
5
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
4
5