Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 790789 - virsh console fails when executed via remote ssh
virsh console fails when executed via remote ssh
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt (Show other bugs)
6.2
i686 Linux
medium Severity medium
: rc
: ---
Assigned To: Daniel Veillard
Virtualization Bugs
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-02-15 07:06 EST by Dan Yasny
Modified: 2012-06-20 02:48 EDT (History)
8 users (show)

See Also:
Fixed In Version: libvirt-0.9.10-4.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-06-20 02:48:29 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2012:0748 normal SHIPPED_LIVE Low: libvirt security, bug fix, and enhancement update 2012-06-19 15:31:38 EDT

  None (edit)
Description Dan Yasny 2012-02-15 07:06:40 EST
Description of problem:
Trying to get a VM's console from a remote machine with no libvirt installed:

[user@client]$ ssh root@libvirthost virsh console myVM
root@libvirthost's password:
13:09:00.592: 32727: info : libvirt version: 0.9.4, package: 23.el6_2.4 (Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>, 2012-01-06-02:50:25, x86-007.build.bos.redhat.com)
13:09:00.592: 32727: error : vshRunConsole:299 : unable to get tty attributes: Invalid argument
Connected to domain RHEL6x64
Escape character is ^]

[user@client]$

if I first ssh into libvirthost, and then run "virsh console myVM" it works fine

Version-Release number of selected component (if applicable):
RHEL 6.2
libvirt-0.9.4-23.el6_2.4.x86_64

How reproducible:
Always

Steps to Reproduce:
1. see console output above
2.
3.
  
Actual results:
Cannot access console

Expected results:

get access to VM's serial console

Additional info:
Comment 2 Jiri Denemark 2012-02-15 08:13:14 EST
virsh console needs to see a pseudo-terminal and ssh doesn't create one if it is asked to execute a remote command directly. You may, however, explicitly ask ssh to create the terminal with -t option:

    ssh -t root@libvirthost virsh console myVM
Comment 3 Daniel Berrange 2012-02-15 08:20:27 EST
Two things

 - The error reporting from virsh console here sucks
 - 'ssh -t' won't actually work, because although that lets virsh puts the remote console into rawmode, the local console is still in cooked mode. So newlines get interpreted wrongly

AFAICT, the only thing we can do is to improve the error reporting
Comment 4 Daniel Berrange 2012-02-15 08:23:37 EST
With this patch

https://www.redhat.com/archives/libvir-list/2012-February/msg00690.html

You'll see

  $ ssh root@somehost  virsh console f16x86_64
  error: Cannot run interactive console without a controlling TTY
Comment 5 Daniel Berrange 2012-02-15 08:55:47 EST
> - 'ssh -t' won't actually work, because although that lets virsh puts the
> remote console into rawmode, the local console is still in cooked mode. So
> newlines get interpreted wrongly

Ignore this comment, it is wrong.
Comment 6 Dave Allan 2012-02-15 09:44:11 EST
Dan Y., out of curiosity, what are you trying to implement with this?
Comment 8 Dave Allan 2012-02-15 12:04:46 EST
One other thought, you could also use the remote stream support to connect the console, I don't know if that requires installing stuff on the machine from which you are connecting that you're uncomfortable with.
Comment 9 Dan Yasny 2012-02-15 12:31:35 EST
(In reply to comment #8)
> One other thought, you could also use the remote stream support to connect the
> console, I don't know if that requires installing stuff on the machine from
> which you are connecting that you're uncomfortable with.

What do you mean by "remote stream" - to set up a socket?
Comment 10 Dave Allan 2012-02-15 22:10:41 EST
I mean http://libvirt.org/html/libvirt-libvirt.html#virStreamNew and friends
that let you create a data pipe over a remote connection so you can do things
like implement a serial console for on a VM on another machine.
Comment 11 Dan Yasny 2012-02-16 04:11:46 EST
(In reply to comment #10)
> I mean http://libvirt.org/html/libvirt-libvirt.html#virStreamNew and friends
> that let you create a data pipe over a remote connection so you can do things
> like implement a serial console for on a VM on another machine.

Thanks, I wasn't aware of this. My current solution seems to work, and looks like it's enough for now. I suppose this will be considered as a full-fledged feature in the future
Comment 12 Daniel Veillard 2012-03-13 02:40:14 EDT
The patch fixing the error handling of that case is available in build
libvirt-0.9.10-4.el6,

Daniel
Comment 13 Huang Wenlong 2012-03-13 03:33:22 EDT
Verify this bug with :

libvirt-0.9.10-4.el6.x86_64
qemu-kvm-0.12.1.2-2.236.el6.x86_64



[ssh without -t ]:

# ssh  10.66.85.217 virsh console r
root@10.66.85.217's password: 
error: Cannot run interactive console without a controlling TTY


[ssh with -t ]:

# ssh -t 10.66.85.217 virsh console r
root@10.66.85.217's password: 
Connected to domain r
Escape character is ^]
[  OK  ]
Setting hostname virtlab-66-84-201.englab.nay.redhat.com:  [  OK  ]
Setting up Logical Volume Management:   2 logical volume(s) in volume group "vg_virtlab6684201" now active
[  OK  ]
Checking filesystems
Checking all file systems.
...
Comment 15 errata-xmlrpc 2012-06-20 02:48:29 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2012-0748.html

Note You need to log in before you can comment on or make changes to this bug.