Web lists-archives.com

Re: qemu redirecting guest output in terminal




	Hi.


On Sun, Oct 28, 2018 at 05:51:13PM +0100, john doe wrote:
> On 10/26/2018 4:44 PM, Reco wrote:
> > Nah, we don't do Windows here. Way too many quirks for my personal
> > taste.
> > What you can try is to replace stdio with telnet:
> > 
> > qemu -hda debian.img -m 1024 \
> > 	-chardev socket,id=tty0,port=5555,server,telnet \
> > 	-serial chardev:tty0 -nographic \
> > 	-kernel vmlinux -append 'console=ttyS0,115200n8' \
> > 	-initrd initrd.gz
> > 
> > Port 5555 is just an example, obviously.
> > And you'll need telnet, but since you're using Cygwin you should got it
> > covered.
> > 
> 
> While trying the above command, I get an error probably because I didn't
> install the telnet package on Cygwin.

No, it was because I left out one argument that did not have a default
value. This should work (works for me at least):

qemu -hda debian.img -m 1024 \
	-chardev socket,id=tty0,host=127.0.0.1,port=5555,server,telnet \
	-serial chardev:tty0 -nographic \
	-kernel vmlinux -append 'console=ttyS0,115200n8' \
	-initrd initrd.gz

If you're seeing something like:

QEMU waiting for connection on: disconnected:telnet:127.0.0.1:5555,server

that means it works, connect with telnet, or netcat, or whatever.


> Qemu supports using COM port and I have install com0com (1) but when
> using '-serial COM25' I get the following error:
> 
> $ qemu-system-x86_64.exe -drive file=debian.img,format=raw -boot c -m
> 8192 -nographic -accel hax -machine q35 -serial COM25
> HAX is working and emulator runs in fast virt mode.
> QEMU 3.0.0 monitor - type 'help' for more information
> (qemu) C:\Program Files\qemu\qemu-system-x86_64.exe: -serial COM25:
> Failed CreateFile (2)
> C:\Program Files\qemu\qemu-system-x86_64.exe: -serial COM25: could not
> connect serial device to character backend 'COM25'
> 
> I guess I'm missing something in the above command?

-serial [dev] means:

Redirect the virtual serial port to host character device dev.

As I wrote earlier, we don't do Windows here, so I cannot produce a
Windows equivalent of /dev/com25.


> > 
> >> Using Cygwin the output is not mest up but during the installation I'm
> >> stuck at:
> >>
> >> "No disk drive was detected. If you know the name of the driver needed
> >> by your
> >> disk drive, you can select it from the list.
> >> Driver needed for your disk drive:
> >>   1: continue with no disk drive [*], 46: loop,"
> >>
> >> Should I select the default option (1) or what should I do?
> > 
> > No, that means that whatever you did with Cygwin denied QEMU read-write
> > access to a file that represents a disk drive. An installation is
> > impossible.
> > 
> 
> Yep, removing 'debian.img' an recreating it by doing the below command
> did it:
> 
> $ qemu-img create debian.img 25G

Reco