2

Stéphane Chazelas wrote that Can I start Debian on a text virtual console in a virtual machine?

You could also not give a virtual graphics card at all to your VM and have the console on serial. Like for a physical server, that makes it easier to operate the VM as you can then more easily copy-paste text when you access that console from a terminal emulator on the host.

In both virsh and virt-manager, how can I:

  • not give a virtual graphics card at all to both a to-be-created VM and an existing VM (created in any way, either by virsh or virt-manager), and
  • have the console on serial, and
  • access that console from a terminal emulator on the host?
2

1 Answer 1

5

When I build a new VM, I use the virt-install command. Effectively the command I end up with is something like:

$ virt-install \
-n $machine_name \
-r $ram_size \
--vcpus=1 \
--os-variant=rhel7 \
--accelerate \
-v \
--network=bridge=br0 \
--disk path=$destfile,size=$disksize \
-l $repo \
--nographics \
-x "ks=http://10.20.30.40/CentOS/kickstart/centos7.cfg ksdevice=eth0 ip=dhcp console=ttyS0,9600 cmdline"

This is for a CentOS7 build and points to my internal source server (10.20.30.40) to pick up the kickstart file. The --nographics tells virt-build to not add a graphics card, and the console=ttyS0,9600 cmdline tells the installer to work via serial.

Once the machine has been built and is running then I can do virsh console $machinename to get to the serial console, eg.:

$ virsh console hass
Connected to domain hass
Escape character is ^]

CentOS Linux 7 (Core)
Kernel 3.10.0-957.10.1.el7.x86_64 on an x86_64

hass login: 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .