KVM - The Linux Kernel-Based Virtual Machine
News, Blogs and Resources on the Linux (KVM) Kernel-Based Virtual Machine

Running KVM with --nographics, no console output?

7 replies [Last post]
half
Offline
Joined: Mar 17 2009
Points: 6

Hello,

I am actually a Xen user giving KVM for a whirl :-) I'm running CentOS 5.3 and have compiled KVM-88 from source on a remote machine. I don't have physical access to this machine so I'm attempting to install a guest using command-line/console interface but this doesn't seem to be working for me. First I tried using libvirt and then afterwards qemu-system-x86_64 but in both cases it just hangs at the console output. (guest appears to be running but I can't connect to it so have to use virsh destroy to kill it).

This is how I'm trying to start the guests:

virt-install -n test-r 512 --connect=qemu:///system \
--cdrom=/dump/cdroms/CentOS-5.3-i386-LiveCD.iso \
-f /dev/vm_vg/test -f /dev/vm_vg/test-swap \
--network=bridge:vmbridge --nographics

and also tried simplifying with:

/usr/local/kvm/bin/qemu-system-x86_64 -hda vdisk.img -cdrom /dump/cdroms/CentOS-5.3-i386-LiveCD.iso \
-boot d -m 512 -nographic

In the virt-install case I get something like this:
Starting install...
Creating domain... | 0 B 00:00
Connected to domain test
Escape character is ^]

Does anyone have any ideas or recommendations on the best way to try and install guests when using a headless remote box?

Thanks in advance!

Haydn Solomon
Offline
Joined: Mar 7 2008
Points: 456
Re: kvm with -nographic

Have you tried headless vnc as outlined in this link?

http://www.linux-kvm.com/content/tip-how-run-headless-guest-machine-using-vnc-kvm

half
Offline
Joined: Mar 17 2009
Points: 6
Thanks Haydn, I've used VNC

Thanks Haydn,

I've used VNC as per your guide to create the images and then enabled ttyS0 console access which allows me to use virsh console afterwards.

Anonymous (not verified)
Hi half, could you please

Hi half,

could you please share more detail on how to enable ttyS0 console when installing guest with virt-install?

Lamnk (not verified)
Is there anyway to connect to guest's console without using vnc?

Is there anyway to connect to guest's console without using vnc at all? I have the same problem as half. Here is my output for example:

root@localhost:~# virt-install \
--name centos01 \
--arch i686 \
--ram 1024 \
--vcpus 1 \
--connect qemu:///system \
--file /var/vm/centos01-1.img \
--location http://mirror.san.fastserv.com/pub/linux/centos/5.4/os/i386/ \
--network bridge:virbr0 \
--hvm \
--nographics \
--noapic \
--noacpi \
--extra-args console=tty0 console=ttyS0,115200;

Creating domain...
Connected to domain centos01
Escape character is ^]

half
Offline
Joined: Mar 17 2009
Points: 6
Sorry for the late

Sorry for the late reply...

Anonymous,

First I add console line to my grub config, e.g. for an Arch guest:
kernel /vmlinuz26 root=/dev/vda2 ro console=ttyS0,115200

Then I edit /etc/inittab to enable ttyS0 (same Arch guest):
co:23:respawn:/sbin/agetty -8 115200 ttyS0 linux

And make sure you have ttyS0 in your /etc/securetty. Obviously I've had to adjust this set up a little for different OS.

Lamnk,

I found that I had to use VNC for guest installations. And still use this method :-)

jarrod (not verified)
ssh -X

I struggled with this until I remembered the handy option for ssh to tunnel X output. Virt-viewer should be installed on your host so if you 1) ssh -X host_ip from a remote machine with X11 then 2) virt-viewer guest_name (on host), the output of virt-viewer (gui) will tunnel across ssh to your remote machine. You might have to replace the --nographics option with --vnc but I'm not sure about that. This way works for me with the --vnc option in the virt-install command.

Matthias Kretz (not verified)
use -x

Here's the command I just found to work for installing Debian Lenny without VNC/SDL, simply connected to the shell of the remote host via ssh:

virt-install -n name -r 1024 --vcpus=2 --os-variant=debianlenny --disk /var/lib/libvirt/images/name.img,size=1 --nographics --network user -l http://ftp.de.debian.org/debian/dists/lenny/main/installer-amd64/ -x console=ttyS0,115200

The important part is the -x switch which tells the installer kernel to use the serial console.

Cheers,
Matthias

Post new comment

The content of this field is kept private and will not be shown publicly.
Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.