5

Apologies if this question has been answered elsewhere but I can't see it.

I would like to set up two VMs on a RP 4 to help in a piece of research I am doing. Is there a tool that can do this? I don't need the VMs to do very much except generate some network traffic and conduct some logging so I am not expecting the computing power to be much. I would conventionally use KVM/QEMU on my other Linux machine but have worked out so far this isn't an option on Raspberry Pi architecture.

Many thanks

Alex

A Bingham
  • 97
  • 1
  • 1
  • 7

3 Answers3

5

If you do not want to use hardware virtualization features, your best chance to use containers like Docker or LXC as goldilocks said.

When I read your question, my first think was Docker because I used it earlier. After I see goldilocks's answer and I see LXC ...

I'm not try it yet, but it is possible its better chance in your situation. https://linuxcontainers.org/lxc/introduction

"LXC containers are often considered as something in the middle between a chroot and a full fledged virtual machine. The goal of LXC is to create an environment as close as possible to a standard Linux installation but without the need for a separate kernel."

There is a little blog about the differences beetwen LXC and Docker: https://pasztor.at/blog/lxc-vs-docker

"Common misconception: Docker does not use LXC. In the beginning Docker used the LXC command line tools to run containers, but that is no longer the case. Both Docker and LXC use the containerization features in the Linux kernel, but are independent of each other. "

Rastlin
  • 66
  • 2
5

I've spent nearly a year perfecting a command-line tool for RPi called vdesktop.
It does exactly what you want - boot a RaspiOS image in a virtual container. As opposed to manual methods like chroot and systemd-nspawn, Vdesktop is the only tool that displays the container's entire graphical desktop.
Other unique features include sound syncing, clipboard syncing, and the ability to boot from attached SD Cards and .img files.

Here's my vdesktop repository: https://github.com/Botspot/vdesktop
And below is a GIF showing the entire boot process: animated

Botspot
  • 1,829
  • 9
  • 29
4

generate some network traffic and conduct some logging

That doesn't sound like something you need a heavy weight VM like QEMU for. You don't need to emulate a different hardware platform, right? And the OS is going to be some linux flavour (methinks you don't have much of a choice there).

This is what containers are for, aka operating system (as opposed to "machine") virtualization. Look into LXC or docker, both of which use containerization implemented in the kernel; what you get is an independent OS userspace (ie., all the running software except the kernel):

https://docs.docker.com/get-started/

You could also chroot, which is simpler but more constrained. Containers evolved from chroot.

goldilocks
  • 60,325
  • 17
  • 117
  • 234