1. Make sure your serial port is enabled in BIOS.
  2. Make sure your serial port is found in the host operating system. For that, type:
    setserial -g /dev/ttyS0
    If the output says “unknown”, your port is not accessible by the host OS. This happens for example when disconnecting power from the docking station on a ThinkPad T61 using Ubuntu 10.10, because the serial port is only available on the docking station and is assumed “disconnected” when switching to battery operation, even though the dock is still physically connected. Re-connecting power to the docking station does not help here, but restarting does.
  3. Configure your VirtualBox virtual machine to have a serial port. For that, use the following settings in the configuration dialog for your VM:
    • serial port: enable
    • port number: COM1
    • IRQ and port settings: ignore, use the defaults
    • Port Mode: Host Device
    • Port Path: /dev/ttyS0
  4. Start the Windows XP guest OS and add the COM port to Windows XP:
    1. Go to “Start -> Control Panel”
    2. Double click the “Hardware” item (“Add New Hardware Wizard”)
    3. Click “Next”
    4. Choose “Yes, I have already connected the device”
    5. Click “Next”
    6. Choose the last list item “Add new hardware device”
    7. Click “Next”
    8. Click “Search for and install the hardware automatically”
    9. Click “Next”, it will search and find the new COM port.

Note that when trying to start VirtualBox without the serial port being available to the host device, VirtualBox will refuse to start with a variety of error messages.

4 thoughts on “How to use a serial port in VirtualBox (Win XP guest, Ubuntu host)?

  1. Interesting. Any idea’s how to click ‘ enable’ if it is all greyed out. I did run setserial -g /dev/ttyS0 and that shows the comport as available

  2. Ed – sorry, don’t know. Did not encounter that case yet.

    So in your case, I could only follow the “standard way” of narrowing down the problem myself: (1) making sure you edit the VM properties while the VM is shut down (not just suspended, as that blocks editing its config), (2) updating to the latest VirtualBox version to see if it’s a bug that does not let it see the OS’s COM port, (3) using the COM port within the Linux host OS to ensure it indeed works, (4) looking into the VirtualBox bug tracker for open bug reports (and possible workarounds) about such a problem.

  3. I already found out. ‘root’ needs to be in the dialout group

  4. Hmm
    Sadly a problem. after setting the path I cant start the windows guest OS as it ‘ ccan’t find’ that port. Well got some further digging to do (yes i got the most up to date virtualbox)

Leave a reply

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>