Headless virt-install results in blank non-responsive prompt

Hi everyone,

I think this is just an issue with my lack of KVM experience, so maybe this isn’t even the right forum for this, but here I go anyway. Thanks for taking a look.

I’m trying to set up an almalinux VM running on an almalinux host, with virt-install and running KVM+qemu type setup. The host is headless, so bash only. I also intend for the guest to be headless.

When trying to install using the almalinux installation tree from network, I end up with a whole lot of… nothing. See below, I’m just stuck with a blank prompt no matter how long I wait:

 [lauwnch@HOM-KVM-01 ~]$ virt-install --name KVM-FOREMAN-01 --memory 4096 --vcpus 2 --disk size=60 --os-variant almalinux9 --graphics none --extra-args="console=ttys0" --location https://repo.almalinux.org/almalinux/9/BaseOS/x86_64/os 

Starting install...
Retrieving file vmlinuz...          |  11 MB  00:00:01     
Retrieving file initrd.img...       |  78 MB  00:00:07
Allocating 'KVM-FOREMAN-01.qcow2'   |  60 GB  00:00:02     
Running text console command: virsh --connect qemu:///session console KVM-FOREMAN-01
Connected to domain 'KVM-FOREMAN-01'
Escape character is ^] (Ctrl + ])

I think I set up the text console over serial port correctly, and I’m pretty sure the location I specified has a valid installation tree, since virt-install is pulling kernel and initrd correctly. I’m clearly doing something wrong here, I just don’t know what it is.

Any help or pointers are much appreciated, and if you need any more info I’m happy to provide. Thanks again!

if you want to see early boot messages and for example anaconda from a kickstart, then you need a serial device, not a console (e.g. /dev/hvc0). for example:

virt-install \
  --virt-type kvm \
  --name=alma9headless \
  --os-variant=almalinux9 \
  --cpu host-passthrough \
  --vcpus 2 \
  --memory 2048 \
  --disk path=/tmp/alma9headless.qcow2,size=40,format=qcow2,sparse=true,bus=scsi,discard=unmap \
  --controller type=scsi,model=virtio-scsi \
  --network bridge=br0,model=virtio \
  --channel unix,target_type=virtio,name=org.qemu.guest_agent.0 \
  --graphics none \
  --video none \
  --serial pty \
  --metadata title="AlmaLinux 9.0 (headless)" \
  --location /tmp/AlmaLinux-9.0-x86_64-dvd.iso \
  --extra-args='inst.ks=file:alma9_kickstart.cfg console=ttyS0' \

you don’t really need --serial pty, the important bit is the console=ttyS0 and don’t configure a graphical/virtio console. edit: oh looks like you have a typo and used lowercase ttys0

have a look around my github for some more examples

WOW you are absolutely correct, console=ttyS0 works while console=ttys0 does not. Thank you very much! That was my problem for over an hour haha, and that’s what I get for using arguments I don’t fully understand. Time to go figure out why capital S matters :slight_smile: .

no probs, glad to help.

it matters as that’s the name of the serial device in the guest /dev/ttyS0 and linux is case-sensitive of course