Using virt-install / virsh without vnc

This is my first post. I’ve started tinkering with computers again and I will drop a line here every now and then about something I find useful (even if you may think it is not šŸ™‚ ).

I have been using KVM for a while now and mostly install virtual machines using virt-install, activating VNC, completing the installation that way.
Getting bored with always using a vnc client / virt-manager I decided to try it another way.
The tricky part was passing the console=ttyS0 to the kernel. When you use a networkinstall (using the -l switch in virt-install) you can specify extra arguments (using -x). As I am using netinstalls mostly, this is no problem for me.
For Ubuntu/Debian this results in:

virt-install -n <domain name> -r <ram in megabytes> -l < network mirror, e.g.:> –disk <disk,options> -w <network, options> –nographics -x “console=ttyS0”

This will let you install on a serial console.

During installation I enable ssh.

Post installation, log in with ssh, edit /etc/default/grub to include GRUB_CMDLINE_LINUX=”console=ttyS0″ and run update-grub.

Further more run:

systemctl enable serial-getty@ttyS0.service
systemctl start serial-getty@ttyS0.service

To enable the serial console getty service in systemd and start it right away.

Voila! virsh console works. No more VNC.

Now you can virsh console <domain>.

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *