Thanks Barry
That (unchecked) "host kernel accelerator for virtio net (NEW)" option looks interesting. I sometimes use either -vga std ... or -vga -virtio ... qemu boot parameter and virtio does seem quicker. I also use virtio net (and file) in some boots such as OpenBSD
Code: Select all
# ensure virtualisation is turned on in BIOS
modprobe kvm-amd
# or modprobe kvm-intel if running a intel cpu
qemu-system-x86_64 -m 2048 \
-vga std -usbdevice tablet \
-cpu host -machine type=pc,accel=kvm -k en-gb -smp 2 \
-drive if=virtio,file=disk.qcow2,format=qcow2 \
-enable-kvm \
-netdev user,id=mynet0,hostfwd=tcp:127.0.0.1:2223-:22 \
-device virtio-net,netdev=mynet0
... that's to boot a existing installed OpenBSD, after having downloaded and run the installation into a virtual disk
Code: Select all
qemu-img create -f qcow2 disk.qcow2 32G
wget https://www.mirrorservice.org/pub/OpenBSD/6.8/amd64/cd68.iso
Run installer:
qemu-system-x86_64 -m 2048 \
-cdrom cd68.iso \
-drive if=virtio,file=disk.qcow2,format=qcow2 \
-enable-kvm \
-netdev user,id=mynet0,hostfwd=tcp:127.0.0.1:2222-:22 \
-device virtio-net,netdev=mynet0 \
-smp 2
cd68.iso, the installation image, is just 10MB, and OpenBSD's installation process is very simple, pure textual and mostly involves just pressing ENTER. I tend to set up a additional userid during installation, such as for userid 'spot'
One of the first things most would probably do once booted is to install jwm
pkg_add jwm
and set that as the window manager i.e. edit/create .xsession to have a content of jwm. Maybe then pkg_add rox-filer ... and whatever.
That hostfwd=tcp:127.0.0.1:2223-:22 parameter, is just saying to set up port 2222 on the host, as a access to port 22 on the guest, i.e. so you can ssh into the guest from the host using port 2222 (ssh localhost -p 2222). So worthwhile when installing to make sure the enable sshd option is checked.
Mine complains about the -usbdevice tablet parameter, but still works. Depending upon how you run things dropping that out may work better than having it included. Basically it aligns the mouse as you move the mouse from host to guest. Without it you may find that you end up with two mouse cursors and having to figure out which one is the one inside the guest system.
The -m parameter is how much memory in MB to allocate to the guest, On my 4GB laptop I use -m 2048 (i.e. 2GB), which is more than enough. -smp is how may cores to allocate, I allocate the same 2 cores as available on the host (laptop), but you can set that higher, I could for instance use -smp 4 and it still boots and appears to have 4 cores.
-k is the keyboard, for me that's en-gb, with no -k specified it defaults to us keyboard. As per /usr/share/qemu/keymaps
If you run
qemu-system-x86_64 -cpu ?
it will report back all of the cpu's available to be emulated, I usually just set it to -cpu host ... i.e. it 'emulates' the same cpu as the actual host cpu.
If you include a -vnc :59 parameter then it will serve to vnc instead of a window, i.e. you can vnc into localhost:5959 (that vnc parameter is a number relative to the default 5900 vnc port i.e. -vnc :10 would be vncviewer localhost:5910). When using vnc type qemu, X doesn't even need to be loaded/running (useful for headless setups).
One of the first things I do after installing OpenBSD is to edit .Xdefaults
Code: Select all
Xft.dpi: 144
xterm.faceName: DejaVu Sans Mono
xterm.faceSize: 12
xterm*background: black
xterm*foreground: lightgray
! xrdb /home/spot/.Xdefaults ... to reload into current session
.. for a larger text size. That's quite a high Xft.dpi value, more usually its set to a value of 96 (I do quite a bit using xterm/tmux such as irc, mutt ...etc, so I like a more old style 80x24 type text look).