Guest open Named Pipe on Host?

Discussions about using Linux guests in VirtualBox.
Post Reply
Dadabakus
Posts: 6
Joined: 2. Jun 2017, 16:11

Guest open Named Pipe on Host?

Post by Dadabakus »

I have two apps which communicate over a named pipe (Unix domain socket) - all on one machine. I cannot figure out how to get the app in the VirtualBox VM (Linux) to open the named pipe on the host (Centos7).

I have mounted the shared folder so the Linux VM can see the shared folder containing the named pipe "file". But when it tries to connect to it, it gets ECONNREFUSED (no one listening).

The only thing I could see in the VirtualBox Manager was a section on setting Serial Ports to point to named pipes. But I want my app in the VM to connect to the actual named pipe, not COM1.

Is this possible?
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Guest open Named Pipe on Host?

Post by Perryg »

Question: Can you achieve this with a network connection? Shared folders are a limited subset and do not have a lot of functionality other than transferring files.
Dadabakus
Posts: 6
Joined: 2. Jun 2017, 16:11

Re: Guest open Named Pipe on Host?

Post by Dadabakus »

I actually need the named pipe (domain socket) because the Host app is creating a file and passing its handle back to the Guest app. This is because the Guest app doesn't have permission to create the file.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Guest open Named Pipe on Host?

Post by Perryg »

Post the guests log file ( as an attachment ). Right click on the guest in the Main Manager then click show log. Save and post as an attachment. Compress if it is too large to post.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Guest open Named Pipe on Host?

Post by mpack »

VirtualBox is primarily a hardware emulator: if what you want cannot be achieved at a hardware level then it cannot be done (unless the GAs provide something). VirtualBox can access a named pipe on the host and make this available as a hardware emulation to the guest. E.g. the serial port feature you've already seen.

So, do the GAs provide something? Possibly they could provide a feature, but I'm not aware that they do at present. In fact I'm not at all sure how easily it could be done, given that the VM would have to somehow sense when a new pipe server is advertised on the host, i.e. the VM would have to be able to sense host activity, which IMO is both contrary to VM principles and probably costly in CPU terms.

As Perry has already done, I suggest that you look for a network feature which does what you want, something similar to UPnP. Any such networking feature will be a feature (or not) of the host and guest OS's, all VirtualBox will do is provide the network "hardware".
Dadabakus
Posts: 6
Joined: 2. Jun 2017, 16:11

Re: Guest open Named Pipe on Host?

Post by Dadabakus »

Well, just in case, I'm posting the vbox log file, as requested.

If it turns out this is impossible (sharing a named pipe), then of course I'll have to explore other options. The named pipe mechanism works with Docker containers and Docker hosts -- I was hoping the same would be true here with Virtualbox, and that I was just missing the magic setup.

Thanks,
-Dave
Attachments
vbox.log
(67.11 KiB) Downloaded 18 times
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Guest open Named Pipe on Host?

Post by Perryg »

It appears you are running this all nested in VMware, is that correct? If so that may also add a level of complexity that could prevent this from actually working. Nesting is very difficult.

Code: Select all

DMI Product Name: VMware Virtual Platform
Since you are using automount did you add your user name to the vboxsf group in the guest and reboot?

Code: Select all

Host path '/opt/Panorama', map name 'Panorama', writable, automount=true, create_symlinks=false, missing=false
SharedFolders host service: Adding host mapping
Host path '/home', map name 'hosthome', writable, automount=true, create_symlinks=true, missing=false
Dadabakus
Posts: 6
Joined: 2. Jun 2017, 16:11

Re: Guest open Named Pipe on Host?

Post by Dadabakus »

Guest app is running as root. The named pipe is created by the app running on the Host -- which indeed is inside the VMware guest. We do all our work inside of VMware guests without any issues.

I don't own the VirtualBox image. And it resets on shutdown. So, I run this command in the Guest after the Virtualbox image starts up:

mount -t vboxsf Panorama /opt/Panorama

After I do that, the directory and its contents are visible in the Guest.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Guest open Named Pipe on Host?

Post by Perryg »

In that case I would run the mount statement with the options switch to allow you to own the share in time.

Code: Select all

-o rw,uid=****,gid=****
Dadabakus
Posts: 6
Joined: 2. Jun 2017, 16:11

Re: Guest open Named Pipe on Host?

Post by Dadabakus »

I tried mount -t vboxsf -o rw,uid=1000,gid=1000 Panorama /opt/Panorama but it made no difference
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Guest open Named Pipe on Host?

Post by Perryg »

That's all I got I am afraid. Nesting, and using shared folders to achieve a pipe connection is probably more than the host/guest communication can handle.
Dadabakus
Posts: 6
Joined: 2. Jun 2017, 16:11

Re: Guest open Named Pipe on Host?

Post by Dadabakus »

I think you're right. Thanks for your suggestions, though.
vk_
Posts: 6
Joined: 13. Nov 2017, 11:27

Re: Guest open Named Pipe on Host?

Post by vk_ »

Hi,

just would like to add. I have tried that named pipe as Routing to Serial port on

Host(Virtual Guest)
1.Windows(Windwows)
2.Mac(Linux)
3.Linux(Linux)

In general the Virtual guest can connect to the com port and send data.
Also the host can recieve that data in some terminal program
But so far I was only able to send back data on the Windows(Windows) combination. Which was also not very stable thought

Also starting windows guests two times worked fine connecting through Serial ports over named pipes

However I would appriciate a lot some update would Support better Name Pipe connections
Post Reply