LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   VirtualBox serial port setup frustration (https://www.linuxquestions.org/questions/slackware-14/virtualbox-serial-port-setup-frustration-586971/)

the-yikes 09-24-2007 09:05 AM

VirtualBox serial port setup frustration
 
Well i think the topic title describes nicely my predicament!

I'm running Slackware 11. I installed the latest VirtualBox Release a couple of weeks ago. Since then iv'e been ripping apart the internet to try to find out how to setup the Host-Guest serial ports!

I dabble in electronics and as such i'm fairly dependant on serial ports, but for the life of i CANNOT figure out how to go about setting them up the serial ports!

Please can someone among you help me before i bust a blood vessel in temper!

Thanks

The Yikes

H_TeXMeX_H 09-24-2007 10:40 AM

Well, first try reading through section 3.7.9 of the virtualbox user manual, it says how to get them working:

http://www.virtualbox.org/download/UserManual.pdf

the-yikes 09-24-2007 12:46 PM

Still no luck!
 
Hi H_TeXMeX_h,
Hey buddy, how goes the study?. I was hoping someone might have a slightly clearer explanation then the following:

Quote:

– On a Linux host, a local domain socket is used instead. On Linux there
are various tools which can connect to a local domain socket or create
one in server mode. The most flexible tool is socat and is available as
part of many distributions.
In this case, you can configure whether VirtualBox should create the
named pipe (or, on Linux, the local domain socket) itself or whether
VirtualBox should assume that the pipe (or socket) exists already. With
the VBoxManage command-line options, this is referred to as “server” or
“client” mode, respectively.
Can someone translate half of this or more into english?!?

local domain socket? what the heck is that?

Thanks

The Yikes

H_TeXMeX_H 09-24-2007 01:16 PM

Well, sorry, I cannot translate it ... because I have no idea either :(

But, it says there is an option in the gui that allows you to configure serial ports. Just do option number 2 out of the three listed there, that looks like it is the most sensible: i.e. Connecting the virtual port to a physical serial port on the host.

As for my study, well I graduated college ... yay ! :) Now on to medical school ...

the-yikes 09-24-2007 04:55 PM

3 Cheers For H_TeXMeX_H
 
oh man! H_TeXMeX_H i ma so glad for you, you should be REALLY proud of yourself. Gosh the last time we chatted you were busy studying and helping me out. I kept hoping you would do well. Well done buddy fair play to you.

I hope everything you plan for comes to pass! i hope you celebrated?

As for the options iv'e tried them all but to no avail. think maybe it might be a host side problem, like maybe i dont have serial ports active or something.

3 more cheers for H_TeXMeX_H

Hip hip hooray
HIP HIP HOORAY
HIP HIP HOORAY!!

H_TeXMeX_H 09-25-2007 05:58 AM

Thanks ! Yes I did celebrate some. But I'll celebrate more when I'm done with school ... :)

Ok, so:

1) Here's good serial how-to:
http://tldp.org/HOWTO/Serial-HOWTO-17.html
So, first try to find your serial ports on the Linux box. Try either:
Code:

lsof /dev/ttyS* # will list serial ports which are open
ls /dev/ttyS* # list all serial ports

See which ones you want to connect. I think VirtualBox support a maximum of two serial ports at any one time.

2) Look through section 8.5 of that manual. It says you can use 'VBoxManage modifyvm' to set up the serial ports.

The options are listed there, but the most important ones are:
Quote:

-uart<1-N> off|<I/O base> <IRQ>: With this option you can configure
virtual serial ports for the VM; see chapter 3.7.9, Serial ports, page 44 for an
introduction.
-uartmode<1-N> <arg>: This setting controls how VirtualBox connects a
given virtual serial port (previously configured with the -uartX setting, see
above) to the host on which the virtual machine is running. As described in de-
tail in chapter 3.7.9, Serial ports, page 44, for each such port, you can specify
<arg> as one of the following options:

– disconnected: Even though the serial port is shown to the guest, it has
no “other end” – like a real COM port without a cable.
– server <pipename>: On a Windows host, this tells VirtualBox to create
a named pipe on the host named <pipename> and connect the virtual
serial device to it. Note that Windows requires that the name of a named
pipe begin with \\pipe\.
On a Linux host, instead of a named pipe, a local domain socket is used.
– client <pipename>: This operates just like server ..., except that
the pipe (or local domain socket) is not created by VirtualBox, but assumed
to exist already.
– <devicename>: If, instead of the above, the device name of a physical
hardware serial port of the host is specified, the virtual serial port is con-
nected to that hardware port. On a Windows host, the device name will
be a COM port such as COM1; on a Linux host, the device name will look
like /dev/ttyS0. This allows you to “wire” a real serial port to a virtual
machine.

This also might be of use:
Quote:

1. what kind of serial port the virtual machine should see by selecting an I/O base
address and interrupt (IRQ). For these, we recommend to use the traditional
values1 , which are:
a) COM1: I/O base 0x3F8, IRQ 4
b) COM2: I/O base 0x2F8, IRQ 3
c) COM3: I/O base 0x3E8, IRQ 4
d) COM4: I/O base 0x2E8, IRQ 3
So you might do something like:
Code:

VBoxManage modifyvm -uart1 0x3F8 4    # to set up COM1
VBoxManage modifyvm  -uartmode1 /dev/ttyS0    # link it to physical port ttyS0

assuming '/dev/ttyS0' is the right serial port (that you found out in step 1, above).

I've never done this before, so try it out and see if it works. If anyone else has done it, please say so.

the-yikes 09-25-2007 06:35 AM

Score 1 out of 2
 
The 1st command gave me nothing! the second command ls /dev/ttyS

yielded the following results:
Quote:

root@darkstar:~# ls /dev/ttyS*
/dev/ttyS0@ /dev/ttyS1@ /dev/ttyS2@ /dev/ttyS3@
root@darkstar:~#
So i'm assuming i need to somehow activate me serial ports. I'm gonna rummage through my books ot see what i can find.

As for the rest of what you said it looks more then promising so once iv'e managed to activate the port in linux i'll give it a try.

Thanks H

The Yikes!

Ok i just took a look at /var/log/dmesg and i found this line
Quote:

serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
ergo i can assume my port is active.

yet when i issue the following command's

VBoxManage modifyvm -uart1 0x3F8 4
I get this.

Quote:

root@darkstar:~# VBoxManage modifyvm -uart1 0x3F8 4
VirtualBox Command Line Management Interface Version 1.5.0
(C) 2005-2007 innotek GmbH
All rights reserved.

Usage:

VBoxManage modifyvm <uuid|name>
[-name <name>]
[-ostype <ostype>]
[-memory <memorysize>]
[-vram <vramsize>]
[-acpi on|off]
[-ioapic on|off]
[-hwvirtex on|off|default]
[-monitorcount <number>]
[-bioslogofadein on|off]
[-bioslogofadeout on|off]
[-bioslogodisplaytime <msec>]
[-bioslogoimagepath <imagepath>]
[-biosbootmenu disabled|menuonly|messageandmenu]
[-biossystemtimeoffset <msec>]
[-boot<1-4> none|floppy|dvd|disk|net>]
[-hd<a|b|d> none|<uuid>|<filename>]
[-dvd none|<uuid>|<filename>|host:<drive>]
[-dvdpassthrough on|off]
[-floppy disabled|empty|<uuid>|
<filename>|host:<drive>]
[-nic<1-N> none|null|nat|hostif|intnet]
[-nictype<1-N> Am79C970A|Am79C973]
[-cableconnected<1-N> on|off]
[-nictrace<1-N> on|off]
[-nictracefile<1-N> <filename>]
[-hostifdev<1-N> none|<devicename>]
[-intnet<1-N> <network>]
[-macaddress<1-N> auto|<mac>]
[-uart<1-N> off|<I/O base> <IRQ>]
[-uartmode<1-N> disconnected|
server <pipe>|
client <pipe>|
<devicename>]
[-tapsetup<1-N> none|<application>]
[-tapterminate<1-N> none|<application>]
[-audio none|null|oss|alsa]
[-clipboard disabled|hosttoguest|guesttohost|
bidirectional]
[-vrdp on|off]
[-vrdpport default|<port>]
[-vrdpaddress <host>]
[-vrdpauthtype null|external|guest]
[-vrdpmulticon on|off]
[-usb on|off]
[-snapshotfolder default|<path>]


Syntax error: Invalid parameter '0x3F8'
and the second commmand

VBoxManage modifyvm -uartmode1 /dev/ttyS0

gives me pretty much the same error except at the end it reports i havent entered enough parameters

I wonder if insanity is a lonely place?

The Yikes

the-yikes 09-26-2007 05:31 AM

Curiouser and furiouser!
 
Well that's it i officially have serial port syndrome!

Man oh Man, okay here's my situation.

when i run:

Quote:


cat /dev/ttyS0

and

Quote:


echo "Test" > /dev/ttyS0

i get nothing, so i now safely say my ports arent active. Has anybody got any clue as to how i might go about turning them on?

I'v tried google but when it comes to phrasing question's i suck like a thirsty elephant!

Thanks

The Yikes

H_TeXMeX_H 09-26-2007 05:42 AM

Quote:

Originally Posted by the-yikes (Post 2903046)
The 1st command gave me nothing! the second command ls /dev/ttyS

yielded the following results:


So i'm assuming i need to somehow activate me serial ports. I'm gonna rummage through my books ot see what i can find.

As for the rest of what you said it looks more then promising so once iv'e managed to activate the port in linux i'll give it a try.

Thanks H

The Yikes!

Ok i just took a look at /var/log/dmesg and i found this line


ergo i can assume my port is active.

yet when i issue the following command's

VBoxManage modifyvm -uart1 0x3F8 4
I get this.



and the second commmand

VBoxManage modifyvm -uartmode1 /dev/ttyS0

gives me pretty much the same error except at the end it reports i havent entered enough parameters

I wonder if insanity is a lonely place?

The Yikes

Maybe you have to give it a name first:

Code:

VBoxManage modifyvm COM1 -uart1 0x3F8 4
VBoxManage modifyvm COM1 -uartmode1 /dev/ttyS0


the-yikes 09-26-2007 07:56 AM

Hi H_TeXMeX_H,
cheers for helping out on this. Well i tried what you suggested but where you have COM1 it should be replaced my the name of the virtual machine.

As i stated above even when i try to get a response from the serial port via the terminal by issuing "cat /dev/ttyS0" and "echo "Test" /dev/ttyS0" i get nothing not even an error.

Iv'e seen the port detected as Linux boots so i know the hardware is present on some level. Yeesh this is anoying!

So has anyone ever had trouble setting up serial ports before? Any advice would be appreciated!

Thanks

The Yikes

H_TeXMeX_H 09-26-2007 08:34 AM

Maybe try running 'pnpdump --dumpregs', or 'lspci -vv' and see if they are listed there. The howto also mentions 'setserial', but it usually doesn't need to be used.

Has anyone set up serial ports here before ?

the-yikes 09-26-2007 10:17 AM

No rsposne for pnpdump --dumpregs
 
Well i tried both and nothing sttod out on the first command, i would post the feedback here but it's a little long. The second again, threw back nothing, here's the last few lines:

Quote:

# Trying port address 031b
# Trying port address 0323
# Trying port address 032b
# Trying port address 0333
# Trying port address 033b
# Trying port address 0343
# Trying port address 034b
# Trying port address 0353
# Trying port address 035b
# Trying port address 0363
# Trying port address 036b
# Trying port address 0373
# Trying port address 037b
# Trying port address 0383
# Trying port address 038b
# Trying port address 0393
# Trying port address 039b
# Trying port address 03a3
# Trying port address 03ab
# Trying port address 03b3
# Trying port address 03bb
# Trying port address 03e3
# Trying port address 03eb
# Trying port address 03f3
# No boards found
oh man, maybe i should recompilt the kernel with serial support or something?

The Yikes

the-yikes 09-26-2007 10:24 AM

Closer and Closer!
 
Oh my god H_TeXMeX_H,
i'm such a muppet!. I took a look at /etc/serial.conf and heres some of what i found!

Quote:

#/dev/ttyS4 uart 16450 port 0x1A0 irq 9 fourport
#/dev/ttyS5 uart 16450 port 0x1A8 irq 9 fourport
#/dev/ttyS6 uart 16450 port 0x1B0 irq 9 fourport
#/dev/ttyS7 uart 16450 port 0x1B8 irq 9 fourport
There all remarked out! everything in that file is! ARRRRRGGGHHH!!!

I'm gonna have a swing at un-remarking them. Will post results in 5-10 minutes!


The Yikes

the-yikes 09-26-2007 02:08 PM

FaIlure
 
Well failed again!
my serial ports still dont register in Linux. Oh man this is killing me.

I love Slackware and i REALLY dont want to have to change to a lesser distro.

The Yikes :(

Right here's an update

dmesg | grep ttyS gives me this:
Quote:

serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
ttyS1: LSR safety check engaged!
ttyS2: LSR safety check engaged!
ttyS3: LSR safety check engaged!
ttyS1: LSR safety check engaged!
ttyS2: LSR safety check engaged!
ttyS3: LSR safety check engaged!
ttyS1: LSR safety check engaged!
ttyS2: LSR safety check engaged!
ttyS3: LSR safety check engaged!
and

cat /var/log/messages | grep ttyS0 gives me this

Quote:

Sep 25 07:17:18 localhost kernel: serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
Sep 25 07:39:06 localhost kernel: serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
Sep 25 09:30:05 localhost kernel: serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
Sep 25 22:30:47 localhost kernel: serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
Sep 26 04:29:48 localhost kernel: serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
Sep 26 05:24:19 localhost kernel: serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
Sep 26 08:25:44 localhost kernel: serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
The second part is confusing because i really dont believe for a moment that there should be that many references to the same port?

Anyone.... Anything?


The Yikes

ivanatora 04-02-2008 03:37 PM

Hello,
I have exactly the same problem and I can't find a solution.
Running Slackware 12 as a host and Windows XP as a guest.
I have uncommented all ttyS0-4 in /etc/serial.conf and rebooted after that.
I have:
Code:

$ dmesg|grep ttyS                                         
serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
00:0e: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A

And after running VirtualBox:
Code:

$ lsof /dev/ttyS*
COMMAND    PID      USER  FD  TYPE DEVICE SIZE NODE NAME
VirtualBo 3170 ivanatora  45u  CHR  4,64      4527 /dev/tts/0
VirtualBo 3170 ivanatora  48u  CHR  4,65      4509 /dev/tts/1

I have not Ports section in Device Manager. The Windows was installed before I enable these serial ports. Is it possible for it to 'remember' that state and cannot find any ports after that? Seems ridiculous.
There is something else that happened after I tried to enable COM ports - Windows can't stop properly. I have to kill the VirtualBox process always when I want to stop Windows.
I tried using COM ports as pipe, but still no success in Device Manager.
Is there a way to troubleshoot serial ports?
After I do
cat /dev/ttyS0
the terminal prompts don't stop and wait or give anything, but returns immediately:
Code:

(23:30:50)[root@/home/ivanatora]# cat /dev/ttyS0                                                                                       
(23:32:16)[root@/home/ivanatora]#

Edit:
Some debug info! I tried to send some file to the serial port (I have a loopback cable):
cp /proc/kcore /dev/ttyS0
And listening it on the same time:
tail -f /dev/ttyS0
And on the last screen I saw bunch of non printable characters like:
^[[?1;2c^[[?1;2c^[[?1;2c^[[?1;2c^[[?1;2c^[[?1;2c^[[
So after all my serial port is operational?

The SOLUTION:
Go to Windows and using the Add New Hardware wizzard add your ports. It will detect them automatically!


All times are GMT -5. The time now is 11:12 AM.