Re: qemu redirecting guest output in terminal
- Date: Sun, 28 Oct 2018 17:51:13 +0100
- From: john doe <johndoe65534@xxxxxxxx>
- Subject: Re: qemu redirecting guest output in terminal
On 10/26/2018 4:44 PM, Reco wrote:
> On Fri, Oct 26, 2018 at 03:34:55PM +0200, john doe wrote:
>>>> Run QEMU this way:
>>>> qemu -hda debian.img -m 1024 -nographic \
>>>> -kernel vmlinux -append 'console=ttyS0,115200n8' \
>>>> -initrd initrd.gz
>>>> Replace -kernel, -initrd and -append with '-boot c' after the
>>>> Also consider using '-M q35' instead of old '-M pc' you're using now.
>>> Thanks to the help of "Dejan Jocic <jodejka@xxxxxxxxx>" and to this
>>> answer I manage to get the output of the guest redirected in the
>>> terminal by using the following command:
>>> PS C:\qemu> clear; & 'C:\Program Files\qemu\qemu-system-x86_64.exe' -hda
>>> debian.img -cdrom debian-9.5.0-amd64-netinst.iso -boot d -m 1024
>>> -nographic -kernel vmlinuz -append 'console=ttyS0,115200n8
>>> DEBIAN_FRONTEND=text priority=low' -initrd initrd.gz
>>> As you can see it is done on Windows and when attempting to install
>>> Debian the output is a bit mest up:
>>> Choose the next step in the install process:
>>> 1: Choose language [*],
>>> 2: Access software for a blind person using a braille display,
>>> 3: Configure the keyboard,
>>> 4: Detect and mount CD-ROM,
>>> 5: Load installer components from CD,
>>> 6: Change debconf priority,
>>> 7: Check the CD-ROM(s) integrity,
>>> 8: Save debug logs,
>>> 9: Execute a shell,
>>> 10: Abort the installation,
>>> Prompt: '?' for help, default=1> 1
>>> Select a language
>>> Choose the language to be used for the installation process. The selected
>>> language will also be the default language for the installed system.
>>> ←[22A←[M←[22BPrompt: '?' for help, default=2> ←
>>> Looks like it is character encoding related.
>>> I understand that it is Windows/powershell but if anyone has a hint,
>>> that would be awesome! :)
> Nah, we don't do Windows here. Way too many quirks for my personal
> 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
I used Cygwin simply to test qemu with the output redirected in the
terminal but the reason why I'm looking at virtualisation/qemu is to go
away from Cygwin and to have Debian for linux related stuff!
While trying the above command, I get an error probably because I didn't
install the telnet package on Cygwin.
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?
As far as I can tell, both ports are working (COM25 and COM26).
>>> Note that this e-mail is folded by my mailer.
> Meaning that I use 'format=flowed'? It's recommended to wrap lines at 72
> characters here anyway.
>> 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
Yep, removing 'debian.img' an recreating it by doing the below command
$ qemu-img create debian.img 25G
See (2) and (3) for the 'accel hax' option.