ubuntu虚拟机中设置:
systemctl set-default multi-user.target
修改grub引导
GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200"
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
qemu启动命令修改
/qemu-5.1.0/build/x86_64-softmmu/qemu-system-x86_64 \
-enable-kvm \
-m 4G \
-vga qxl \
-display default \
-device e1000,netdev=net0 \
-netdev user,id=net0,net=192.168.20.0/24,dhcpstart=192.168.20.20 \
-smp 4\
-drive file=/ImageStore/ruguang/ji/ubuntu-20.04.1-desktop-amd64.qcow2,if=virtio \
-nographic -serial mon:stdio
# -spice port=8899,addr=172.17.81.26,disable-ticketing