5

I've set up an VirtualBox with CentOS 7 but i can not add a shared folder.

Enviroment:

Host - Windows 10
VirtBox - Centos 7 
VirtBox Version - 5.1.10
Development Tools are installed
gcc version - gcc-Version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)
perl version - v5.16.3

I was following this post but it does not work.

If I try to mount I get the following result

[root@localhost /]# mount -t vboxsf php5 /mnt/share/php5/ /sbin/mount.vboxsf: mounting failed with the error: No such device

If I run sudo ./vboxadd setup , descripted in the post, the log-file get the following message:

[root@localhost /]# cat /var/log/vboxadd-install.log
/tmp/vbox.0/Makefile.include.header:97: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again.  Schluss.
Creating user for the Guest Additions.
Creating udev rule for the Guest Additions kernel module.

Here is an image of the added folder enter image description here

If I try it by the common was Device--> Guest Addition the following error occure:

enter image description here

Is there an other way to the success??

michael-mammut
  • 197
  • 2
  • 2
  • 8

2 Answers2

2

Most guest addition related problems in virtualbox is solved by creating a group at the host named vboxusers (if not created already)

groupadd vboxusers

and add your user to that group:

sudo usermod -aG vboxusers $your_username
Serhat Cevikel
  • 477
  • 3
  • 6
  • I try it out, but it does not work. If i run `[root@localhost ~]# mount -t vboxsf php5 /mnt/share/ ` i get the error `/sbin/mount.vboxsf: mounting failed with the error: No such device` – michael-mammut Dec 29 '16 at 10:28
  • Did you try this: http://stackoverflow.com/questions/28328775/virtualbox-mount-vboxsf-mounting-failed-with-the-error-no-such-device `cd /opt/VBoxGuestAdditions-*/init` `sudo ./vboxadd setup` – Serhat Cevikel Dec 29 '16 at 10:36
  • yes, I did. In case of this i get this message `sudo ./vboxadd setup vboxadd.sh: Building Guest Additions kernel modules. vboxadd.sh: failed: Look at /var/log/vboxadd-install.log to find out what went wrong. vboxadd.sh: failed: Please check that you have gcc, make, the header files for your Linux kernel and possibly perl installed.. ` – michael-mammut Dec 29 '16 at 10:40
  • In Vbox guest additions image, there is a run file, did you execute that script to install Vbox additions? Do you have the dependencies in strerr (gcc, make, etc) at the guest? And did you try these as a non-root user? – Serhat Cevikel Dec 29 '16 at 10:44
  • yes I run this file in the image, gcc, make, and the others in the "developer tools" are up to date ( nothing to do ). I've work a a root user. – michael-mammut Dec 29 '16 at 10:50
  • i run this command again `[root@localhost cdrom]# ./VBoxLinuxAdditions.run` but i get same error in the log file. `vboxadd.sh: failed: Please check that you have gcc, make, the header files for your Linux kernel and possibly perl installed..` – michael-mammut Dec 29 '16 at 10:56
  • Could you please run the vboxadd.sh with -x option (you can edit the shebang line in the script as such: #!/bin/bash -x, in order to debug and see where the problem is? – Serhat Cevikel Dec 29 '16 at 11:25
  • ok, i added `-x` to the file, this is the current output of the command : `[root@localhost init]# sh vboxadd setup which: no vboxadd in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/bin:/sbin:/usr/sbin) vboxadd.sh: Building Guest Additions kernel modules. vboxadd.sh: You should restart your guest to make sure the new modules are actually used. vboxadd.sh: Starting the VirtualBox Guest Additions. Could not find the X.Org or XFree86 Window System, skipping. ` – michael-mammut Dec 29 '16 at 11:39
  • now i use `yum install dkms` ... now the shared folder is mounted! – michael-mammut Dec 29 '16 at 11:46
  • OK, guest can't find vboxadd. Could you please see whether there is any vboxadd in the file system by `sudo find / -name "vboxadd*"`. If there is one, check whether it is executable (ls -l reports "x" permissions), if not, do so by `chmod +x /path/to/vboxadd`. And then you can create a symlink to that executable by sudo `ln -s /path/to/vboxadd /usr/binvboxadd` – Serhat Cevikel Dec 29 '16 at 11:47
  • 1
    Ok great, I am happy that you solved. – Serhat Cevikel Dec 29 '16 at 11:47
0

I have created a small tutorial to fix it.

michael-mammut
  • 197
  • 2
  • 2
  • 8