memo.xight.org

日々のメモ

vagrant の Shared folder が共有できない

Summary

vagrant up の際、以下メッセージが表示される。
そして、vagrant の Shared folder が共有できない。

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mkdir -p /vagrant

Stdout from the command:



Stderr from the command:

sudo: no tty present and no askpass program specified

vbox の問題のようなので、 vbox をリビルドする。

# aptitude install build-essential module-assistant
# aptitude install linux-headers-amd64
# export KERN_DIR=/usr/src/linux-headers-X.X.X-X-amd64
# /etc/init.d/vboxadd setup
Removing existing VirtualBox non-DKMS kernel modules ...done.
Building the VirtualBox Guest Additions kernel modules
The headers for the current running kernel were not found. If the following
module compilation fails then this could be the reason.

Building the main Guest Additions module ...done.
Building the shared folder support module ...done.
Building the OpenGL support module ...done.
Doing non-kernel setup of the Guest Additions ...done.
You should restart your guest to make sure the new modules are actually used

しかし、改善されない。
未解決...

Reference

シドニーで働くプログラマーのBLOG - 2012-05-22 - Vagrantでmountエラーで、フォルダがShareされない
http://blog.mizoshiri.com/archives/1390

メモ超 - 2010-12-04 - CentOS5へのVBoxLinuxAdditionsインストール
http://d.hatena.ne.jp/calcul8/20101204/1291457686

VBoxGuestAdditions の update

Summary

VirtualBox と Guest Additions のバージョンに差異がある場合、
vagrant up 時に、以下の様なメッセージが表示される。

[default] The guest additions on this VM do not match the installed version of
VirtualBox! In most cases this is fine, but in rare cases it can
cause things such as shared folders to not work properly. If you see
shared folder errors, please update the guest additions within the
virtual machine and reload your VM.

Guest Additions Version: 4.1.8
VirtualBox Version: 4.2

/opt/VBoxGuestAdditions-4.1.8 と Guest Addtions のバージョンが古いようだ。
これを新しいバージョンに更新する。

ホスト側で VirtualBox.app 内の isoをマウント

/Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso をコピー

ゲスト側で VBoxGuestAdditions.iso をマウント

$ sudo mount /dev/cdrom /media/cdrom
[sudo] password for vagrant:
mount: block device /dev/sr0 is write-protected, mounting read-only

これで ゲスト側の /media/cdrom 内から VBoxGuestAdditions.iso が参照できる。

VBoxGuestAdditions の更新

$ cd /media/cdrom0
$ ./VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.2.18 Guest Additions for Linux............
This program must be run with administrator privileges.  Aborting
vagrant@debian:/media/cdrom0$ sudo ./VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.2.18 Guest Additions for Linux............
VirtualBox Guest Additions installer
Removing installed version 4.1.8 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox non-DKMS kernel modules ...done.
Building the VirtualBox Guest Additions kernel modules
The headers for the current running kernel were not found. If the following
module compilation fails then this could be the reason.

Building the main Guest Additions module ...done.
Building the shared folder support module ...done.
Building the OpenGL support module ...done.
Doing non-kernel setup of the Guest Additions ...done.
You should restart your guest to make sure the new modules are actually used

Installing the Window System drivers ...fail!
(Could not find the X.Org or XFree86 Window System.)

VBoxGuestAdditions の更新確認

$ ls /opt
VBoxGuestAdditions-4.2.18
$ /opt/VBoxGuestAdditions-4.2.18/bin/VBoxControl --version
4.2.18r88780

VirtualBoxの再起動

ホスト側で vagrant halt または ゲスト側で sudo shutdown -h now
ホスト側で vagrant up

これで、 VBoxGuestAdditions が更新できた。

zsh-completions - zsh で補完を追加

Summary

vagrant を使うようになったので、zshの補完を強化したい。
zsh-completions を使うことで、補完を強化する。

zsh-completions のダウンロード (git)

mkdir ~/.zsh
cd ~/.zsh
git clone git://github.com/zsh-users/zsh-completions.git

.zshrc (git)

if [[ -d $HOME/.zsh/zsh-completions/src ]]; then
	fpath=($HOME/.zsh/zsh-completions/src $fpath)
fi
autoload -Uz compinit
compinit -u


Install (homebrew)

brew install zsh-completions

.zshrc (homebrew)

if [[ -d /usr/local/share/zsh-completions ]; then
	fpath=(/usr/local/share/zsh-completions $fpath)
fi
autoload -Uz compinit
compinit -u

rebuild 'zcompdump'

rm -f ~/.zcompdump
compinit

Reference

GitHub - zsh-users/zsh-completions
https://github.com/zsh-users/zsh-completions