HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   HOWTO-Related Questions (http://www.howtoforge.com/forums/forumdisplay.php?f=2)
-   -   kvm install guest without gui? (http://www.howtoforge.com/forums/showthread.php?t=43814)

unclecameron 3rd March 2010 18:36

kvm install guest without gui?
 
I'm running Debian Squeeze and kvm/qemu which installed successfully. Is there any equivalent to the way xen did it, where it bootstraps in and you just console in and set the rest up, or do you have to build vnc somehow to finish the guest install? I don't want a gui on either host or guest.

I have tried to start a new vm using:
Code:

virt-install --connect qemu:///system -n vm11 -r 1024 --vcpus=8 -f /home/vm/vm11.qcow3 -s 100 -c /some/path/debian/debian-testing-amd64-CD-1.iso -vnc :1 --noautoconsole --os-type linux --os-variant debianSqueeze --accelerate --network=bridge:br0 --hvm
which was successful, then try to connect to it with
Code:

vncviewer :1
or
vncviewer my.lo.cal.ip:1

but I get
Code:

Error: can't open display
I have also tried connecting to it with a Debian server running a gui on the same subnet using vnc, but it won't connect. Then I tried to use virt-install with the -serial switch, but that just errored out and wouldn't build the machine

falko 4th March 2010 18:33

Ubuntu has the vmbuilder tool which does it, but I don't know if it's available for Squeeze as well.
Otherwise, you must use VNC, but you don't need to install a desktop on the host or guest. You jsut need some desktop system with a VNC client.

unclecameron 4th March 2010 19:50

vmbuilder is available for Etch, but still waiting to be ported to Squeeze, it errors out when I attempt to run it.

on a Debian machine with a gui and vnc on the same subnet trying to connect to ip.of.kvm.box:1 I get a connection refused, though I can vnc/rdp using this same client to several other boxes on the subnet, do I need to install any other app on the KVM box? The KVM box doesn't have a gui.

If I can't get this to work, can I do the same thing in virtualbox, and is virtualbox performance similar to KVM? Most of the time I don't use gui's at all, that's a real disadvantage for server admin, which is why I used xen until it got pulled from the kernel in Squeeze :(

falko 5th March 2010 14:10

Quote:

Originally Posted by unclecameron (Post 221024)
on a Debian machine with a gui and vnc on the same subnet trying to connect to ip.of.kvm.box:1 I get a connection refused, though I can vnc/rdp using this same client to several other boxes on the subnet, do I need to install any other app on the KVM box? The KVM box doesn't have a gui.

Is there a firewall on the host? What's the output of
Code:

iptables -L
?

Quote:

Originally Posted by unclecameron (Post 221024)
If I can't get this to work, can I do the same thing in virtualbox, and is virtualbox performance similar to KVM? Most of the time I don't use gui's at all, that's a real disadvantage for server admin, which is why I used xen until it got pulled from the kernel in Squeeze :(

Yes, you can do this with vBoxheadless (see the tutorials on this site), but you still need a remote desktop connection. I can't say much about the performance, but I guess KVM should be more performant since it's an official part of the kernel.

unclecameron 5th March 2010 18:53

Since VirtualBox still needs a vnc server, I decided to just work on KVM again, in the meantime I got vncviewer to run a remote box after installing (on server)
Code:

apt-get install tightvncserver xtightvncviewer
vncserver :2 -geometry 1024x768 -depth 16 -pixelformat rgb565

now, after attempting to kill all kvm vm's from the original attempt (before trying VirtualBox) and then trying to install a new one with my :2 display selected, like this:
Code:

virt-install --connect qemu:///system -n sq1 -r 1024 --vcpus=8 \
 -f /home/vm/sq1.qcow5 -s 50 \
 -c /path/to/debian-testing-amd64-CD-1.iso \
 -vnc :2 --noautoconsole --os-type linux --os-variant debianSqueeze \
 --accelerate --network=bridge:br0 --hvm

I get
Code:

ERROR    Guest name 'c' is already in use.
Why do I get this, I'm not specifying guest 'c'? When I enter virsh and run
Code:

virsh # list --all
 Id Name                State
----------------------------------
  - c                    shut off
  - vm10                shut off
virsh # destroy c
error: Failed to destroy domain c
error: Requested operation is not valid: domain is not running
virsh # domstate c
shut off
virsh # dominfo c
Id:            -
Name:          c
UUID:          b341252f-46f2-ff62-ef38-71ef2d441cf0
OS Type:        hvm
State:          shut off
CPU(s):        8
Max memory:    1048576 kB
Used memory:    1048576 kB
Autostart:      disable
Security model: qemuDAC
Security DOI:

how do I remove that guest and why can't I create a new one with the above virt-install command? I tried to start 'c' vm and then looked at it, here's what I have:
Code:

ps aux | grep virt
root      1932  0.0  0.0 245148  8452 ?        Sl  08:33  0:00 /usr/sbin/libvirtd -d
106      2449  0.1  0.0 1732084 11884 ?      S    09:27  0:02 /usr/bin/qemu-system-x86_64 -S -M pc-0.11 -m 1024 -smp 8 -name c -uuid b341252f-46f2-ff62-ef38-71ef2d441cf0 -nographic -monitor unix:/var/lib/libvirt/qemu/c.monitor,server,nowait -boot c -drive file=/home/vm/vm11.qcow3,if=ide,bus=0,unit=0,format=raw -drive if=ide,media=cdrom,bus=1,unit=0 -net nic,macaddr=52:54:00:37:4f:e1,vlan=0,name=net0 -net tap,fd=46,vlan=0,name=hostnet0 -serial pty -parallel none -usb -usbdevice tablet -vga none -balloon virtio

but it's not connected to a display so I can't view it on a remote machine, and even if I
Code:

kill 2449
I still get the same error when trying to create a new hostname. I think the install is hung, I just can't figure out how to unhang it :(

unclecameron 5th March 2010 22:55

I have also tried to
Code:

virsh
unregister c

but it said there's no such domain, then I updated my switches to virt-install man page for squeeze, so it looks like:
Code:

virt-install --connect qemu:///system -n sq1 -r 1024 --vcpus=8 \
--file=/home/vm/sq1.qcow5 size=50 \
--location=http://ftp.us.debian.org/debian/dists/squeeze/main/installer-amd64/ \
-vnc :2 --noautoconsole --os-type=linux --os-variant=debiansqueeze \
--accelerate --network=bridge:br0 --hvm

but I get the same error:
Code:

ERROR    Guest name 'c' is already in use.
I have also tried using
Code:

virt-install --prompt
to do it interactively, but that script errors out with
Code:

ERROR    this function is not supported by the hypervisor: virConnectNumOfDefinedStoragePools
Traceback (most recent call last):
  File "/usr/bin/virt-install", line 972, in <module>
    main()
  File "/usr/bin/virt-install", line 762, in main
    options.sparse, options.nodisks, guest, conn)
  File "/usr/bin/virt-install", line 314, in get_disks
    get_disk(disk, size, sparse, guest, conn, is_file_path)
  File "/usr/bin/virt-install", line 280, in get_disk
    d = cli.disk_prompt(None, kwargs)
  File "/usr/lib/pymodules/python2.5/virtinst/cli.py", line 427, in disk_prompt
    dev = VirtualDisk(**arg_dict)
  File "/usr/lib/pymodules/python2.5/virtinst/VirtualDisk.py", line 372, in __init__
    self.__validate_params()
  File "/usr/lib/pymodules/python2.5/virtinst/VirtualDisk.py", line 863, in __validate_params
    self.__check_if_path_managed()
  File "/usr/lib/pymodules/python2.5/virtinst/VirtualDisk.py", line 733, in __check_if_path_managed
    os.path.dirname(self.path))
  File "/usr/lib/pymodules/python2.5/virtinst/util.py", line 553, in lookup_pool_by_path
    inactive_list = conn.listDefinedStoragePools()
  File "/usr/lib/python2.5/site-packages/libvirt.py", line 1583, in listDefinedStoragePools
    if ret is None: raise libvirtError ('virConnectListDefinedStoragePools() failed', conn=self)
libvirtError: this function is not supported by the hypervisor: virConnectNumOfDefinedStoragePools

after I specify filesystem type. Racking my brains out :(

falko 6th March 2010 12:13

Did you try
Code:

undefine c
in virsh?

unclecameron 6th March 2010 20:56

Code:

virsh # undefine c
error: failed to get domain 'c'
error: Unknown failure
virsh # list --all
 Id Name                State
----------------------------------

virsh # quit

#: virt-install --connect qemu:///system -n sq1 -r 1024 --vcpus=8 \
> --file=/home/vm/sq1.qcow5 size=50 \
> --location=http://ftp.us.debian.org/debian/dists/squeeze/main/installer-amd64/ \
> -vnc :2 --noautoconsole --os-type=linux --os-variant=debiansqueeze \
> --accelerate --network=bridge:br0 --hvm
ERROR    Guest name 'c' is already in use.


unclecameron 6th March 2010 21:37

I submitted a bug report to Debian Squeeze bugtracker, will post back here if I hear something, unless someone here has any suggestions left?

unclecameron 8th March 2010 23:56

ok, even after you run virsh, you still have to connect to the local machine to undefine it:
Code:

virsh -c qemu:///system undefine c
but then something is wrong with my setup I'm using the create a new domain with virt-install, this tries to create another domain named 'c' for some reason, I'm betting it's due to a deprecated switch of some kind, possibly on the .iso source location, so I'm trying:
Code:

virt-install --connect qemu:///system --name sq3 --ram 1024 --vcpus=8 -f /home/vm/vm14.qcow5 -s 100 --location=http://ftp.us.debian.org/debian/dists/squeeze/main/installer-amd64/ --vnc :2 --network=bridge:br0 --hvm
but that gives me the error:
Code:

ERROR    operation failed: failed to retrieve chardev info in qemu with 'info chardev'
I'll post if I get it working. In the meantime, just use Debian Lenny, it's far easier, I needed Squeeze because Lenny didn't have my NIC drivers for a HP DL180 G6 and I didn't want to compile them, they are part of Squeeze though.


All times are GMT +2. The time now is 20:02.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.