QEMU Virtual Machine: Creating a shared folder between Windows 10 (host) and Solaris 2.7 (guest) - virtual-machine

I was wondering if anyone could give me wisdom on how to create a shared folder between my host machine (running Windows 10) and the virtual machine I created in qemu which is running Solaris 2.7. I need a way to get files in and out of the VM.
I've managed to "plug in" a folder as a virtual drive into the VM, using
-drive file=fat:rw:[folder],bus=0,unit=1,if=scsi,format=raw,media=disk
in the VM invocation. Solaris sees this as a disk, but I'm unsure where to go from here. I can't seem to format it because I don't know the "disk" geometry (apparently Solaris was very particular about this). I tried mounting the unformatted drive in Solaris but it wasn't able to do that either. I even tried giving it an entry in /etc/vfstab to see if I could get it to automount, but that didn't work either.
Is there a different way I should be mounting it? Or is there a trick to getting Solaris to use this virtual drive? I'm also open to other alternatives people are aware of for transferring files in/out of my VM, but since Solaris 2.7 is a rather old operating system, things like networking (for example) aren't trivial to set up (and even basic things like ssh are missing).
Any help would be appreciated!

Related

Can I run one WSL2 virtual machine instance on two system?

I'm new to the WSL2 and wondering if it's possible to run the same WSL2 ubuntu instance on both my desktop and laptop.
Now I am able to use wsl --export and wsl --import method to save and load the system to/from my portable hard drive. But these methods takes a long time.
I notice that wsl --import load a file named ext4.vhdx. Is there a way to load straightly from this file?
Update v2.0:
I was able to get a workaround and it works great.
Thanks to Booting from vhdx here, I was able to load straightly from my vhdx file on my portable hard disk. Windows track down its subsystem with regedit, So we can write our own(p.s: make sure to get BasePath right, it starts with "\\\\?", or you will not be able to access the subsystem' filesystem on your host system.):
Windows Registry Editor Version 5.00
[HKEY_USERS\【your SID here】\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss\{【UUID here】}]
"State"=dword:00000001
"DistributionName"="distribution name"
"Version"=dword:00000002
"BasePath"="vhdx folder path" 【 e.g. "\\\\?\\E:\\S061\\WSL\\ubuntu-20"】
"Flags"=dword:0000000f
"DefaultUid"=dword:000003e8
I suppose the best way to do this would be to store ext4.vhd on a network storage device accessible to both devices.
I have previosly mentioned how to move ext4.vhd. You can check that out here
Basically you need to export from one machine and import it while making sure the vhd file is configured for wsl to access from the network storage
Since this should *officially* not supported expect some performance hits
Another way would be to run WSL on one computer and ssh/remote desktop to it from another device on the network
I'm of the strong belief that sharing the same ext4 vhd between two VM's simultaneously would be a bad idea. See this and this Unix & Linux StackExchange, including the part about ...
note that sharing LVs/partitions on a single disk between the servers at the same time is NOT very safe. You should only access whole disks from any of the servers at one time.
However, as dopewind's answer mentioned, you can access the WSL instance on one computer (probably the desktop) from another (e.g. the laptop). There are several techniques you can use:
If you have Windows 10 Professional or Enterprise on one of the computers, you can enable Remote Desktop, which allows you to access pretty much everything on one computer from another. RDP ("Remote Desktop Protocol") even works from other devices such as an iPad or Android tablet (or even a phone, although that's a bit of a small screen for a "desktop"). That said, there are better, more idiomatic solutions for WSL ...
You could enable SSH server on the Windows 10 computer with the WSL instance (instructions). This may sound counterintuitive to some people, since Linux itself running in the WSL instance also includes an SSH server (by default). But by SSH'ing from (for example) your laptop into your desktop's Windows 10, you can then launch any WSL instance you have installed (if you choose to install more than one) via wsl -d <distroName>. You also avoid a lot of the network unpleasantness in the next option ...
You could, as mentioned above, enable SSH on the WSL instance (usually something like sudo service ssh start) and then ssh directly into it. However, note that WSL2 instances are NAT'd, so there's a whole lot more hackery that you have to do to get access to the network interface. There's a whole huge thread on the WSL Github about it. Personally, I'd recommend the "Windows SSH Server" option mentioned about to start out with, then you can worry about direct SSH access later if you need it.
Side note: Even though I have SSH enabled on my WSL instances, I still use Windows SSH to proxy to them, to avoid these networking issues.

How to access the windows subsystem for linux 2 filesystem from another computer?

I know that I can access the wsl2 filesystem by just opening \\wsl$ on the local computer. Can I somehow expose this to another computer in the same network? The goal is to just have a network drive on a remote computer where I drop files to copy them directly to wsl2.
EDIT: While it is not exactly what I wanted, I just noticed I can run a FTP server inside wsl2 and just transfer files in and out that way. I am still leaving the question open though as there might be a simpler solution to this.
You can find your home folder of wsl on c drive (its in AppData) and use ordinary windows folder sharing.
You can mount your network storage directly into WSL like in a particular Linux.
Example for Ubuntu and SMB: https://askubuntu.com/a/1050499

Is it possible to run SikuliX on a host computer and have the script interact with virtual machine?

Currently running Windows 10 (native) and VMware Workstation 12 Player. I am running various LTS releases of Ubuntu in VMware.
I am wondering if there is way for me to run SikuliX on my main OS, Windows 10, and have the script interact with a virtual machine, running an Ubuntu OS, that I have open.
The quickstart documentation on the download site isn't very specific about the limitations of SikuliX on this topic. It simply says that you can't run it on a headless system (which VMware is not), and you need to have a monitor - the only problem is that I have no idea if SikuliX considers VMware to be a legitimate monitor or not.
I am aware of the fact that you can install Sikulix on the virtual machine itself, but this is not preferable as I would have to possibly reconfigure my VM settings to allocate more memory OR just deal with running the script at a slower pace.
Any help would be greatly appreciated.
The answer is yes, if you run SikuliX on a native host, it is possible to interact with the the interface of the virtual machine the same as running SikuliX on the virtual machine itself.
Now that I think about it, I should have probably tested this out before posting the question, but hey, if anyone has the same question as I do, now you know.

Where does the Host store the documents used in a Virtual Machine?

Is there a folder in the Host where the files used in the Guest are stored? Specifically, I refer to documents, text files et similia.
I found several posts about file sharing between the two OSs, but they do not answer this question. Actually, on the Host I found only the VM configuration files.
I mean, it is a VM, ok, but they have to physically stay somewhere on the Host HD! What if I want to access them without starting the WM?
My usual config:
W10 - Host;
Lubuntu - Guest.
It really depends on what kind of virtual disk you use VDI, VMDK, VHD, or HDD.
VDI is an issue. The only way i've found so far is to use a USB drive to copy things off and on, or create a network share.
If you're using VMDK, Vmware has a tool I believe is called VMware disk mount as a part of their VDDK, and you should be able to use it to mount VMDK disks as hard drives. https://developercenter.vmware.com/web/dp/sdk/55/vddk
Windows VHD is the easiest one to work with. You can use "Computer Management" on your windows PC to mount the VHD as an external drive using this tutorial. http://notebooks.com/2011/02/25/how-to-browse-and-copy-files-from-a-vhd-system-image-backup/
I'm really not sure about HDD.

Working on remote server

My OS: Windows 8
Virtualbox guest: Ubuntu 12.10 server
I configured apache server on vbox guest and mapped http, https, ssh port successfully into ubuntu server. It works nice without any problem.
I tried several IDEs like PHPStorm, Netbeans, editors like Sublime, all they do is to copy whole project from server, edit on local machine then sync back.
But it is not what I need. I want to work directly on guest server using ssh/sftp connection. I know that notepad++ has this functionality but I love sublime look and feel.
Is there any way to work on guest server with sublime or any other ide for free? (There is sftp solution but it's paid and works just like other ide's, not directly on guest machine) Any suggestions?
There are two approaches you can choose from, you will probably select the second one:
Use the KDE desktop environment (yes, it also exists for MS Windows). It features so called 'kio-slaves' which allow to use any protocol out there as if you were doing local file system operations. That means when using a KDE editor like 'kate' or even a whole IDE like 'kdevelop4' you can simply say "open file/project" and not only choose a local file, but something like sftp://server/path/file and start working. The network stuff is handled transparently by the environment, it is fully network transparent. This is how systems should be like. I think the GNOME environment had something similar, but it probably has been removed with version 3 of GNOME.
You can 'mount' the guests file system into your MS-Windows file system. not sure about the details how this works in MS-Windows, but I am sure that at least newer versions of MS-Windows have gained such feature. Most likely you are still limited to creating something like a "network harddrive" or something, in other systems (linux, unix, macOS) you can mount whereever in the file system you like. You can use any protocol for this, as long as it is supported by the mounting tools of your local system.
Again two options:
2.a You mount the whole virtual disk. Easy, but might be a problem if that disk is currently used by the guest system.
2.b You export the virtual disk by starting some server in the virtual system: samba is most likely your choice. Then you can mount that smb file export inside your MS-Windows system and start hacking.
Have fun!