Issue with Graphical Interface on RISC-V Emulation in QEMU

Host environment

  • Operating system: Ubuntu
  • OS/kernel version: 6.5.0-15-generic #15~22.04.1-Ubuntu
  • Architecture: x86
  • QEMU flavor: qemu-system-riscv64
  • QEMU version: 7.2
  • QEMU command line:
qemu-system-riscv64 -machine virt -m 2048 -smp 4 -bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.bin -kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf -drive file=ubuntu-22.04.3-preinstalled-server-riscv64+unmatched.img,format=raw,if=virtio

Emulated/Virtualized environment

  • Operating system: Ubuntu
  • OS/kernel version: 22.04.3
  • Architecture: RiscV64

Description of problem

I am facing an issue when attempting to run Ubuntu on RISC-V architecture in QEMU with a graphical interface. Specifically, when executing the following command without the -nographic option, the operating system fails to start:

qemu-system-riscv64 -machine virt -m 2048 -smp 4 -bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.bin -kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf -drive file=ubuntu-22.04.3-preinstalled-server-riscv64+unmatched.img,format=raw,if=virtio

I have not found any examples online where QEMU is used with RISC-V architecture without the -nographic option, which raises uncertainty about the feasibility of running it with a graphical interface.

Interestingly, when I run a similar command for x86_64 architecture, the operating system starts successfully with a graphical interface:

qemu-system-x86_64 -enable-kvm -m 2G -drive file=ubuntu-22.04.3-desktop-amd64.iso,format=raw -boot c -cpu host -vga std -device virtio-net-pci -device virtio-rng-pci

Steps to reproduce

Execute QEMU with RISC-V architecture without the -nographic option.

qemu-system-riscv64 -machine virt -m 2048 -smp 4 -bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.bin -kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf -drive file=ubuntu-22.04.3-preinstalled-server-riscv64+unmatched.img,format=raw,if=virtio

(The above command fails to start with a graphical interface)

Execute QEMU with RISC-V architecture and the -nographic option.

qemu-system-riscv64 -machine virt -nographic -m 2048 -smp 4 -bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.bin -kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf -drive file=ubuntu-22.04.3-preinstalled-server-riscv64+unmatched.img,format=raw,if=virtio

(The above command works, but without a graphical interface)

Execute QEMU with x86_64 architecture.

qemu-system-x86_64 -enable-kvm -m 2G -drive file=ubuntu-22.04.3-desktop-amd64.iso,format=raw -boot c -cpu host -vga std -device virtio-net-pci -device virtio-rng-pci

(The above command works and starts with a graphical interface)

Expected Behavior:

I expect to be able to emulate Ubuntu on RISC-V architecture with QEMU and have a functioning graphical interface when omitting the -nographic option. However, due to the lack of examples without -nographic, there is uncertainty about the feasibility.

Actual Behavior:

When attempting to run QEMU with a graphical interface on RISC-V architecture without the -nographic option, the operating system fails to start.

Thank you for your assistance in resolving this issue. I appreciate any guidance on whether running QEMU with RISC-V architecture and a graphical interface without -nographic is possible.