Month: November 2016

解決無法在Virtualbox Guest OS Shared Folder建立Link

建立好VM的shared foleder後發現無法在該目錄建立Link

找了一下只需要在Host OS下個一行指令就能解決

Linux:

VBoxManage setextradata VM_NAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME 1

Windows:

VBoxManage.exe setextradata VM_NAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME 1

VM_NAME: VM(Guest OS)的名字
SHARE_NAME: Shared Foleder的名字 (不含”sf_”前綴字)

記得重啟VM!
參考來源:http://serverfault.com/questions/345341/cant-create-symlinks-in-virtualbox-shared-folders

How to Enable Virtualbox 5.0 Shared Folder on Debian 8.5 Guest OS Step By Step

真的花了超多時間才解決這個問題!

前置作業:

  1. Devices > Insert Guest Additions CD image
  2. 切換到root權限

掛載剛剛插入的Guest Additions CD映像檔

mount /dev/sr0 /mnt

確認掛應像檔的內容

cd /mnt
ls -al

執行VBoxLinuxAdditions.run

./VBoxLinuxAdditions.run

若出現以下內容表示安裝失敗:

The make utility was not found. If the following module compilation fails then
this could be the reason and you should try installing it.

The gcc utility was not found. If the following module compilation fails then
this could be the reason and you should try installing it.

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 …fail!
(Look at /var/log/vboxadd-install.log to find out what went wrong)

檢查安裝紀錄檔

tail /var/log/vboxadd-install.log

內容如下:

/opt/VBoxGuestAdditions-5.0.24/src/vboxguest-5.0.24/build_in_tmp: 62: /opt/VBoxGuestAdditions-5.0.24/src/vboxguest-5.0.24/build_in_tmp: make: not found

重點是後面的make: not found
看起來是還沒裝make,安裝make

apt-get install make

再執行一次VBoxLinuxAdditions.run

./VBoxLinuxAdditions.run

結果還是安裝失敗

The gcc utility was not found. If the following module compilation fails then
this could be the reason and you should try installing it.

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 …fail!
(Look at /var/log/vboxadd-install.log to find out what went wrong)
Doing non-kernel setup of the Guest Additions …done.

再檢查一次/var/log/vboxadd-install.log

tail /var/log/vboxadd-install.log

看起來來是少裝了一些東西,爬了一些文章看到這篇試著安裝DKMS就搞定了

/tmp/vbox.0/Makefile.include.header:97: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR= and run Make again. Stop.

安裝dkms

apt-get install dkms

再執行一次VBoxLinuxAdditions.run

./VBoxLinuxAdditions.run

若沒有出現任何的錯誤訊息就重啟VM

確認/media目錄的內容,看到sf_xxx目錄表示設定成功了!
virtualbox_shared_folder

來源和目的伺服器都需要有rsync

bash: rsync: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: remote command not found (code 127) at io.c(226) [Receiver=3.1.1]

之前使用rsync一直遇到這個問題

很納悶的是我的本機端明明有安裝rsync但怎麼會噴command not found

後來看到這篇文章才知道由於來源端(source)和目的端(destination)都要使用rsync溝通

所以使用rsync看到上述的錯誤訊息先檢查來源和目的端是否都有安裝rsync

因為某些Linux Distribution預設不會安裝rsync

安裝指令:

apt-get install rsync