Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm attempting to configure serial access from my libvirt host to one of its guests.

I've configured the device on the guest and started it:

jsharpe@sel-app1:~$ cat /etc/init/ttyS0.conf 
# ttyS0 - getty
#
# This service maintains a getty on ttyS0 from the point the system is
# started until it is shut down again.

start on stopped rc or RUNLEVEL=[2345]
stop on runlevel [!2345]

respawn
exec /sbin/getty -8 9600 ttyS0

jsharpe@sel-app1:~$ sudo restart ttyS0
ttyS0 start/running, process 767

jsharpe@sel-app1:~$ ps aux|grep ttyS0
root       767  0.2  0.0   6080   632 ttyS0    Ss+  17:20   0:00 /sbin/getty -8 9600 ttyS0
jsharpe    769  0.0  0.0   7624   904 pts/0    S+   17:20   0:00 grep --color=auto ttyS0

On the Host, I try to connect with virsh:

jsharpe@twoface:~ $ virsh console sel-app1
Connected to domain sel-app1
Escape character is ^]

... at this point, the host just hangs. I can kill it with ^], but other keystrokes don't show up in the terminal.

Now, back over to guest, let's restart ttyS0:

jsharpe@sel-app1:~$ sudo restart ttyS0
ttyS0 start/running, process 772
jsharpe@sel-app1:~$ ps aux|grep ttyS0
root       772  1.0  0.0   6076   560 ttyS0    Ss+  17:23   0:00 /sbin/getty -8 9600 ttyS0
jsharpe    774  0.0  0.0   7624   904 pts/0    S+   17:23   0:00 grep --color=auto ttyS0

Great, back to the host:

jsharpe@twoface:~ $ virsh console sel-app1
Connected to domain sel-app1
Escape character is ^]

Ubuntu 10.04.3 LTS sel-app1 ttyS0

sel-app1 login: 

A login prompt? So I have to restart ttyS0 after a connection has been attempted? wtf. Note that this isn't a timeout issue. The host/console command will hang indefinitely. It isn't until restarting ttyS0 that the connection happens.

share|improve this question
    
What if you just connect and press Enter? Does the connection remain hung? –  grawity Dec 20 '11 at 17:49
    
@grawity ugh, so simple :/ make that an answer so I can check it. –  crankharder Dec 20 '11 at 17:52

1 Answer 1

up vote 3 down vote accepted

If I recall correctly, serial ports don't have a standard means of detecting whether there is a terminal connected to the other side – or if they do, most virtual serial consoles simply don't bother implementing them. Hence the agetty instance for ttyS0 is started when the guest boots, and the login banner is simply sent to nowhere (to a disconnected port). When you finally connect, agetty isn't aware of that; it just sits there at a login prompt. You could try entering your username blindly and it would get sent.

Pressing a key, such as Enter, will cause agetty to re-display the login banner.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.