I run my QEMU version 3.0.0 by:
x86_64-softmmu/qemu-system-x86_64 -m 2560 -hda img.qcow2 -serial pty -serial pty
My host is an Ubuntu Desktop 16.04 and my guest is a fresh (i.e. default configuration) Ubuntu Server 18.04. Both are x86-64.
Upon starting, QEMU immediately prints:
qemu-system-x86_64: -serial pty: char device redirected to /dev/pts/18 (label serial0)
qemu-system-x86_64: -serial pty: char device redirected to /dev/pts/19 (label serial1)
Also, the output of info qtree (in QEMU's monitor) is:
[...]
dev: isa-serial, id ""
index = 1 (0x1)
iobase = 760 (0x2f8)
irq = 3 (0x3)
chardev = "serial1"
wakeup = 0 (0x0)
isa irq 3
dev: isa-serial, id ""
index = 0 (0x0)
iobase = 1016 (0x3f8)
irq = 4 (0x4)
chardev = "serial0"
wakeup = 0 (0x0)
isa irq 4
[...]
So it seems that serial0 and serial1 should be quite the same.
According to this site, /dev/ttyS1 should be used for the serial port whose iobase is 0x2f8, so from the output above I deduced that serial1 should be used through /dev/ttyS1.
I can work without any issue with /dev/ttyS0 in the guest and /dev/pts/18 in the host.
However, I didn't manage to work with /dev/ttyS1 in the guest, and it seems to me that serial1 doesn't exist at all in the guest.
Inside the guest, the output of dmesg | grep ttyS (which should show the existing serial ports, according to this answer):
[ 7.147289] 00:05: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
What am I missing? Why does it seem like serial1 doesn't exist inside the guest?
I found my mistake.
Because the guest startup takes so much time (at least on my machine), I always immediately used loadvm after_startup_snapshot.
I now tried to let the guest go through startup, and the redirection of /dev/ttyS1 worked perfectly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With