Using qemu without a gui
Enable Virtualization in your PC UEFI/BIOS.
In order to use -enable-kvm option (see below at qemu invokation)
we may need to enable hardware virtualization.
(help needed to clarify the validity of that assertion)
Hardware virtualization feature is disabled by default
on AMD and Intel CPU’s. So you will have to enable them
manually if you do wish to use it. Otherwise QEMU will be very slow.
If you have Intel CPU, then all you have to do is, enable
VT-x or VT-d from the BIOS of your motherboard.
For AMD CPU, you have to enable AMD-v from the BIOS of
your motherboard.
If your CPU supports hardware virtualization, and you
enabled it from the BIOS of your computer, then you can
check whether Virtualization is enabled :
$ lscpu | grep Virt
or
$ egrep --color=auto 'vmx|svm|0xc0f' /proc/cpuinfo
Installation in Daedalus
I list qemu packages that emulate some known cpu architectures:
- qemu-system-x86
- /usr/bin/kvm
- /usr/bin/qemu-system-amd64
- /usr/bin/qemu-system-i386
- /usr/bin/qemu-system-x86_64
- qemu-system-arm
- qemu-system-misc
- /usr/bin/qemu-system-riscv32
- /usr/bin/qemu-system-riscv64
For each of these binaries we can get a more detailed list
of supported cpus and various boards,systems build around that cpu:
$ qemu-system-x86_64 -machine help
pc Standard PC (i440FX + PIIX, 1996) (alias of pc-i440fx-7.2)
pc-i440fx-7.2 Standard PC (i440FX + PIIX, 1996) (default)
q35 Standard PC (Q35 + ICH9, 2009) (alias of pc-q35-7.2)
pc-q35-7.2 Standard PC (Q35 + ICH9, 2009)
$ qemu-system-x86_64 -cpu help
x86 486 (alias configured by machine type)
x86 486-v1
x86 pentium (alias configured by machine type)
x86 pentium-v1
x86 coreduo (alias configured by machine type)
x86 coreduo-v1 Genuine Intel(R) CPU T2600 @ 2.16GHz
x86 phenom (alias configured by machine type)
x86 phenom-v1 AMD Phenom(tm) 9550 Quad-Core Processor
$ qemu-system-riscv64 -machine help
Supported machines are:
microchip-icicle-kit Microchip PolarFire SoC Icicle Kit
none empty machine
shakti_c RISC-V Board compatible with Shakti SDK
sifive_e RISC-V Board compatible with SiFive E SDK
sifive_u RISC-V Board compatible with SiFive U SDK
$ qemu-system-riscv64 -cpu help
any
rv64
shakti-c
sifive-e51
sifive-u54
x-rv128
$ qemu-system-arm -machine help
cubieboard cubietech cubieboard (Cortex-A8)
microbit BBC micro:bit (Cortex-M0)
raspi2b Raspberry Pi 2B (revision 1.1)
$ qemu-system-arm -cpu help
arm946
cortex-a15
cortex-a7
creating our first virtual devuan machine with two commands !
Prerequisites:
- qemu-system-x86 installed
- net iso installation medium of devuan stable downloaded.
$ cd myvirtualmachines
# creating our virtual disk
$ qemu-img create -f qcow2 devuanstable.qcow2 16G
# creating our vm
$ qemu-system-x86_64 -enable-kvm -m 2048 -nic user,model=virtio \
-drive file=devuanstable.qcow2,media=disk,if=virtio \
-cdrom devuan_daedalus_5.0.1_amd64_netinstall.iso
# starging our vm
$ qemu-system-x86_64 -enable-kvm -m 2048 -nic user,model=virtio -drive file=devuanstable.qcow2,media=disk,if=virtio
When invoking qemu to start our vm we must at least provide :
- -enable-kvm / or the emulation would be vary slow
- -m 2048 / the default (128MiB) may crash the program.
Due to default values we can run our emulated x86_64 system with:
$ qemu-system-x86_64 -enable-kvm -m 2048 devuanstable.qcow2