#976808 with "-display gtk" arrow keys are received as just ^[ on ttyAMA0

Package:
qemu-system-arm
Source:
qemu
Description:
QEMU full system emulation binaries (arm)
Submitter:
Ryutaroh Matsumoto
Date:
2021-07-15 14:21:03 UTC
Severity:
normal
Tags:
#976808#5
Date:
2020-12-08 07:59:51 UTC
From:
To:
Dear Maintainer,
As I reported at
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=976807
Bullseye arm64 d-i does not provide graphical installation
to QEMU VMs. So I tried text-based installation. The
installer says:
<Tab> moves; <Space> selects; <Enter> activates buttons

But <Space> is not recognized. When I type an alphabet letter,
the selection moves to an item starting with that letter,
but when there are multiple items starting with the same latter
(e.g. Africa and Asia), I cannot choose the second item (e.g. Asia).
This really prevents me from installation...

qemu-system-aarch64 is started as follows:

#!/bin/sh

ARCH=arm64
IMAGE=/var/tmp/qemu-disk-${ARCH}.qcow2
CDROM=/var/tmp/debian-bullseye-DI-alpha3-${ARCH}-netinst.iso
rm -f $IMAGE
qemu-img create -f qcow2 -o compat=1.1 -o lazy_refcounts=on -o preallocation=off $IMAGE 20G
cd /var/tmp
cp /usr/share/AAVMF/AAVMF_VARS.fd .
qemu-system-aarch64 \
    -nographic -enable-kvm -machine virt,iommu=smmuv3,acpi=on -cpu host -m 3072 -smp 2\
    -net nic,model=virtio -net user -object rng-random,filename=/dev/urandom,id=rng0 \
    -device virtio-rng-pci,rng=rng0,id=rng-device0 \
    -drive if=virtio,file=${IMAGE},index=0,format=qcow2,discard=unmap,detect-zeroes=unmap,media=disk \
    -drive if=virtio,file=${CDROM},index=1,format=raw,readonly=on,media=cdrom \
    -drive if=pflash,format=raw,unit=0,file=/usr/share/AAVMF/AAVMF_CODE.fd,readonly=on \
    -drive if=pflash,format=raw,unit=1,file=AAVMF_VARS.fd
#    -device qemu-xhci -device usb-kbd -device usb-mouse -device ramfb
# -device virtio-gpu-pci

Best regards, Ryutaroh Matsumoto

#976808#10
Date:
2020-12-08 09:26:51 UTC
From:
To:
W dniu 08.12.2020 o 09:06, Ryutaroh Matsumoto pisze:

You have started machine in QEMU without any graphics support and got
surprised by lack of graphics?

But even with "-device virtio-gpu-pci" added Bullseye alpha3 installer
follows the path of Buster :(

Both standard and graphical installer contain kernel modules for virtio
framebuffer. And both ignore video output forcing user to use serial
console. Also while 'standard' installer gives "d-i in screen",
graphical one gave just d-i on serial console.

/proc/consoles has only ttyAMA0


I used fresh build of upstream EDK2. Command used:

qemu-system-aarch64 \
  -drive if=pflash,format=raw,file=QEMU_EFI.fd \
  -drive if=pflash,format=raw,file=QEMU_EFI-vars.fd \
  -drive
if=virtio,format=raw,readonly=on,media=cdrom,file=debian-bullseye-DI-alpha3-arm64-netinst.iso
\
  -device virtio-gpu-pci \
  -device qemu-xhci,id=usb \
  -usb \
  -device usb-kbd \
  -device usb-tablet \
  -machine virt,gic-version=3,iommu=smmuv3  \
  -cpu max  \
  -smp 2 \
  -m 4096  \
  -monitor telnet::45454,server,nowait \
  -serial stdio


I gave up on getting sane installer experience in Debian/arm64.

#976808#15
Date:
2020-12-08 09:41:50 UTC
From:
To:
Control: severity -1 normal

On that specific question, you use the arrow keys to navigate between
options and <Enter> to choose the option you want. But, there are some
questions where you mark which options you want with <Space> and
continue to the next question with <Enter>, you can identify those by
the brackets before given the options which look like:

    [*] Selected option
    [ ] Unselected option

For those questions <Space> does work on my machine with your command.
It might be a small misunderstanding, so lowering severity. But I'd
expect <Space> to answer the first kind of question as well.

#976808#22
Date:
2020-12-08 10:13:12 UTC
From:
To:
(Also bug #976807 where Ryutaroh did try with graphics support)

This only happens on arm64 ACPI systems with SPCR (QEMU VM is one) now.
The arm64 graphical installer should be working fine in this release
with device-tree systems, which do have tty0 in /proc/consoles.

You can still work around it with "console=tty0". Even more, the ACPI
case is fixed on git (by explicitly checking /dev/tty0), but that didn't
make into this alpha release.

#976808#27
Date:
2020-12-08 10:30:40 UTC
From:
To:
W dniu 08.12.2020 o 11:13, Alper Nebi Yasak pisze:

So maybe there should be message "Debian is for SBC, please use
$OTHER_DISTRO for servers/etc" on d-i website?

D-I has issues with AArch64/ACPI systems since probably forever.

#976808#32
Date:
2020-12-08 10:56:11 UTC
From:
To:
I didn't mean that. On the contrary, I'm someone trying to fix it.

No idea about those.

#976808#37
Date:
2020-12-08 23:15:08 UTC
From:
To:
Hi Alper, thank you for paying attention.

Neither the space bar nor arrow keys worked for me with Alpha 3...

When I tried a weekly build of d-i on November or October,
at least "v" and "^" worked,  d-i failed on "tasksel", and
the installation cannot be completed

But Alpha 3 does not seem to recognize "v" or "^" as subtitutes of arrow keys,
and the situation got worse. Ryutaroh

#976808#42
Date:
2020-12-08 23:26:32 UTC
From:
To:
Debian Bullseye arm64&armhf disk image for ACPI&UEFI systems
can be built on an amd64/arm64 Debian host  by mmdebstrap
(or probably qemu-debootstrap) and grub-install in grub-efi-arm64
as I did at
https://github.com/emojifreak/qemu-arm-image-builder

"Debian is for SBC" sounds too strong...

Ryutaroh

#976808#47
Date:
2020-12-10 14:36:20 UTC
From:
To:
I tried running it under different terminals (tmux, xfce4-terminal,
gnome-terminal, xterm, rxvt-unicode) in case that was the problem, but
couldn't reproduce this. Other than that I have no idea why it wouldn't
work.

(Just in case, try running "cat -v" and pressing the arrow keys -- it
prints ^[[A upto ^[[D or ^[0A upto ^[0D for me.)

For me, "v" and "^" work on the GRUB menu but not on the d-i menus (both
in Alpha 3 and Alpha 2), but I didn't test that on any weekly builds.

#976808#52
Date:
2020-12-12 04:03:29 UTC
From:
To:
From: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Date: Thu, 10 Dec 2020 17:36:20 +0300

Thank you for trying to reproduce the symptom.
I tried
* -device virtio-gpu-pci -device usb-kbd
* -device virtio-gpu-pci -device vitio-keyboard-pci.
with qemu-system-aarch64.

On my own built QEMU disk image, in both cases,
* On /dev/tty1, arrow keys print ^[[A  ^[[B and
* on /dev/ttyAMA0 they just print ^[.

This symptom is independent of Debian Installer Alpha 3, and
looks a bug in qemu-system-arm or linux-image-arm64.
So I reassign this to qemu and retitle this.

/dev/tty1 is unusable by d-i Alpha 3 with the default kernel command line,
and I added "console=tty1" to the kernel command line as
I was told at the Debian ARM mailing list.

Then I am now able to use arrow keys on the graphical installer! Thanks!
This is not an errata of d-i, but adding this workaround "console=tty1" to
https://www.debian.org/devel/debian-installer/errata
may be helpful to users.

Ryutaroh

#976808#65
Date:
2020-12-12 05:49:41 UTC
From:
To:
The symptom does not appear when I use virt-manager
instead of using qemu-system-aarch64 directly. Ryutaroh

#976808#70
Date:
2020-12-13 05:47:17 UTC
From:
To:
I have checked my reported symptom with qemu-system-arm/sid.
With -nographic, arrow keys work just fine.
With -display gtk, arrow keys does not work on ttyAMA0 as reported.

I changed the severity to minor as we know workarounds.

The reason why virt-manager does not show this symptom may be because
virt-manager uses spice. I suspect something wrong in "-display gtk".

Best regards, Ryutaroh

#976808#79
Date:
2020-12-13 09:05:27 UTC
From:
To:
I verified that the reported symptom does NOT occur with
qemu-system-x86_64 and ttyS0 serial console running on an amd64 host.
This symptom seems unique to arm(64).

Specifically, I did the following:
(1) Start Bullseye d-i Alpha3 amd64 by the following commands:

#!/bin/sh
ARCH=amd64
IMAGE=`pwd`/qemu-disk-${ARCH}.qcow2
CDROM=`pwd`/debian-bullseye-DI-alpha3-${ARCH}-netinst.iso
rm -f $IMAGE
qemu-img create -f qcow2 -o compat=1.1 -o lazy_refcounts=on -o preallocation=off $IMAGE 20G
cd /var/tmp
cp /usr/share/OCMF/OVMF_VARS.fd .
qemu-system-x86_64 \
    -vga none -display gtk -enable-kvm -machine q35 -cpu host -m 3072 -smp 2\
    -net nic,model=virtio -net user -object rng-random,filename=/dev/urandom,id=rng0 \
    -device virtio-rng-pci,rng=rng0,id=rng-device0 \
    -drive if=virtio,file=${IMAGE},index=0,format=qcow2,discard=unmap,detect-zeroes=unmap,media=disk \
    -cdrom ${CDROM} \
    -drive if=pflash,format=raw,unit=0,file=/usr/share/OVMF/OVMF_CODE.fd,readonly=on \
    -drive if=pflash,format=raw,unit=1,file=`pwd`/OVMF_VARS.fd

(2) Start the d-i with "console=ttyS0" kernel command line.
I was able to use arrow keys without problem with the d-i Alpha 3.

Best regards, Ryutaroh Matsumoto

#976808#88
Date:
2020-12-15 21:38:25 UTC
From:
To:
I had misunderstood you and was trying with -nographic earlier :) .
Found an easier way to reproduce:

qemu-system-aarch64 \
    -display gtk -enable-kvm -machine virt -cpu host -m 1G -smp 2 \
    -kernel /boot/vmlinuz -initrd /boot/initrd.img \
    -append "break console=ttyAMA0"

Then, run cat on the initramfs shell and see arrow keys result in ^[ .
For x86_64, it's console=ttyS0 and ^[[A etc. as you also found out.

#976808#93
Date:
2020-12-15 22:03:15 UTC
From:
To:
Hi Alper,
Thanks for your simpler reproducing procedure.
Several days ago I verified that this symptom also appears with the
latest github source of qemu and reported this to the upstream as
https://bugs.launchpad.net/qemu/+bug/1907952
I pasted your simpler procedure to the upstream report.

This Debian bug report also has "upstream" and "forwarded" properties.

So far, no response has been given to the upstream bug report.
Let us hope the upstream pays attention to this...

Best regards, Ryutaroh

#976808#100
Date:
2021-07-15 14:09:28 UTC
From:
To:
Hi,
this was fixed by [1] which is available in experimental
qemu       | 1:6.0+dfsg-1~exp0    | experimental           | source,
amd64, arm64, armel, armhf, i386, mips64el, mipsel, ppc64el, s390x

It is thereby fixed, although to fully be available you'll need to
wait for a backport or the next Debian release.

[1]: https://git.qemu.org/?p=qemu.git;a=commit;h=8eb13bbbac08aa077e