Tuesday, November 4, 2014

How to enble sharefolders in Virtualbox for MapR sandbox

MapR sandbox with drill can be downloaded here.
This article will provide steps to enable sharefolders feature in Virtualbox.

1.  Add CD/DVD to Virtualbox instance.


When guest OS is shutdown, "Machine"=>"Settings"=>"Storage" to add a CD/DVD to the guest OS.
Start guest OS, logon as root user, and mount the CD/DVD as /mnt.
mount /dev/cdrom /mnt

2. Install DKMS rpm on Guest OS.

yum install dkms

3.  However installing Linux Guest Additions will fail.

[root@maprdemo mnt]#  ./VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.3.18 Guest Additions for Linux............
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox DKMS kernel modules           [  OK  ]
Removing existing VirtualBox non-DKMS kernel modules       [  OK  ]
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.
The missing package can be probably installed with
yum install kernel-devel-2.6.32-431.el6.x86_64

Building the main Guest Additions module                   [FAILED]
(Look at /var/log/vboxadd-install.log to find out what went wrong)
Doing non-kernel setup of the Guest Additions              [  OK  ]
Installing the Window System drivers
Could not find the X.Org or XFree86 Window System, skipping.
The details of failure:
[root@maprdemo mnt]# more /var/log/vboxadd-install.log 
Uninstalling modules from DKMS
  removing old DKMS module vboxguest version  4.3.18

------------------------------
Deleting module version: 4.3.18
completely from the DKMS tree.
------------------------------
Done.
Attempting to install using DKMS

Creating symlink /var/lib/dkms/vboxguest/4.3.18/source ->
                 /usr/src/vboxguest-4.3.18

DKMS: add completed.
Error! echo
Your kernel headers for kernel 2.6.32-431.el6.x86_64 cannot be found at
/lib/modules/2.6.32-431.el6.x86_64/build or /lib/modules/2.6.32-431.el6.x86_64/source.
Failed to install using DKMS, attempting to install without
/tmp/vbox.0/Makefile.include.header:106: *** Error: KERN_DIR does not point to a directory.  Stop.
Creating user for the Guest Additions.
Creating udev rule for the Guest Additions kernel module.
The reason is because kernel-devel and kernel-headers versions(2.6.32-504) are not exactly the same as kernel version(2.6.32-431). 
[root@maprdemo ~]# rpm -qa|egrep "kernel-devel|kernel-header"
kernel-headers-2.6.32-504.el6.x86_64
kernel-devel-2.6.32-504.el6.x86_64
kernel-firmware-2.6.32-431.el6.noarch
[root@maprdemo ~]# uname -r
2.6.32-431.el6.x86_64

4. Workaround is to manually create a softlink.

[root@maprdemo ~]# cd /usr/src/kernels
[root@maprdemo kernels]# ln -s 2.6.32-504.el6.x86_64 2.6.32-431.el6.x86_64
[root@maprdemo kernels]# ls -altr
total 12
drwxr-xr-x. 22 root root 4096 Nov  4 13:23 2.6.32-504.el6.x86_64
drwxr-xr-x.  4 root root 4096 Nov  4 14:11 ..
lrwxrwxrwx.  1 root root   21 Nov  4 14:22 2.6.32-431.el6.x86_64 -> 2.6.32-504.el6.x86_64
drwxr-xr-x.  3 root root 4096 Nov  4 14:22 .

5. Now install Linux Guest Additions again.

 ./VBoxLinuxAdditions.run

6. Add the sharefolder.

"Devices"=>"Shared Folders Settings",  add a host OS folder path into "Machine Folders".
And then mount it in Guest OS:
mount -t vboxsf sharefolder  /sharefolder
Note: the "sharefolder" is the folder name which you added into "Machine Folders".


No comments:

Post a Comment

Popular Posts