Virt-manager unable to display guest consoles when connecting to a host user who is using the zsh shell

Bug #556113 reported by Cody Herriges on 2010-04-05
28
This bug affects 4 people
Affects Status Importance Assigned to Milestone
virt-manager (Ubuntu)
Low
Unassigned

Bug Description

Binary package hint: virt-manager

The newest version of virt-manger that is being released with Lucid has issues setting up an ssh tunnel and connecting to a remote KVM console. Virt-manager displays the following error:

"TCP/IP error: VNC connection to hypervisor host got refused or disconnected!"

Running virt-manager in debug mode shows that this bug is caused when users are using the shell zsh and this is not reproducible with bash. The debug output is:

2010-04-05 16:41:58,264 (console:599): Starting connect process for dagger 5905
2010-04-05 16:41:58,265 (console:535): Creating SSH tunnel: ['ssh', 'ssh', 'dagger', "nc -q 2>&1 | grep -q 'requires an argument';if [ $? -eq 0 ] ; then CMD='nc -q 0 127.0.0.1 5905';else CMD='nc 127.0.0.1 5905';fi;$CMD;"]
2010-04-05 16:41:58,268 (console:550): Tunnel PID 24 FD 9321
RSA host key for IP address '2610:10:20:208:222:19ff:fe93:98b5' not in list of known hosts.
zsh:1: command not found: nc -q 0 127.0.0.1 5905
2010-04-05 16:41:58,491 (console:559): Shutting down tunnel PID 9321 FD 24
2010-04-05 16:41:58,491 (console:449): VNC disconnected
2010-04-05 16:41:58,492 (console:474): Too many connection failures, not retrying again

Virt-manager version: 0.8.2 (0.8.2-2ubuntu8)
Ubuntu version: 10.04 Beta

This bug does not affect virt-viewer. Virt-viewer functions normally when using zsh as your shell.

Changed in virt-manager (Ubuntu):
status: New → Confirmed
importance: Undecided → Low
summary: - Virt-manager unable to display console.
+ Virt-manager unable to display console when using the zsh shell
Peter Matulis (petermatulis) wrote :

Creating a new user on the host with the default bash shell and authenticating via this user allows guest consoles to be viewed.

summary: - Virt-manager unable to display console when using the zsh shell
+ Virt-manager unable to display guest consoles when connecting to a host
+ user who is using the zsh shell
Peter Matulis (petermatulis) wrote :

It looks like the command being passed to zsh is

"nc -q 0 127.0.0.1 5905"

whereas it should really be just

"nc"

with arguments

"-q 0 127.0.0.1 5905"

Marc Tardif (cr3) wrote :

The solution would be to fix virtmanager so that it uses eval $CMD instead of just $CMD. This seems to work across a wider variety of shells.

Marc Tardif (cr3) wrote :

Since eval might be considered evil, another more obscure solution would be to use arrays which are also supported by both shells. For example:

CMD=(date -u)
"${CMD[@]}"

However, this will not work with dash, so the compromise is either to use eval which works almost everywhere or arrays which works on real shells.

On Wed, Apr 21, 2010 at 03:45:24PM -0000, Marc Tardif wrote:
> However, this will not work with dash, so the compromise is either to
> use eval which works almost everywhere or arrays which works on real
> shells.

...or just skip the part of that code that assigns the command to a
variable and tries to execute whatever's in the variable?

So, instead of:

  nc -q 2>&1 | grep -q 'requires an argument'
  if [ $? -eq 0 ]
  then
      CMD='nc -q 0 127.0.0.1 5905'
  else
      CMD='nc 127.0.0.1 5905'
  fi
  $CMD

We'd do:

  nc -q 2>&1 | grep -q 'requires an argument'
  if [ $? -eq 0 ]
  then
      nc -q 0 127.0.0.1 5905
  else
      nc 127.0.0.1 5905
  fi

How does that sound?

--
Soren Hansen
Ubuntu Developer
http://www.ubuntu.com/

Marc Tardif (cr3) wrote :

Fortunately, nc is not internationalized, so that should work.

Soren Hansen (soren) wrote :

How does being internationalised or not relate to this particular change?

Marc Tardif (cr3) wrote :

It's not necessarily related to this particular change but rather related to the snippet in your comment. This is off topic for this bug though, so please ignore.

Peter Matulis (petermatulis) wrote :

I made a PPA based on Soren's comment (#5) and all seems to work.

Marc Deslauriers (mdeslaur) wrote :

This should now be fixed in Maverick.

Please track Lucid in bug #605172.

Changed in virt-manager (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers