RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 790789 - virsh console fails when executed via remote ssh
Summary: virsh console fails when executed via remote ssh
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.2
Hardware: i686
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Daniel Veillard
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-02-15 12:06 UTC by Dan Yasny
Modified: 2012-06-20 06:48 UTC (History)
8 users (show)

Fixed In Version: libvirt-0.9.10-4.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-06-20 06:48:29 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2012:0748 0 normal SHIPPED_LIVE Low: libvirt security, bug fix, and enhancement update 2012-06-19 19:31:38 UTC

Description Dan Yasny 2012-02-15 12:06:40 UTC
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 13:13:14 UTC
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 Berrangé 2012-02-15 13:20:27 UTC
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 Berrangé 2012-02-15 13:23:37 UTC
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 Berrangé 2012-02-15 13:55:47 UTC
> - '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 14:44:11 UTC
Dan Y., out of curiosity, what are you trying to implement with this?

Comment 8 Dave Allan 2012-02-15 17:04:46 UTC
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 17:31:35 UTC
(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-16 03:10:41 UTC
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 09:11:46 UTC
(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 06:40:14 UTC
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 07:33:22 UTC
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.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.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 06:48:29 UTC
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.