Qemu no keyboard (notebook)

Hey there,

I dont have keyboard on my qemu graphic interface. I know I am supposed to pass my keyboard as some kind of -usb or -device argument, however I cannot seem to find a working method. Oh, almost forgot: I am working on a notebook.

My lsusb is:

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 0bda:5538 Realtek Semiconductor Corp. Integrated_Webcam_HD
Bus 001 Device 002: ID 0715:0206  
Bus 001 Device 004: ID 8087:0aaa Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

My qemu command so far is this:

qemu-system-aarch64 \
    -M raspi3 \
    -append "rw earlyprintk=ttyAMA0,115200 loglevel=8 console=ttyAMA0,115200 root=PARTUUID=738a4d67-02 rootfstype=ext4 rootwait" \
    -cpu cortex-a53 \
    -dtb debian_bootpart/bcm2710-rpi-3-b.dtb \
    -drive id=hd-root,file=2020-02-13-raspbian-buster-lite.img,format=raw \
    -show-cursor \
    -kernel debian_bootpart/kernel8.img \
    -m 1024 \
    -serial mon:stdio

Thanks.

add this:

-usb -device usb-tablet

the result is:

qemu-system-aarch64: -device usb-tablet: No 'usb-bus' bus found for device 'usb-tablet'

I'm sorry you wrote keyboard and I thought mouse :slight_smile:
You can use Spice Redirection

This is from that page:

**Warning:** Keep in mind that when a USB device is redirected from the client, it will not be usable from the client operating system itself until the redirection is stopped. It is specially important to never redirect the input devices (namely mouse and keyboard), since it will be then difficult to access the SPICE client menus to revert the situation, because the client will not respond to the input devices after being redirected to the virtual machine.

Are you sure I can safely do it (and I still need to figure out which device my keyboard is)? :slight_smile:

You have to install on the guest OS spice-vdagent to get not to lock the keyboard and mouse.

An easier way to use QEMU and KVM, if you are not sure about the command line is virt-manager (a gui app) that uses the libvirt service.

virt-manager gets me jumping though all kinds of hoops with no result (unsupported configuration: CPU model cortex-a53 is not supported by hypervisor) - for the life of me I cannot figure it out.

As for the virt-viewer way, I probably won't be configuring the internet access through command line to download a package and configure it only to face another borderline unsolvable issue somewhere along the line :worried: The simple method I tried above will not work as per this, USB is not modeled on raspberries https://bugs.launchpad.net/qemu/+bug/1772165

So I think I'm going to give in to the frustration and just give it up.

After some further research I am pretty sure it is not possible to host aarch64 raspbian in virt-manager. First it requires an acpi property, but when I add it it will require UEFI. If I add UEFI the error message persists until (probably until, havent tried) the type is pflash, with a pflash path specified, which is obviously incorrect for raspbian.

Probably closely related: https://bugzilla.redhat.com/show_bug.cgi?id=1729604
My xml for virt-manager:


<domain type='qemu'>
  <name>rpi</name>
  <uuid>45e99191-771b-4e12-a526-0779148892cb</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
    <vcpu placement="static">4</vcpu>
  <os>
    <type arch='aarch64' machine='raspi3'>hvm</type>
    <kernel>/path/to/kernel8.img</kernel> 
    <cmdline>root=UUID=45e99191-771b-4e12-a526-0779148892cb</cmdline>
    <dtb>/path/to/debian_bootpart/bcm2710-rpi-3-b.dtb</dtb>     
    <boot dev='hd'/>
  </os>
  <features>
      <acpi/>
  </features>
  <devices>
    <emulator>/usr/bin/qemu-system-aarch64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/path/to/2020-02-13-raspbian-buster-lite.qcow2'/>       
      <backingStore/>
      <target dev='sda' bus='scsi'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='pci' index='0' model='pci-root'/>
    <interface type='bridge'>
      <mac address='52:54:00:ed:eb:c7'/>
      <source bridge='virbr0'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </interface>
    <graphics type='spice' autoport='yes'>
      <listen type='address'/>
      <image compression='off'/>
      <gl enable='no' rendernode='/dev/dri/by-path/pci-0000:00:02.0-render'/>
    </graphics>
    <video>
      <model type='virtio' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </video>
  </devices>
</domain>

After some further research, I have to realize that this issue cannot be solved, at least not on my level. The 3 approaches with their own caveats:
-virt-viewer with direct USB mapping: USB is not modeled, so the USB device cannot be mapped to the guest system
-virt-viewer with spice: USB is not modeled, so there is no networking to download packages that are required for spice
-virt-manager: acpi bug prevents launching a virtual machine in aarch64 architecture is set.

Related: https://stackoverflow.com/questions/61562014/qemu-kernel-for-raspberry-pi-3-with-networking-and-virtio-support

Forum kindly sponsored by