Re: User question: how to connect two VMs using serial port?

Aleksander Alekseev
2016-03-14T19:53:09Z

Oh, never mind. I discovered that everything could be configured using
virt-manager.

Problem solved. Thanks a lot for your help!

On Mon, 14 Mar 2016 22:34:49 +0300
Aleksander Alekseev <afiskon@devzen.ru> wrote:

> > Yes,
> >
> > qemu is connecting the serial port to a FIFO, and qemu is resident
> > even after host reboot.
> >
> > In fact, even if you'll kill the qemu process and restart it with
> > the same FIFO, it should still work.
> >
> > Please try it, and report if it indeed worked for you.
>
> Frankly I'm still having some problems. But let me tell you a full
> story first.
>
> I have Ubuntu 14.04 LTS installed on my laptop Fujitsu Lifebook E733.
> I created two VMs with FreeBSD 11.0 CURRENT. What I'm trying to do is
> to debug a FreeBSD kernel using kgdb, thus I need two systems
> connected via serial port.
>
> Unfortunately using mkfifo as you described above didn't work. Right
> solution was found here:
>
> http://blog.bauermann.eng.br/2013/09/04/connecting-qemukvm-virtual-machines-via-serial-port/
>
> Now when I start VMs:
>
> sudo kvm -hda /path/to/freebsd11.img \
> -serial pipe:/path/to/null-cable-1
> sudo kvm -hda /path/to/freebsd11kgdb.img \
> -serial pipe:/path/to/null-cable-2
>
> ... serial port (/dev/cuau0) is seen in both VMs. Then I edited
> /boot/device.hints on freebsd11 VM like this:
>
> hint.uart.0.flags="0x90"
>
> ..., restarted this VM, entered boot prompt (by pressing 3 in boot
> menu), and typed:
>
> boot kernel -d
>
> This command boots kernel in debug mode. In DDB prompt I typed:
>
> gdb
>
> Now system awaits connection from 2nd system by serial port. Here is
> how to do this:
>
> su
> cd /usr/src
> sudo kgdb -r /dev/cuau0 /boot/kernel/kernel
>
> Good news is --- it works!
>
> http://i.imgur.com/bP8uioX.png
>
> But I don't have a network connection and other stuff I configured
> using `virsh`. So I tried `virsh edit MVNAME` as described here:
>
> http://blog.vmsplice.net/2011/04/how-to-pass-qemu-command-line-options.html
>
> Unfortunately now when I start VM I got an error:
>
> ```
> eax@fujitsu:~$ sudo virsh start freebsd11
>
> error: Failed to start domain freebsd11
> error: internal error: process exited while connecting to monitor:
> qemu-system-x86_64: -serial pipe:/var/lib/libvirt/pipes/null-cable-1:
> Failed to create chardev qemu: could not connect serial device to
> character backend 'pipe:/var/lib/libvirt/pipes/null-cable-1'
> ```
>
> Here is a full `sudo virsh dumpxml freebsd11` output:
>
> http://paste.ubuntu.com/15386277/
>
> Here is part of /var/log/libvirt/qemu/freebsd11.log, which contains
> long KVM command executed by virsh:
>
> http://paste.ubuntu.com/15386302/
>
> And here is how `sudo strace virsh start freebsd11` looks like:
>
> http://paste.ubuntu.com/15386306/
>
> Any ideas how to solve this issue? Naturally if there is any other
> debug information you need I will be happy to provide it.
>
>
> Best regards,
> Aleksander Alekseev
> http://eax.me/
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html