How can I mount a folder from an ubuntu virtual machine on ubuntu? - ubuntu-14.04

I tried sshfs, but the local directory where I want to mount a folder from the VM does not open after running the command.

Install the Guest Additions on the virtual machine. These can be dowloaded from within the virtual machine from the Devices > Install Guest Additions menu.
Add the folder you wish to share to the Shared Folders, this option can also be found in the Devices menu.
The folder can now be mounted with
sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) folder ~/host
For more info, or troubleshooting, check out this Ubuntu Help article.

Related

WSL file system permission mixed up with windows files

I'm using WSL2 (Windows Subsystem for linux), and I've been using it for a really long time, and I didn't have troubles with it.
Unfortunately, today, from my linux distribution (Ubuntu 20.04), I no longer have permissions to view some Windows files, to which I had previously access without trouble. I don't know what happened, I don't remember intalling any update manually.
However, interestingly, I can access them if I do sudo su and become root. Then, I can access everything, or I can use sudo cat. But I don't want anything of that, I want to be the default WSL user to do what I could before.
What I tried:
Adding my default user to admin group, root group and sudo group (no luck)
Addming username to sudoers
root ALL=(ALL:ALL) ALL
danon ALL=(ALL:ALL) ALL
Editing permissions in my Windows host machine to allow everyone to access it
Editing permissions in my Windwos host to change the owner of the file (and directories below it)
Use other WSL distros, Ubuntu 20.04 and Ubuntu 18.04
Add metadata option to /etc/wsl.conf
Restarting the distro
Restarting the wsl
Restarting the host system
I don't know what else to do. I don't want to do sudo su everytime I open my wsl, or call each method with sudo.
I would like either to access my files from WSL like I used to before, or maybe specifically make those files available to my default linux user.
Result of mount:
C:\ on /mnt/c type 9p (rw,noatime,dirsync,aname=drvfs;path=C:\;uid=1000;gid=1000;metadata;umask=22;fmask=11;symlinkroot=/mnt/,mmap,access=client,msize=65536,trans=fd,rfd=8,wfd=8)
D:\ on /mnt/d type 9p (rw,noatime,dirsync,aname=drvfs;path=D:\;uid=1000;gid=1000;metadata;umask=22;fmask=11;symlinkroot=/mnt/,mmap,access=client,msize=65536,trans=fd,rfd=8,wfd=8)

Create symbolic link in Linux guest on Windows host

I am running Virtualbox Linux 32 bit guest OS on a Windows 10 64 bit host OS. I am sharing a folder between the host (windows) and the guest (linux). When I am trying to create a symbolic link in the guest I am getting the following error:
ln -s file1 link1
ln: failed to create symbolic link 'link1': Operation not permitted
How can I enable the possibility of creating symbolic links by the Linux guest, on a Windows host, within a shared folder?
I have called the VBoxManage program with the following arguments to fix the issue (source):
VBoxManage setextradata MACHINE_LABEL VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_LABEL 1
But now the error I receive is: Protocol error instead of Operation not permitted. To fix this issue, I had to run my VM from within the host as administrator. Is there a way to fix the permissions, so the VB image doesn't have to be run as admin?

How can I access my WSL2 files from my natively installed Ubuntu?

I'm really new to Ubuntu and WSL.
My problem is simple: I want to access from Ubuntu which I have installed in my computer (dual boot alongside with Windows) to my WSL2 filesystem that I have in Windows. I located a file named ext4.vhdx which I suppose is my entire wsl drive, but I'm not really sure, it is in
c:\Users\USER\Appdata\Local\Packages\CanonicalGroupLimited.Ubuntu20.04o...\LocalState\
I'm currently into web development and I want to share that environment within WSL2 and Ubuntu, I noticed that using the linux fs is way faster than windows fs and it works better with things like watchers. So, is it possible?
I'm currently running Windows 10 19041 (2004), Ubuntu LTS 20.04
I've also encountered similar issues when doing this WSL Ubuntu sharing thing, and I've finally found a solution on the internet that works out perfectly.
Reference Link:
https://www.nicholasmelnick.com/2020/07/sharing-your-wsl2-environment-with-linux/
So basically these are the steps,
First of all, the WSL's "ext4.vhdx" file should be accessible inside your Ubuntu system (So you must mount your windows drive inside your linux OS)
Install libguestfs-tools package with APT
And finally just create a folder and guestmount the drive with following commands.
$ sudo mkdir -p /mnt/wsl
$ sudo guestmount -o allow_other \
--add /mnt/c/Users/username/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/ext4.vhdx \
-i /mnt/wsl
And done! Hope this would solve your problem. :)

Paste to virtual terminal

In a Ubuntu host system I have installed qemu and created a virtual machine with CentOS. The CentOS installation does not have an X server, just a virtual terminal. I would like to be able to copy strings from the host system to the virtual terminal of the virtual machine.
What I found so far is the suggestion to install spice-vdagent. If I understand correctly however, spice-vdagent requires an X server, which I don't have installed.
So, how can I paste strings to the virtual terminal (if possible at all)?
You have to enable clipboard in your virtual machine manager software (VirtualBox or VmWare).
In Vbox you have to install Guest Additions iso. In VmWare you have to enable it in the virtual machine's options.
Run your Vm and run next command:
# yum install spice-vdagent
# chkconfig --add spice-vdagentd
# service spice-vdagentd start

VirtualBox: mounting shared folder fails during start-up, but succeed from shell

Problem description:
When I boot my VirtualBox Guest OS, the mounting of the shared file-system - which is referenced in /etc/fstab - fails.
However, after login - mount -a succeeds.
Details:
The boot process gets stuck here ...
... and pressing s continues the boot process, which finishes.
In the shell, I verify that my shared directory is not mounted:
But now, from the shell, the mount of the shared file-system succeeds:
What should I do to make my mount succeed during start-up?
Environment:
VirtualBox: 4.3.12.r93733
Host OS: Windows 7
Guest OS: Linux ubuntu 3.13.0-32-generic #57~precise1-Ubuntu x86_64 GNU/Linux
/etc/fstab
Relevant lines in /var/log/boot.log
You don't have to mount it, VitrualBox will make it for you. For me,these steps worked on my System (VirtualBox 5.0.10 on Windows 7 and Kubuntu 14.04 guest system):
In VirtualBox, configure your shared folder for your machine under 'Shared Folder'. Pick up the directory on your host system (e.g. D:\shared) and set a name for your guest system (e.g. shared).
Boot the guest system. Now you should have a mounted folder under \media\sf_shared.
Thats all. VirtualBox manages this for you.
You need to install VirtualBox Guest Additions properly and use VirtualBox Manager to specify share folders. The issue happens because the mount point is in place with root permissions. The default mount location is in /media/sf_.
You can change mount point with VBoxControl command. To change the mount point from /media/sf_... to /home/user/sf_... use the command:
sudo VBoxControl guestproperty set /VirtualBox/GuestAdd/SharedFolders/MountDir /home/user/
To check if that's working:
sudo VBoxControl guestproperty get /VirtualBox/GuestAdd/SharedFolders/MountDir

Resources