ゲスト側のLinuxカーネルでシリアルコンソールを有効にしているときに、ホストからpythonでシリアルコンソールにアクセスするときメモです。 ゲスト側はカーネルのコマンドラインでシリアルの設定をするのと、qemuのオプションで-serial ptyとしてptyを使うようにする。 $ qemu-kvm -initrd ./initramfs-4.17.2-200.fc28.x86_64.img -kernel ./vmlinuz-4.17.2-200.fc28.x86_64 -m 512 -append "console=ttyS0,115200" -serial pty -nographic QEMU 2.11.1 monitor - type 'help' for more information (qemu) qemu-system-x86_64: -serial pty: char