public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Aleksander Alekseev <afiskon@devzen.ru>
To: Elazar Leibovich <elazar.leibovich@ravellosystems.com>
Cc: KVM devel mailing list <kvm@vger.kernel.org>
Subject: Re: User question: how to connect two VMs using serial port?
Date: Mon, 14 Mar 2016 22:34:49 +0300	[thread overview]
Message-ID: <20160314223449.488c10e8@fujitsu> (raw)
In-Reply-To: <CAL2Y34CpFo32W+M=Bd6YJkF0-Kv8eKftJC4EZLttJjGf0Sm-hw@mail.gmail.com>

> 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/

  reply	other threads:[~2016-03-14 19:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-14 10:10 User question: how to connect two VMs using serial port? Aleksander Alekseev
2016-03-14 11:22 ` Elazar Leibovich
2016-03-14 12:03   ` Aleksander Alekseev
2016-03-14 12:19     ` Elazar Leibovich
2016-03-14 19:34       ` Aleksander Alekseev [this message]
2016-03-14 19:52         ` Aleksander Alekseev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160314223449.488c10e8@fujitsu \
    --to=afiskon@devzen.ru \
    --cc=elazar.leibovich@ravellosystems.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox