[libvirt-users] installing and accessing a VM? - newbie question maybe

Please don't use HTML messages for the list, or at least configure your MUA to send both plaintext and HTML messages. So, here are some pointers: - When you are connected you don't see anything because the VM doesn't have console properly set up, I'd guess. - The string "^]" means "Hold Ctrl and press ]", that's the usual escape character, for more info why it's done this way, you can read a bit about terminals if you're interested. - The command "virsh connect something vm_name" means run virsh, and in it execute command "connect something vm_name", but 'connect' means connecting to the daemon (or a driver) and takes one argument, so the 'vm_name' there doesn't make sense. You could do virsh console vm_name, but that's essentially what virt-install did at the end of the installation. - You might try using virt-manager instead if you're not familiar with the terminal (I'm guessing that by the fact that it doesn't look like you tried reading the man pages). virt-manager is able to do everything virt-install does and it also offers graphics console and other options. For you the benefit would be that it is GUI. - Or if you just want to see the guest, virt-viewer is a lightweight viewer that does not have any options to configure the vm, but you can use it for accessing the graphics displays. Hope that helped, have a nice day. Martin

hi Martin, thanks for the feedback.
On August 29, 2016 at 2:44 PM Martin Kletzander <mkletzan@redhat.com> wrote: * When you are connected you don't see anything because the VM doesn't have console properly set up, I'd guess.
visrh start -console [domain] gives me the same thing as before Connected to domain [domain] Escape character is ^] (thanks to your explanation I at least know how to escape here now (ctrl +]) can you give any pointer how to setup the VM's console properly I Could imagine virsh edit [domain] would be something to try out.
* You might try using virt-manager instead if you're not familiar with the terminal (I'm guessing that by the fact that it doesn't look like you tried reading the man pages). virt-manager is able to do everything virt-install does and it also offers graphics console and other options. For you the benefit would be that it is GUI.
* Or if you just want to see the guest, virt-viewer is a lightweight viewer that does not have any options to configure the vm, but you can use it for accessing the graphics displays.
virt-viewer again ... I am on a GUI less server, so that's not a option. I think setting up the console is the thing one needs to figure out.

...
virt-viewer again ... I am on a GUI less server, so that's not a option. I think setting up the console is the thing one needs to figure out.
... I also have 'GUI-less' servers. You can use tightvncserver to get a graphical desktop trough vnc. Like that, I can login to my servers from any client from my lasy seat ;) Don't forget to install a window-manager of your choice... Having a Gui to use virt-manager is, according to me, no excess luxury for non-harcore-terminal-administrators...

On Mon, Aug 29, 2016 at 07:29:36AM +0000, Dominique Ramaekers wrote:
...
virt-viewer again ... I am on a GUI less server, so that's not a option. I think setting up the console is the thing one needs to figure out.
... I also have 'GUI-less' servers. You can use tightvncserver to get a graphical desktop trough vnc. Like that, I can login to my servers from any client from my lasy seat ;) Don't forget to install a window-manager of your choice...
Having a Gui to use virt-manager is, according to me, no excess luxury for non-harcore-terminal-administrators...
Well, you don't need to have the GUI on that server, but you can use virt-manager anyway (and anything that uses libvirt, really). You just need to setup connection to the remote libvirtd instance. For example if you use ssh, it could be s simple as qemu+ssh://root@that_server/system, in virt-manager you can set it up as connection, for virsh and virt-viewer you can use it as an argument to -c parameter, and so on. If you're still craving that pure-terminal pleasure, though, you just need to setup serial console in the guest. I don't think you need to setup anything in libvirt for the VM, because otherwise 'virsh start --console' wouldn't work then. Quick "ubuntu serial console" [1] shows what looks like chicken and egg problem. The thing you need to do is make sure the console is used by the installation process. It is usually done automatically by most distros, but it looks like ubuntu doesn't do that. I have no idea how the installation process can be configured on ubuntu, my guess is just that it won't be there merely due to the target audience of the distribution. Again, as Google is your friend, even with bad words used for the search, some old guide [2] is still around fourth result. And that's something virt-install can do for you as well, just open the manual and look for "location allows things like --extra-args". To try it out, I had to run it with DISPLAY= nad --graphics none so that it does what you wanted, of course you can/should remove those options. But this works for me: DISPLAY= virt-install --os-variant ubuntu16.04 -n ubuntu --memory 4096 -l \ http://mirror.vutbr.cz/ubuntu/archive/dists/yakkety/main/installer-amd64/ \ --disk none --extra-args console=ttyS0 --graphics none Just so you know, you can use libvirt as a non-root user as well (without sudo) if configured properly. And you might need it if trying to remotely connect to the daemon. Here are some links that might help (at least to start): http://wiki.libvirt.org/page/SSHSetup http://wiki.libvirt.org/page/SSHPolicyKitSetup https://libvirt.org/remote.html Have a nice day, Martin [1] https://help.ubuntu.com/community/SerialConsoleHowto [2] http://www.fantaghost.com/ubuntu-server-10-10-headless-installation-via-seri...

wanted to follow up on that part (thanks about all comment suggestion regarding virt-viewer and vcn, etc. I will test them as well but would prefer the 'console way' if possible On August 29, 2016 at 2:44 PM Martin Kletzander <mkletzan@redhat.com> wrote:
* When you are connected you don't see anything because the VM doesn't have console properly set up, I'd guess.
the xml file of my machines (all of them actually) have the below in the 'console' section. ... <console type='pty'> <target type='serial' port='0'/> </console> ... Is it this has to be adjusted in order to 'properly set up the console' ? any pointers what to put here? tried 'bash' for 'type' but that didn't work best ...Gunnar thanks & best
On August 29, 2016 at 2:44 PM Martin Kletzander <mkletzan@redhat.com> wrote:
Please don't use HTML messages for the list, or at least configure your MUA to send both plaintext and HTML messages.
So, here are some pointers:
* When you are connected you don't see anything because the VM doesn't have console properly set up, I'd guess.
* The string "^]" means "Hold Ctrl and press ]", that's the usual escape character, for more info why it's done this way, you can read a bit about terminals if you're interested.
* The command "virsh connect something vm_name" means run virsh, and in it execute command "connect something vm_name", but 'connect' means connecting to the daemon (or a driver) and takes one argument, so the 'vm_name' there doesn't make sense. You could do virsh console vm_name, but that's essentially what virt-install did at the end of the installation.
* You might try using virt-manager instead if you're not familiar with the terminal (I'm guessing that by the fact that it doesn't look like you tried reading the man pages). virt-manager is able to do everything virt-install does and it also offers graphics console and other options. For you the benefit would be that it is GUI.
* Or if you just want to see the guest, virt-viewer is a lightweight viewer that does not have any options to configure the vm, but you can use it for accessing the graphics displays.
Hope that helped, have a nice day.
Martin

On Thu, Sep 01, 2016 at 10:11:38AM +0800, vrms@netcologne.de wrote:
wanted to follow up on that part (thanks about all comment suggestion regarding virt-viewer and vcn, etc. I will test them as well but would prefer the 'console way' if possible
On August 29, 2016 at 2:44 PM Martin Kletzander <mkletzan@redhat.com> wrote:
* When you are connected you don't see anything because the VM doesn't have console properly set up, I'd guess.
the xml file of my machines (all of them actually) have the below in the 'console' section.
... <console type='pty'> <target type='serial' port='0'/> </console> ...
Is it this has to be adjusted in order to 'properly set up the console' ? any pointers what to put here? tried 'bash' for 'type' but that didn't work
best ...Gunnar
This is fine, there is no need to do anything here. As I said, the only thing you need to do is convince the guest kernel to use that ttyS0 as a console (by appending console=ttyS0 as a kernel cmdline parameter). Details on how to do that are explained in my previous mail. Also, there is no need to guess parts of the configuration, we have a documentation for the XML [1], as well as bunch of other things [2] and working man pages. Martin [1] https://libvirt.org/formatdomain.html [2] https://libvirt.org/docs.html

I have been coming closer to what I want (at least for the installation process) using this now sudo virt-install --name=my_domain --ram=512 --vcpus=1 \ --location=/path/to/ubuntu-16.04.1-server-amd64.iso \ --disk /path/to/vm.qcow2,device=disk,bus=virtio,size=32 \ --network bridge:br0 \ --os-type=linux \ --nographics \ --extra-args='console=tty0 console=ttyS0,115200n8 serial' I get a console view of the VM in the hosts console and can attend and guide the installation process as hoped for. I guess --extra-args='console=tty0 console=ttyS0,115200n8 serial' is what enables this. This seems not to be persisting though. After the post-installation's reboot I am at the beginning again Connected to domain ubn1604 Escape character is ^] and the '--extra-args' are not supported by 'virsh console' so, is there any way to get the 'console=tty0 console=ttyS0,115200n8 serial' up again after a reboot? I tried virsh console --devname 'console=tty0 console=ttyS0,115200n8 serial' [my_domain]
On September 1, 2016 at 1:31 PM Martin Kletzander <mkletzan@redhat.com> wrote:
On Thu, Sep 01, 2016 at 10:11:38AM +0800, vrms@netcologne.de wrote:
wanted to follow up on that part (thanks about all comment suggestion regarding virt-viewer and vcn, etc. I will test them as well but would prefer the 'console way' if possible
On August 29, 2016 at 2:44 PM Martin Kletzander <mkletzan@redhat.com> wrote:
* When you are connected you don't see anything because the VM doesn't have console properly set up, I'd guess.
the xml file of my machines (all of them actually) have the below in the 'console' section.
...
...
Is it this has to be adjusted in order to 'properly set up the console' ? any pointers what to put here? tried 'bash' for 'type' but that didn't work
best ...Gunnar
This is fine, there is no need to do anything here. As I said, the only thing you need to do is convince the guest kernel to use that ttyS0 as a console (by appending console=ttyS0 as a kernel cmdline parameter). Details on how to do that are explained in my previous mail.
Also, there is no need to guess parts of the configuration, we have a documentation for the XML [1], as well as bunch of other things [2] and working man pages.
Martin
[1] https://libvirt.org/formatdomain.html [2] https://libvirt.org/docs.html

I have been coming closer to what I want (at least for the installation process) using this now sudo virt-install --name=my_domain --ram=512 --vcpus=1 \ --location=/path/to/ubuntu-16.04.1-server-amd64.iso \ --disk /path/to/vm.qcow2,device=disk,bus=virtio,size=32 \ --network bridge:br0 \ --os-type=linux \ --nographics \ --extra-args='console=tty0 console=ttyS0,115200n8 serial' I get a console view of the VM in the hosts console and can attend and guide the installation process as hoped for. I guess --extra-args='console=tty0 console=ttyS0,115200n8 serial' is what enables this. This seems not to be persisting though. After the post-installation's reboot I am at the beginning again Connected to domain ubn1604 Escape character is ^] and the '--extra-args' are not supported by 'virsh console' so, is there any way to get the 'console=tty0 console=ttyS0,115200n8 serial' up again after a reboot? --devname sounds promising but: virsh console --devname 'console=tty0 console=ttyS0,115200n8 serial' [my_domain] only gets me internal error: cannot find character device console=tty0 console=ttyS0,115200n8 serial (same with variations of the above)
On September 1, 2016 at 1:31 PM Martin Kletzander <mkletzan@redhat.com> wrote:
On Thu, Sep 01, 2016 at 10:11:38AM +0800, vrms@netcologne.de wrote:
wanted to follow up on that part (thanks about all comment suggestion regarding virt-viewer and vcn, etc. I will test them as well but would prefer the 'console way' if possible
On August 29, 2016 at 2:44 PM Martin Kletzander <mkletzan@redhat.com> wrote:
* When you are connected you don't see anything because the VM doesn't have console properly set up, I'd guess.
the xml file of my machines (all of them actually) have the below in the 'console' section.
...
...
Is it this has to be adjusted in order to 'properly set up the console' ? any pointers what to put here? tried 'bash' for 'type' but that didn't work
best ...Gunnar
This is fine, there is no need to do anything here. As I said, the only thing you need to do is convince the guest kernel to use that ttyS0 as a console (by appending console=ttyS0 as a kernel cmdline parameter). Details on how to do that are explained in my previous mail.
Also, there is no need to guess parts of the configuration, we have a documentation for the XML [1], as well as bunch of other things [2] and working man pages.
Martin
[1] https://libvirt.org/formatdomain.html [2] https://libvirt.org/docs.html
participants (3)
-
Dominique Ramaekers
-
Martin Kletzander
-
vrms@netcologne.de