How to access serial ubuntu host serial port on VirtualBox guest OS
Solution 1
Setting up a serial port for VirtualBox is not easy, mainly because of many options on how to transfer data from the host to the guest. For transferring data from/to an attached device (here a modem) the following settings should work:
Of course you will have to adopt setting for your device on the host (that would be /dev/ttyS2
in your case).
If using an IRQ greater than 15 for the host you will have to enable I/O APCI as shown here:
After a setup depicted in the example here your Windows guest will see a virtual type 16450 serial port on COM1 using IRQ4 and I/O Port 0x3F8. Data will be transferred from and to host device /dev/ttyS20
.
Solution 2
If you are running a Windows host and a Linux Guest - you would use "COM#:" for the port/file path. Port Mode: Host Device.
If you are running a Linux host and a Windows Guest - you would use "/dev/ttyS#" for the port/file path. Port Mode: Host Device.
Where # is the number of the port.
Related videos on Youtube
Takkat
Updated on September 17, 2022Comments
-
Takkat over 1 year
I am having a difficult time trying to access a serial port on VirtualBox. My Guest OS is Windows XP and the host environment is Linux Ubuntu 10.04.
The serial modem device works perfectly in Ubuntu. I can communicate with it via cutecom or just sending plain echo messages to it like so:
echo "id" > /dev/ttyS2
Ubuntu Settings and config
I have added my user account to the following group: dialout and have set the serial using the following command: sudo setserial /dev/ttyS2 but still no luck when trying to access it in my Guest OS.
Heres the settings I use to configure the serial port in VirtualBox:
* Port Mode : Host Device * Port Number : User - Defined (IRQ = 17, I/O Port = 0xEC00) * Port/File Path : /dev/ttyS2
I have tried all the different port modes even disconnected but still no luck. I have consulted the manual aswell but nothing works. What could be wrong? Is it virtualbox or are my ubuntu settings configured incorrectly?
Please help
Thanks
-
akikara over 8 yearsCannot open host device '/dev/ttyS0' for read/write access. Check the permissions of that device ('/bin/ls -l /dev/ttyS0'): Most probably you need to be member of the device group. Make sure that you logout/login after changing the group settings of the current user (VERR_ACCESS_DENIED). Is this normal?
-
-
Hi-Angel over 9 yearsThank you very much, I was sure that I needed to choose an option "redirect to a file".
-
Xofo almost 4 yearsYes - The Serial port would be mapped to a name like /dev/ttyS#