How To Use Host Serial Port From Guest In VirtualBox

As an Embedded Software Engineer serial port access is very critical requirement for me irrespective off which OS I am using and how I am using it (I mean with or without virtualization).

I  have Windows XP as primary Operating System, however, I need to work on Linux for lot of  hobby projects. I hate to manage two computers for two reasons first is it makes workplace really messy with extra wires and Second is I always need some space to keep items like Power Supplies, Oscilloscopes, Programmers, Debuggers etc. which are unavoidable.

So I installed Kubuntu as Guest OS on my Windows Host and I wanted to access the host serial port for debugging purposes. Virtual Box does provide this feature and its quite easy to configure as well. The problem is, it can be done in more then one way and that’s where user might get confused that’s why I am writing this post. Before jumping into action we will just find little more information about serial ports

How Serial Ports are Named:

In windows like operating systems serial ports are named like COM1, COM2 and so on while in Linux they are named like /dev/ttyS0, /dev/ttyS1 and so on. As my example involves both operating systems it might create some confusion, as a rule of thumb what will call COM1 in windows will be /dev/ttyS0, COM2 will be /dev/ttyS1 and so on. Even though the names are different they refer to the same Interrupt and IO ports and that’s how we map these names.

Name Under Windows Name Under Linux IO Address Interrupt Request (IRQ)
COM 1 /dev/ttyS0 0x3F8 4
COM 2 /dev/ttyS1 0x2F8 3
COM 3 /dev/ttyS2 0x3E8 4
COM 4 /dev/ttyS3 0x2E8 3

Setup & Requirement:

My computer has four serial port COM1, COM2, COM3 & COM4 . My requirement is very simple I want to access COM3 in my Kubuntu guest installed under Virtual Box Virtual Machine. (We could have taken COM1 itself but that will be little bit confusing so we will stick to COM3 first, once we know how to do it we can access any port in similar manner).

VirtualBox Configuration:

The next step is to configure virtual box to connect virtual serial port in guest OS to physical serial port on host. This is pretty easy if you know what to IGNORE on the serial port configuration dialog of Virtual Box. Lets get started with the configuration now, Open the serial port configuration dialog box for the virtual machine of interest, by default Port0 Tab will be visible. For our purpose IGNORE IRQ, IO PORT and Create Pipe fields.

  1. On Port0 Tab select Enable Serial Port check box (you will not be able to change any other setting till you check this one).
  2. Port Number : This field refers to port number under guest OS, we want to map it to COM1 (/dev/ttyS0) so select COM1 (remember it has nothing to do with physical ports)
  3. Port Mode: We want to connect virtual device to physical device on host so set it to “Host Device”
  4. Port Path: For “Host Device” port mode this field refers to physical device port number on host, we want to connect to COM3 on host so enter COM3 here.

Check out the screen shot below for Virtual Box Configuration.

Virtual Box Serial Port Settings

That’s it just set these 3 fields to correct values and you are done.

Now lets check if it really works or not, as I said my virtual machine runs Kubuntu so the serial port COM1 (Technically the port with IRQ= 4 and I/O Port = 0x3f8) will be mapped to /dev/ttyS0.

Verification Under Guest OS:

To verify the serial port operation under guest OS we need some Kind of Serial Port terminal for gust OS. As our guest OS is Kubuntu I have used Cutecom. Now the actual verification can be done in two ways.

  1. Short Pin 2 and 3 of the physical serial port, this will short the Rx and Tx pins of the serial port and whatever you send through terminal will echoed back to the terminal.
  2. Connect any RS-232 device to serial port and verify it with the device specific commands or application.

I will choose the first method because it will work for everyone, so short RX and Tx pins for your physical serial port and configure Cutecom to set the device to /dev/ttyS0, make other settings as per screen shot below.

Cutecom Settings

Cutecom Settings

See it in action below:

Working Serial Port Under Guest OS

Working Serial Port Under Guest OS

Final Thoughts:

  • In order to map COM1 to /dev/ttyS0 we need to set both Port Number and Port Path fields to COM1 in Virtual Box serial port settings.
  • Even though I have tested it on Kubuntu it should work on any Linux destro.
  • If your guest OS is Windows you can use the Hyper Terminal program and port name given in Port Number field of Virtual Box serial port settings.
  • Please note that the selected physical port can not be accessed by the Host when the Virtual Machine  using that port is running.

Links Related to This Post:

This entry was posted in How To, Operating Systems, Tips, Virtual Box and tagged , , , . Bookmark the permalink.

85 Responses to How To Use Host Serial Port From Guest In VirtualBox

  1. MCom says:

    Thank you, for good information.

    My Tips Computer Site :

  2. excogitator says:

    Thanks MCom, I am glad to hear that it was useful for you.

    • Sathish says:


      I have Installed Virtual Box 3.1.6 on my system. The host is running on SuSe 11.2 and I have installed the SuSe 11.2 as guest OS on the VBox. I have a another system in which I installed Win XP. How to make serial port connection between the VBox and Win XP system.

      Thanks in advance.

    • schalkenator says:

      Thanx for the awesome info, it was very helpful.
      I have a problem though. The the RTS aand DTR signals are permanently set.
      I need to to use full hardware handshake so this is a real problem for me.
      Can you help?

  3. wakaranai says:

    Great man! Thanks. I’m using Xubuntu on Virtualbox and I also need serial port. This helped me alot!.

  4. excogitator says:

    Thanks wakaranai, I am happy that you find the port helpful.

  5. Jed says:

    Thanks a LOT for this!!! I have been baning my head against the wall (litteraly!) for a few hours. I thought that port path should be /dev/ttyS0…
    Im running debian under windows xp and when I put COM1 on BOTH port number and path everything just works…

    Again, thanks!

  6. excogitator says:

    You are most welcome Jed, Thanks for dropping by.

  7. pollo says:

    Hi. On my config (xp host, xp guest, vbox 2.04) it doesn’t seem to work, but I’ve figured that adding manually the com port on the guest works ok.

    On the vbox I set:
    Port Number: COM1 (standard i/o and addr, it’s a physical rs232)
    Port Path: COM1

    On the guest I add the “communication port” manually (via control panel, add hardware wizard) and the xp guest sees it as the COM3.

    Odd but works 🙂

  8. excogitator says:

    Thanks for the Information pollo, that would be handy for the readers.

    I don’t have setup with both XP host and XP Guest, will try that out soon.

  9. Zeeshan Abid says:

    in mine it say’s

    NamedPipe#0 failed to bind to local socket /dev/ttyS0.
    VBox status code: -448 (VERR_NET_ADDRESS_IN_USE).

    Result Code:
    NS_ERROR_FAILURE (0x80004005)
    IConsole {e3c6d4a1-a935-47ca-b16d-f9e9c496e53e}

  10. Zeeshan Abid says:

    some times it say’s

    Ioctl failed for serial host device ‘/dev/ttyS3’ (VERR_DEV_IO_ERROR). The device will not work properly.

    Error ID:

  11. excogitator says:

    Unfortunately I don’t know the reason for the error you are getting? how about trying on Virtual Box Support Forum?

  12. Mourad says:

    thank you so much ! but i want to ask how to do the inverse
    i mean i have a VirtualBox installed in windows and i want to use with serial port for fedora in the virtual box ?
    thanks for your time .

  13. Roland says:

    Excellent write up, thank you. I used this to enable a serial port with Ubuntu 8.04 as the host OS and WinXP as the guest OS. Here is my VM serial port configuration:

    Port Number: COM1 (IRQ 4, I/O Port 0x3F8)
    Port Mode: Host Device
    Port Path: /dev/ttyS0

    The only other thing I had to do was add my user account to the Ubuntu “tty” system group so that VirtualBox had permission to access the port. Before I did this, the VM would crash when I tried to start it because it could not access the hardware directly.

  14. excogitator says:

    @ Roland : Thanks for the complement and your setup information.

    @ Mourad: I guess Roland has got a solution for you.

  15. I read your blog for quite a long time and should tell you that your articles always prove to be of a high value and quality for readers.

  16. excogitator says:

    @ How to Get Six Pack Fast

    Thanks for the appreciation, it’s my goal to cover all aspects of the problem in hand in my posts.

  17. Eliezer says:

    @ Roland

    “The only other thing I had to do was add my user account to the Ubuntu “tty” system group so that VirtualBox had permission to access the port.”

    Hi, how exactly can I do this? I’m looking but haven’t found anything.

  18. Peter says:

    Thanks a lot for this. I was wondering what the correct Path to the COM-Port on the XP-Host woulb be, but I couldn’t believe it would be that simple. By the way, it didn’t work with COM15 (a virtual COM-Port for a USB-Serial-Adapter). So I had to change COM15 to COM1. But now it works flawlessly under openSUSE, although there is no driver available for Linux.

    • excogitator says:

      @Peter: Yes it is very easy but there is lot to confuse you and that’s the reason I thought this will be good information to share. Thanks for the visit.

  19. Chris says:

    I’m trying to do exactly what Peter did. Thanks for all the info!

    BTW “How to Get Six Pack Fast” is SPAM!

    • excogitator says:

      You are most welcome Chris, about “How to get six Pack Fast” i should have guessed from his name :). Thanks for your visit.

  20. Gary says:

    Any idea on doing the reverse of this? i.e. boot up to Ubuntu Linux and access WinXP via Virtual Box. I tried a few different configurations but didn’t get anywhere. Thanks in advance.

    @Roland would like to know how you got the tty permissions.

  21. themattski says:

    Just sharing some info on what I did to get serial ports working in my Fedora Core 12 (fc12) host machine with Windows XP Guest:

    Here is the short answer:

    I used the following settings in Virtualbox (version 3.0.10_OSE) :
    Port Number: COM1
    IRQ: 4
    I/O Port: 0x3F8
    Port Mode: Host Device
    Port/File Path: /dev/ttyS0

    I also needed to add the user (my login) to the ‘dialout’ Group.

    This info may be helpful for other users troubleshooting Virtualbox Serial Port problems (the long version).

    Firstly you can check that Linux has loaded your serial port driver with the command:
    # dmesg | grep ttyS0

    You should see something like this returned:

    serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
    00:02: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A

    Next you can check who has permissions to access /dev/ttyS0 with the command:
    # ls -l /dev/ttyS0

    You should see something like this returned:
    crw-rw—-. 1 root dialout 4, 64 2009-12-02 23:25 /dev/ttyS

    We can see that ‘root’ and the group ‘dialout’ have permissions to access /dev/tty0

    You will want to give the Virtualbox user (the user you login as) permissions to access /dev/ttyS0 so add the user to the ‘dialout’group by:

    a) Click, System –> Administration –> Users and Groups
    b) Enter the root password
    c) As an optional setep you disable ‘Hide System Users and Groups’ in the Preferences tab. Now you can see all system users and groups.
    d) Double click the user and under the ‘Groups’ TAB tick ‘dialout’ (or what ever group your ls -l /dev/ttyS0′ returns as having permission to access it)
    e) Log-out and log back into Fedora.

    If you don’t have permission to access the dev/ttyS0 resource you will see the following error in Virtualbox:

    Failed to start the virtual machine MACHINE_NAME_HERE
    Cannot open host device /’dev/ttyS0′ for read/write access. Check the permissions of that device. (‘/bin/ls -l /dev/ttyS0’):……

    As an additional note I could not use ‘COM1’ in the ‘Port/File Path:’ setting in virtualbox but /dev/ttyS0 works. The following error is produced with COM1 set:

    Failed to start the virtual machine MACHINE_NAME_HERE
    Failed to open the host device ‘COM1’ (VER_FILE_NOT_FOUND).
    Unknown error creating VM (VERR_FILE_NOT_FOUND).

    Hope this helps someone as it has helped me.

    • excogitator says:

      @ themattski: Thanks a lot for providing detailed information. I am sure it will help someone.
      Thanks for dropping by.

      • themattski says:

        And thank you for your guide above mate! It was most helpful in allowing me to arrive at a solution that worked in my set-up.

  22. themattski says:

    Following the above I also needed to add the serial port to Windows XP – my Guest OS:

    Start –> Settings –> Control Panel –> Add Hardware
    Next –> Yes I have already… –> (scroll to bottom) Add new hardware device –> Next –> Search and Install the Hardware.

    You should now see the com port.

  23. lolz says:

    Damn thanks! I was really doing the wrong things, thanks for the info! Im need it for the same reasons as you 🙂

  24. Paul says:

    Great article, thank you.
    I was suffering with the native USB serial access which worked “occasionally”.
    This article (and sorting permissions on /dev/ttyS0) finally helped me to get it working consistently.

  25. Pingback: Serial Hardware connect - openSUSE Forums

  26. Pingback: Serial Port Config B/W VBox and external system

  27. Dave says:

    Great help, thanks!

    Just a short input. I am using a USB-serial converter which shows me a serial port (WindowsXP host Ubuntu GuestOS) so I connected the port exactly the same way you did. Without success.
    I had to use /dev/ttyUSB0 as a Device in CuteCom. That may helps someone having the same problem.

    • excogitator says:

      Thanks for the information Dave, it will certainly help as I can see that many new laptop these days do not have in-built RS-232 ports.

    • Shrini says:

      In this case, did you change port number in serial settings of virtual box or it is still COM1?

  28. VM_Lover says:

    Extremely Nice post! Very valuable and useful.
    Here is my problem:
    1. Trying to use WinFax on XP guest with OpenSuse host, and Version 3.2.4 Virtualbox.
    2. But from guest XP, keep getting error msg, TAPI modem in use.

    Anyone know?
    Is it actually possible to use WinFax Pro on Virtualbox with Opensuse host? Or any other fax program?
    Any thoughts….
    This Virtualbox user would be more than grateful!

    Again, Tks so much.

  29. Josephine says:

    Hi! Great response, and very easy to understand.
    I have a question, though. What version of Virtual Box do I need to install in order to be able to access USB devices? I noticed that yours has the USB option; mine does not.

    • excogitator says:

      @josephine: Thanks for dropping by. Please note that open source edition of virtual box does not have USB support.

  30. praveenaj says:

    I’m running Ubuntu as Guest on Windows 7 Host. I can’t make “Port/File Path” as “/dev/ttyS2” (Port mode as “Host Device”). the following error appears:

    failed to open host device \dev\ttyS2 VERR_PATH_NOT_FOUND

  31. ahmad says:

    thankx alot for your help material

  32. Jester says:

    Hey thanks M8!!! Your instructions did the trick. A bit counter-intuitive and backwards, but you made it make sense!

  33. Pingback: 2010 in review « Software, Tools, Tips, Tricks

  34. Sina says:


    Thanks for the detailed instructions. I have Windows 7 as host and Ubuntu 10.04 as guest. However I added the serial port to my virtual box after I had installed the Virtualbox guest additions on my guest system, so I couldn’t get the serial to work. Once I installed the guest additions again, it started working.

    • bla says:

      Guest additions don’t do anything with serial ports. I tried it anyway. Does not work.

      I have WinXP as guest and Win7 as host – serial port doesn’t work. 😦

  35. Pingback: redirecting serial port to VirtualBox by lan

  36. Pingback: Delicious Bookmarks for February 26th from 15:41 to 22:01 « Lâmôlabs

  37. quocdinh says:

    Very nice port. Thank you A LOT.

  38. Aisha says:

    Thank u for valuable info.
    please Sir,
    could you explain tha whole setting of virtualbox for all operating system?
    thank u again

    • excogitator says:

      @ Aisha, Thanks for dropping by.

      Yes, it is long pending plan… thanks for the reminder I will work on it soon.

  39. Pingback: Is there a VM to map a legacy app’s serial resources onto modern hardware? Drija

  40. Ace Strong says:

    Great job! This article help me a lot! Thank you!

  41. Fabio says:

    The article is very nice. I can’t use the method for the com port that you explain with a XP virtual machine on a Windows 7 Host machine. Can you help me? I manage in the right way the serial com port in windows 7, but I can’t use it inside the XP virtual machine. I use exactly your method in the virtual box configuration.

  42. smeezekitty says:

    Unfortunately, it does not work.
    I send serial data on my other computer and the Linux guest does not receive it. The host does receive it though.

  43. Pingback: Virtualbox Serial Port Step-by-Step

  44. Sam says:

    Thanks, worked !!!

  45. Jake says:

    Thanks. Worked perfectly on my Ubuntu guest using Windows 7 as host.

    • amir shauqee says:

      i’m using Ubuntu as my guest os and windows 8 as my host with addition of using usb to serial adapter for physical com port. the VM virtualbox is running but the terminal isn’t working.

  46. franczc says:

    Thanks very much for the info!

  47. Prince Sinha says:

    i go through with your above process but when i starting machine, its taking .iso image but after few second its shows
    Map file : WRITE PROTECT
    please help me out…?

  48. vinish says:

    Hi After installing Juniper Olive on Virtual box I cant see the interfaces that I need to use. I have chosen two interfaces on virtual box and one is microsoft loopback interface that directly connects to the host windows and the other is vittual box interface..But cant see none of the interfaces after the juniper successful installation. I am copying the ifconfig from the freebsd.

    root@% ifconfig
    lsi: encaps: (null); framing: pseudo

    dsc: encaps: (null); framing: pseudo

    lo0: encaps: loopback; framing: local
    lo0.16384: flags=0x8000
    inet mtu 4294967295 local=
    lo0.16385: flags=0x8000
    inet mtu 4294967295 local=
    inet6 mtu 4294967295 local=fe80::200:ff:fe00:0

    gre: encaps: (null); framing:

    ipip: encaps: (null); framing:

    tap: encaps: other; framing: pseudo

    pime: encaps: (null); framing:

    pimd: encaps: (null); framing:

    mtun: encaps: (null); framing:

    demux0: encaps: (null); framing: pseudo

    cbp0: encaps: ether; framing: ether
    curr media: i802 0:5:86:71:80:11

    pip0: encaps: ether; framing: ether
    curr media: i802 0:5:86:71:83:e0

    pp0: encaps: (null); framing:

    irb: encaps: ether; framing: ether
    curr media: i802 0:5:86:71:84:20

  49. Pingback: Is there a VM to map a legacy app's serial resources onto modern hardware? - Just just easy answers

  50. Pingback: WINDOWS - Virtualbox getting serial port to work | kossboss

  51. adrian says:

    Hi, someone tryied succesfully connect serial port with gest windows 7 and host windows 98?

  52. gokul krishna says:

    i am using windows xp guest os on rhel5. i am unable to use the printer attached to host machine from the guest os. please helpme

  53. Admin User says:

    thanks a ton for this helpful topic

  54. Viraj K says:

    Thanks a lot. The configuration of virtual machine was very helpful to me. I spent a lot of time in figuring out what was going wrong in my serial communication code. It ended up to be a problem with the virtualBox configuration

  55. Hello! That is awesome! Does it work with MBN too?

  56. Unquestionably believe that which you said. Your favourite justification appeared to be on the internet the easiest thing to
    take into account of. I say to you, I certainly get annoyed whilst other folks consider issues that they just do not know
    about. You controlled to hit the nail upon the highest and also outlined out the entire thing with no need side-effects , folks can take a signal.
    Will probably be back to get more. Thank you

  57. Ged Haywood says:

    Setup & Requirement:

    My computer has four serial port COM1, COM2, COM3 & COM4 . My requirement is very simple I want to access COM3 in my Kubuntu guest installed under Virtual Box Virtual Machine. (We could have taken COM1 itself but that will be little bit confusing so we will stick to COM3 first, once we know how to do it we can access any port in similar manner).”

    Port Number : This field refers to port number under guest OS, we want to map it to COM1 (/dev/ttyS0) so select COM1 (remember it has nothing to do with physical ports)
    Port Mode: We want to connect virtual device to physical device on host so set it to “Host Device”
    Port Path: For “Host Device” port mode this field refers to physical device port number on host, we want to connect to COM3 on host so enter COM3 here.

    You said you wanted to use COM3 on the GUEST and then you go and use COM1 on the GUEST and COM3 on the HOST.

    I’m confused.

    • excogitator says:

      What I mean is the COM1 port inside the guest and COM3 port inside the host refers to the same physical port.

  58. Pingback: Quite A Box Of Tricks Serial Number | blazes

  59. that’s good, thanks for sharing,.. I think this is great blog

  60. says:

    The screens in VirtualBox have changed a little, for instance you can’t name the come port, but otherwise this was very helpful!

  61. Carson Withy says:

    This is awesome. I like to use the greatest 6×9 speakers and subwoofers I can for my vehicle. You get really good seem top quality when you blend both of these types and place them in your auto. Even far better when you use a speaker enclosure.

  62. Kamesh says:

    Many thanks for the post!

  63. Having read this I thought it was rather informative. I appreciate you taking the time
    and effort to put this informative article together.

    I once again find myself spending a lot of time both reading and leaving comments.
    But so what, it was still worthwhile!

  64. The software will help to access serial in virtual machine.
    The process couldn’t be more simple than this)

  65. Jerry Liu says:

    Hi, thank you for the details.
    I tried this on my PC. I used Win8.1 and VBox with both Ubuntu and Debian.
    I can see the port in Debian after I connected my device to my PC and the first thing is:
    If I do not connect the device I can not even open Debian on my Vbox.
    However, I can not communicate with my device in Debian and it showed that permission denied.
    What can I do next.
    Thank you.

  66. Greg H. says:

    Your article is the gift that keeps on giving. The little hint about COM1 on Virtual Box is just what I needed today. Thank you!

  67. marcos says:

    im not a linux user and i dont speak English very well. My problem is the opposite to this article, I have linux mint and i want to use serial port on a virtualized windows xp on virtualbox. Once i started win xp, the serial device is properly detected but when i try to connect it on hyperterminal, the system crashed. It’s like Linux dont give it permission to access the port, i dont know. Obviously it works perfect using virtualbox when both operative systems are windows. I really apreciatte any help, please remember im not a linux user, im a very sad windows user

  68. Aurora Moretti says:

    So much time has passed, it’s good that nothing stands still. Now it can be done simply with the help of software …. for my works I use , since It is supported by the Linux system and Windows.

  69. Pingback: Alinco DR-735T: Programming On Linux Through Windows – Soliloquy Blog

  70. Dang says:

    Thank you, you save my life

    (In Ubuntu)
    Before using remember this command
    $ sudo chmod 777 /dev/ttyS0

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s