Web lists-archives.com

Re: qemu redirecting guest output in terminal




On 10/25/2018 8:55 PM, Reco wrote:
> 	Hi.
> 
> On Thu, Oct 25, 2018 at 05:20:46PM +0200, john doe wrote:
>> Hi,
>>
>> I'm trying to install Debian, it works if I do use the below command:
>>
>> qemu -hda debian.img -cdrom debian-9.5.0-amd64-netinst.iso -boot d -m 1024
>>
>> I'd like to redirect the output of the guest (Debian) to the terminal so
>> I have added '-nographic':
>>
>> qemu -hda debian.img -cdrom debian-9.5.0-amd64-netinst.iso -boot d -m
>> 1024 -nographic
>>
>> The guest is running but I don't see any Debian output in the terminal.
>>
>> What argument(s) should I use to redirect the output of the guest in the
>> terminal?
>>
>> I appriciate any input.
> 
> That's tricky one.
> -nographic means you discard VGA/keyboard/mouse emulation and the only
> means of user interaction is RS232 emulation.
> 
> And that means that now you have three problems:
> 
> 1) All x86 bootloaders in Debian are configured for VGA/keyboard
> input/output.
> That includes GRUB2 in a conventional install, and syslinux that's used
> in installer.
> 
> 2) Linux kernel built for x86 use VGA for output by default.
> RS232 means appending something like 'console=ttyS0,115200n8' to
> kernel's commandline.
> 
> 3) Systemd respects console= from kernel's commandline, but I cannot say
> the same for other init systems.
> 
> 
> But, you're using QEMU and that means you're in luck.
> Unpack netinst image, extract vmlinux and initrd.gz from it. You won't
> need anything else from it anyway.
> 
> 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
> installation.
> 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.
Language:
←[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! :)

Note that this e-mail is folded by my mailer.

-- 
John Doe