Jason Vas Dias
2015-Jan-05 14:03 UTC
[libvirt-users] use of qemu-kvm --chardev pipe, id=X, path=... argument ?
Please can anyone enlighten me as to why linux qemu-kvm always creates the console on my terminal, when I am trying to direct all of its input and output to a pipe ? I have created : $ mkfifo /tmp/el6x32{.in,.out,.monitor} and use the command: $ /usr/libexec/qemu-kvm -M rhel6.4.0 -cpu n270 -smp 1 \ -hda /home/rpmbuild/OEL6/img/OEL6_32.img \ -kernel /home/rpmbuild/OEL6/boot/vmlinuz-2.6.39-400.215.14.el6uek.i686 \ -initrd /home/rpmbuild/OEL6/boot/initramfs 2.6.39-400.215.14.el6uek.i686.img \ -append 'root=/dev/sda rw selinux=0 enforcing=0 console=0' \ -m 2048 -k en-gb -nographic -vga none -vnc none -enable-kvm \ -chardev pipe,id=0,path=/tmp/el6x32 -monitor pipe:/tmp/el6x32.monitor But this ends up with the kernel's console on qemu-kvm's STDIO . I actually want the console to be redirected to take input from /tmp/el6x32.in and direct output to /tmp/el6x32.out - I thought that was what the above '-chardev pipe,id=0,path=/tmp/el6x32' should do if kernel boot params 'console=0' is also supplied ? Why isn't this happening for me ? Anyone got a guest to read console input from a pipe and direct console output to a pipe ? If so, how? Thanks in advance for any replies, Jason.
Michal Privoznik
2015-Jan-05 14:13 UTC
[libvirt-users] use of qemu-kvm --chardev pipe, id=X, path=... argument ?
On 05.01.2015 15:03, Jason Vas Dias wrote:> Please can anyone enlighten me as to why linux qemu-kvm always > creates the console on my terminal, when I am trying to direct > all of its input and output to a pipe ? > > I have created : > $ mkfifo /tmp/el6x32{.in,.out,.monitor} > and use the command: > $ /usr/libexec/qemu-kvm -M rhel6.4.0 -cpu n270 -smp 1 \ > -hda /home/rpmbuild/OEL6/img/OEL6_32.img \ > -kernel /home/rpmbuild/OEL6/boot/vmlinuz-2.6.39-400.215.14.el6uek.i686 \ > -initrd /home/rpmbuild/OEL6/boot/initramfs > 2.6.39-400.215.14.el6uek.i686.img \ > -append 'root=/dev/sda rw selinux=0 enforcing=0 console=0' \ > -m 2048 -k en-gb -nographic -vga none -vnc none -enable-kvm \ > -chardev pipe,id=0,path=/tmp/el6x32 -monitor pipe:/tmp/el6x32.monitor > > But this ends up with the kernel's console on qemu-kvm's STDIO . > > I actually want the console to be redirected to take input from > /tmp/el6x32.in and direct output to /tmp/el6x32.out - > I thought that was what the above '-chardev pipe,id=0,path=/tmp/el6x32' > should do if kernel boot params 'console=0' is also supplied ? > Why isn't this happening for me ? Anyone got a guest to read console input > from a pipe and direct console output to a pipe ? If so, how? > > Thanks in advance for any replies, Jason.That's probably because qemu by default creates some serial/parallels/virtual console/... You may want to pass '-nodefaults' onto qemu-kvm command line. Michal
Jason Vas Dias
2015-Jan-05 15:01 UTC
Re: [libvirt-users] use of qemu-kvm --chardev pipe, id=X, path=... argument ?
Aha! Thank you. Yes that does prevent the default stdio console . But no output appears on the input pipe, and outputting to input end has no effect: In one terminal, I do: $ cat /tmp/el6x32.out in the main terminal, I run: $ /usr/libexec/qemu-kvm -M rhel6.4.0 -cpu n270 -smp 1 -hda /home/rpmbuild/OEL6/img/OEL6_32.img -kernel /home/rpmbuild/OEL6/boot/vmlinuz-2.6.39-400.215.14.el6uek.i686 -initrd /home/rpmbuild/OEL6/boot/initramfs-2.6.39-400.215.14.el6uek.i686.img -append 'root=/dev/sda rw selinux=0 enforcing=0 console=0' -m 2048 -k en-gb -nographic -vga none -vnc none -enable-kvm -chardev pipe,id=0,path=/tmp/el6x32 -chardev tty,id=1,path=/dev/pts/4 -monitor stdio -nodefaults QEMU 0.12.1 monitor - type 'help' for more information (qemu) info status VM status: running (qemu) In another terminal I connect to the input pipe: $ cat >>/tmp/el632.in But no output appears on the /tmp/el6x32.out pipe , regardless of what is typed on the input pipe . I want to issue the login commands and then set up the shell to run commands echo'ed to the input pipe on the physical - eg. : $ echo 'ls' > /tmp/el6x32.in and read the output from the guest on the output pipe: $ cat /tmp/el632.out Anyone know any way of doing this ? I'm trying to run a nested guest in a VMware guest whose physical host CPU has VMX enabled using qemu-kvm, but guest virtual networking is disabled in VMware so I can't use ssh / telnet in the guest to run commands . Thanks for any further replies, Jason On 05/01/2015, Michal Privoznik <mprivozn@redhat.com> wrote:> On 05.01.2015 15:03, Jason Vas Dias wrote: >> Please can anyone enlighten me as to why linux qemu-kvm always >> creates the console on my terminal, when I am trying to direct >> all of its input and output to a pipe ? >> >> I have created : >> $ mkfifo /tmp/el6x32{.in,.out,.monitor} >> and use the command: >> $ /usr/libexec/qemu-kvm -M rhel6.4.0 -cpu n270 -smp 1 \ >> -hda /home/rpmbuild/OEL6/img/OEL6_32.img \ >> -kernel >> /home/rpmbuild/OEL6/boot/vmlinuz-2.6.39-400.215.14.el6uek.i686 \ >> -initrd /home/rpmbuild/OEL6/boot/initramfs >> 2.6.39-400.215.14.el6uek.i686.img \ >> -append 'root=/dev/sda rw selinux=0 enforcing=0 console=0' \ >> -m 2048 -k en-gb -nographic -vga none -vnc none -enable-kvm \ >> -chardev pipe,id=0,path=/tmp/el6x32 -monitor >> pipe:/tmp/el6x32.monitor >> >> But this ends up with the kernel's console on qemu-kvm's STDIO . >> >> I actually want the console to be redirected to take input from >> /tmp/el6x32.in and direct output to /tmp/el6x32.out - >> I thought that was what the above '-chardev pipe,id=0,path=/tmp/el6x32' >> should do if kernel boot params 'console=0' is also supplied ? >> Why isn't this happening for me ? Anyone got a guest to read console >> input >> from a pipe and direct console output to a pipe ? If so, how? >> >> Thanks in advance for any replies, Jason. > > That's probably because qemu by default creates some > serial/parallels/virtual console/... You may want to pass '-nodefaults' > onto qemu-kvm command line. > > Michal >