0

I have a legacy VM I need to take apart and it is running a couple of boxes and using libvirt/qemu/kvm. When I run virsh -c qemu:///system list it gives me all the running instances. However everytime I try to access the libvirt URI with qemu+ssh://hostname@ip/system I get -bash: qemu+ssh://hostname@ip: No such file or directory. Basically, I want to ssh inside of each of the boxes to see what is going on inside of them and I can't find a command to do so. All I can get is the name of the boxes but not what each of them is running.

My experience with these virtualisation tools is very limited.

Command: set -x ; virsh -c qemu+ssh://hostname@ip/system

Output:

host@ubuntu:~$ set -x ; virsh -c qemu+ssh://host@ip/system
+ set -x
+ virsh -c qemu+ssh://host@ip/system
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh #

Other outputs:

host@ubuntu:~$ type virsh
virsh is /usr/bin/virsh
host@ubuntu:~$ set -x ; virsh -c qemu+ssh://host@ip/system list
+ virsh -c qemu+ssh://host@ip/system list
 Id    Name                           State
----------------------------------------------------
 29    Box-recovery-1               running
 38    Box-2                        running
 39    Box-1                        running
 40    Box-3                        running
 41    Box-4                        running
 42    Box-5                        running
 43    Box-6                        running
 44    Box-7                        running
 45    Box-8                        running
 46    Box-9                        running
 47    Box-10                       running

Error output:

host@ubuntu:~$ qemu+ssh://host@ip/system
-bash: qemu+ssh://host@ip/system: No such file or directory
  • What are the outputs of type virsh and set -x ; virsh -c qemu:///system list? – Hauke Laging Apr 8 '18 at 15:14
  • virsh starts the interactive terminal and the second command gives me a table of ID/Name/State of the boxes. All running. – Mnemosyne Apr 8 '18 at 15:27
  • 1
    Sorry, I copied the wrong command. I meant set -x ; virsh -c qemu+ssh://hostname@ip/system. Anyway, you completely ignored my first question. And in general if we ask for command output we do not want a description but we want to see the exact output. I.e. you should edit your question and add the output there, formatted as code. – Hauke Laging Apr 8 '18 at 16:49
  • Ok. Updated the question with the output. – Mnemosyne Apr 8 '18 at 18:24
  • OK, still no output from type virsh but at least we know that the call works in general. Unfortunately it seems I am too stupid today so I forgot the list so next try: set -x ; virsh -c qemu+ssh://hostname@ip/system list. Leave the output without list in your question because that is interesting for others. – Hauke Laging Apr 8 '18 at 18:31
0

IIRC, the qemu+ssh:// connection is for connecting remotely to the qemu host via SSH and does not access SSH within your guests.

In the output you post you are indeed connected to qemu through qemu+ssh:// via this command virsh -c qemu+ssh://hostname@ip/system and on the virsh # prompt you would issue virsh commands to manage your guests, but you should only need that for connecting remotely to your qemu host. It seems you have no issue connecting locally, so it may be easier avoiding remote connections for now.

You say you want to SSH into each VM, if each of them are running SSH, then it should be as simple as logging in to SSH of each VM using valid credentials. Since you already have access to qemu, both locally and remotely, it may be easier, and does not require SSH in the guest, to use virsh console to check on each of your VMs : virsh -c qemu:///system console $VM_NAME. Depending on how your guest consoles are setup, you may still need user credentials to login.

  • Ŷou mean like virsh -c qemu:///system console Box-1? I get a simple: Connected to domain Box-1 Escape character is ^] and no other command works – Mnemosyne Apr 8 '18 at 19:43
  • That looks like it worked. If you hit the enter/return key a few times does anything come up? If not, it could be your guest's consoles are not setup properly or the machines are stuck in boot somewhere. Without SSH or console, I am not sure how you connect to your guests. Maybe they have VNC available somewhere? – GracefulRestart Apr 8 '18 at 20:06
  • No key works except for the escape character. That's the thing, I can't connect to my guests to see what is going on in there. I don't have any VNC available either. Is there any other alternative way to get inside the guest OS's? – Mnemosyne Apr 8 '18 at 21:03
  • @Mnemosyne Use virt-manager to get a GUI from which you can access the virtual machines' graphical consoles. – Michael Hampton Apr 9 '18 at 0:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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