Enable serial console for img build in grub?

Hi,

I think it is handy to enable serial console in grub for the .img build, so when user just want to try out the img, they could have serial console to the img instance by virsh console . I noticed also when ipfire img instance startup, it automatically runs setup script for initial setup including networking, this would be easier for user to try out ipfire quickly, what do you think?

now I workaround this by converting the img to qcow2
qemu-img convert -O qcow2 ipfire2.img /tmp/ipfire2.qcow2

then virt-edit /tmp/ipfire2.qcow2 /etc/default/grub with addition of following:

GRUB_CMDLINE_LINUX="rd.auto panic=10 console=tty0 console=ttyS0,115200n8"
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop==1"

also virt-edit /tmp/ipfire2.qcow2 /boot/grub/grub.cfg with:

linux   /vmlinuz-6.6.15-ipfire root=UUID=06d532fa-33fb-4365-8b8d-40313b216ba7 ro rd.auto panic=10 console=tty0 console=ttyS0,115200n8
1 Like