QEMU: Setting a Secondary Monitor for a Guest OS without a GUI Host
The Stack Exchange Network is a collection of 183 Q&A communities, including Stack Overflow, the largest and most trusted online community for developers to learn, share their knowledge, and build their careers.
Introduction
QEMU (Quick Emulator) is a powerful open-source machine emulator and virtualizer. It can emulate a variety of architectures, including x86, ARM, PowerPC, and SPARC. QEMU can also virtualize guest operating systems, allowing multiple OSs to run on a single physical machine.
In this article, we will discuss how to set up a secondary monitor for a guest operating system running on QEMU, without a graphical user interface (GUI) on the host.
Prerequisites
To follow along with this article, you will need the following:
- A host machine running a Linux distribution
- QEMU installed on the host machine
- A guest operating system image (ISO or disk file)
Setting Up the Guest OS
To set up the guest operating system, you will need to create a virtual machine using QEMU. This can be done using the following command:
qemu-system-x86\_64 -m 1024 -cdrom -boot d -enable-kvm
This command will create a virtual machine with 1024 MB of RAM and boot from the guest operating system image. The -enable-kvm flag enables KVM (Kernel-based Virtual Machine) acceleration, which can significantly improve performance.
Once the virtual machine has booted, you can install the guest operating system as you would on a physical machine.
Setting Up the Secondary Monitor
To set up the secondary monitor, you will need to use the QEMU monitor, which is a command-line interface for managing virtual machines. The QEMU monitor can be accessed by pressing the Ctrl-Alt-2 key combination while the virtual machine is running.
Once you are in the QEMU monitor, you can use the change command to switch to the graphics console.
(qemu) change console
Once you are in the graphics console, you can use the vidmode command to set the resolution of the secondary monitor.
(qemu) vidmode 1024x768
This command will set the resolution of the secondary monitor to 1024x768. You can use the vidmode? command to see a list of available resolutions.
To switch back to the QEMU monitor, you can use the Ctrl-Alt-1 key combination.
Setting up a secondary monitor for a guest operating system running on QEMU without a GUI host is a straightforward process. By using the QEMU monitor and the change and vidmode commands, you can easily configure the resolution of the secondary monitor.
References
--endarticle--