Pass through socat device?

unf0rg0tt3n

Well-Known Member
Sep 28, 2016
42
0
46
31
Netherlands
Hi all,

Does anyoe know how I can passthrough a socat device to a VM?

I have a raspberry pi which has several USB devices.
I want to send the device over the network to a proxmox VM which cant run socat directly.
via ser2net I mentioned to publish the device. But how do I pass that through to my VM?

Cheers,
Dennis
 
If you can receive the stream on your PVE host, you can forward it via a virtual serial device into the VM. Similar to this answer, but obviously only do it for your one VM and replace the corresponding side of the socat command with whatever network stream you want to receive.
 
If you can receive the stream on your PVE host, you can forward it via a virtual serial device into the VM. Similar to this answer, but obviously only do it for your one VM and replace the corresponding side of the socat command with whatever network stream you want to receive.
I have read the post you sent.
Don't quite understand how it works.

I have passed through an USB stick to /dev/ttyACM0, then I added the following to my VM (vmid 109):
Code:
serial0: /dev/ttyACM0

But it doesn't show inside my VM, I guess it's not the correct way, but what would be?

Thanks!
 
But it doesn't show inside my VM, I guess it's not the correct way, but what would be?
Since you mentioned ser2net before, I imagined a more complex setup. If your serial connection is available locally via a /dev device, then yes, this should work...

But it doesn't show inside my VM, I guess it's not the correct way, but what would be?
Bit more detail about how it doesn't work please... Any errors in the task log when you start the VM? Any messages in dmesg/journalctl (guest and host)? Do you just not see it in /dev on the guest? What do you see, i.e. 'ls -lA /dev' on the guest might help.
 
  • Like
Reactions: bobmc
Since you mentioned ser2net before, I imagined a more complex setup. If your serial connection is available locally via a /dev device, then yes, this should work...


Bit more detail about how it doesn't work please... Any errors in the task log when you start the VM? Any messages in dmesg/journalctl (guest and host)? Do you just not see it in /dev on the guest? What do you see, i.e. 'ls -lA /dev' on the guest might help.
I have found the device within /dev. it's named /dev/ttyACM0 journalctl and dmesg show no errors regarding this issue (only the ones when I tried usbip, which i doesnt anymore... old entries).

When is I started the VM everything boots and no trouble. When I check what devices are present in the VM, there are none.
 
That is the same information as before. Please show the output of 'ls -lA' from within your VM. Note that even though it is called '/dev/ttyACM0' on your host, it will be called differently in your VM.
 
That is the same information as before. Please show the output of 'ls -lA' from within your VM. Note that even though it is called '/dev/ttyACM0' on your host, it will be called differently in your VM.

This is with the /dev/ttyACM0 added as serial device:

001.JPG

this is with the serial device removed:

002.JPG
 
Yeah so what's the problem then? /dev/ttyS0 clearly shows as part of the 'tty' group in the first image, meaning it is detected as a serial device. It should allow you to communicate with your USB device.
 
Yeah so what's the problem then? /dev/ttyS0 clearly shows as part of the 'tty' group in the first image, meaning it is detected as a serial device. It should allow you to communicate with your USB device.
okay, so help me understand. When I remove the serial device from my configuration, it still shows the ttyS0. why is that then?
 
Linux allocates a few /dev/ttySx device nodes for serial devices by default. These are not connected, file operations (e.g. echo abc > /dev/ttyS1) will fail. Once it's connected, udev kicks in and assigns the correct group ('tty' in this case) for the device node. You can even make more such unallocated device nodes, if you want - try mknod /dev/my-custom-tty-serial-node c 4 68.
 
Linux allocates a few /dev/ttySx device nodes for serial devices by default. These are not connected, file operations (e.g. echo abc > /dev/ttyS1) will fail. Once it's connected, udev kicks in and assigns the correct group ('tty' in this case) for the device node. You can even make more such unallocated device nodes, if you want - try mknod /dev/my-custom-tty-serial-node c 4 68.
Thanks for all the help!
It still doesn't work, but I learned a lote though
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!