3

So I have a project that requires a specific (and modified) version of the jdk, which I am given as a tar.gz.

I'm running a Kubuntu 17.04 in VirtualBox as a guest OS on a Windows 10 host, because the single disk of my laptop has too many partitions to set up dual boot on it.

To save space and to avoid having to move files from the guest to the host or vice versa, I have created a shared folder where I keep most my stuff, and it is within that folder that I tried to extract the jdk.

sudo tar xzf jdk-7u65-linux-x64.tar.gz 

tar: jdk1.7.0_65/bin/ControlPanel: Cannot create symlink to ‘jcontrol’: Read-only file system
tar: jdk1.7.0_65/man/ja: Cannot create symlink to ‘ja_JP.UTF-8’: Read-only file system
tar: jdk1.7.0_65/jre/bin/ControlPanel: Cannot create symlink to ‘jcontrol’: Read-only file system
tar: jdk1.7.0_65/jre/lib/amd64/server/libjsig.so: Cannot create symlink to ‘../libjsig.so’: Read-only file system
tar: Exiting with failure status due to previous errors

I'm also getting these errors when I try to unzip the tarball with WinRAR on the host end unless I run WinRAR as an administrator. Still I don't really like doing it that way because I have no idea if extraction using WinRAR in Windows would do anything wrong to some files for use in Linux.

Is there a way to make this work from the Linux guest system? And if not, why not?

Permissions:

user@linux-VB:~$ namei -l ~/SHRD_FLDR
f: /home/user/SHRD_FLDR
drwxr-xr-x root    root    /
drwxr-xr-x root    root    home
drwxr-xr-x user user user
lrwxrwxrwx user user SHRD_FLDR -> /media/sf_SHRD_FLDR/
drwxr-xr-x root    root      /
drwxr-xr-x root    root      media
drwxrwx--- root    vboxsf    sf_SHRD_FLDR
2
  • why sudo? Does root have write permission in that folder?
    – ravery
    Oct 22, 2017 at 15:11
  • @ravery No reason. It's just a reflex of mine to add sudo in front of a command if something like this doesn't work on linux. As for the permissions, see the edit above.
    – User1291
    Oct 22, 2017 at 15:26

2 Answers 2

2

Make sure all VMs, as well as the VirtualBox GUI are closed.

Go to where VirtualBox is installed.

In my case, that's C:\Program Files\Oracle\VirtualBox.

There, execute command

VBoxManage.exe setextradata VM_NAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARED_NAME 1

Where VM_NAME is the name you've given the VirtualBox VM and SHARED_NAME is the name you've given the shared folder when you set it up.

E.g. if I have a Virtual machine named Linux, for which I've set up a shared folder SHARED that I can access with ~/SHARED from within the guest, the command will be

VBoxManage.exe setextradata Linux VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARED 1

Despite this command -- and the way I understand it, depending on your windows version -- you may additionally have to run VirtualBox as administrator to be able to create symlinks.

Tested with Virtualbox Version 5.1.22 r115126 (Qt5.6.2).

3
  • Note this is not Ubuntu-specific - this could be on a more general SE board (SuperUser etc.) Nov 1, 2018 at 15:52
  • it is on a more general SE board: serverfault.com/a/367839/184743
    – craq
    Mar 13, 2019 at 1:14
  • If your VM name has "multiple words", you must enclose it in quotes. Example: VBoxManage.exe setextradata "Server UK (Dev)" VBoxInternal2/SharedFoldersEnableSymlinksCreate/data 1
    – HenryHayes
    Nov 24, 2023 at 23:45
0

Adding to the last bit of the answer from User1291, at the time of writing all versions of VirtualBox (including the latest, 6.1.32) lack the ability to create symlinks without elevation (i.e. 'Run as Administrator') or other special privileges on a Windows 10 host, because VirtualBox's underlying call to the Windows CreateSymbolicLink function do not include the SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE flag.

If VirtualBox ticket #18680 gets fixed, then as per this explanation from Microsoft you will just need to enable the Windows 10 "Developer Mode" and not use 'Run as Administrator' anymore.

A deeper discussion of this began here.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .