[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: qemu redirecting guest output in terminal



	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.

Reco


Reply to: