I have Ubuntu Server with LXQT desktop running on my Raspberry Pi4 4GB. I have also installed KVM on it along with Virtual Machine Manager.
My question is can I use the Ubuntu Server 20.04 Raspberry Pi 4 image to create a VM running the same OS on the Pi4 ? If yes, any how to or steps to do the same ?
Thanks
KarnixKorner
1 Answer
You can do it, but be aware:
The Pi is usually not powerful enough to run heavy VM Guests well -- you are likely to encounter some performance problems (overheating, lagging). Especially desktops.
- Monitor your temperature sensors. Running a VM can heat up your Pi quickly - a proper cooling system is highly recommended to prevent unexpected thermal shutdowns.
- Monitor your
topandfreeusage on both Host and Guest if you encounter performance problems. - If you run into performance issues due to your host LXQT desktop, consider a lighter-weight web-based server frontend instead of a complete Desktop Environment (I recommend the cockpit package, which is in the Ubuntu repositories)
The Pi image is customized for your hardware, but the VM application presents a much more generic hardware profile to the Guest. So using a pi-specific image is unnecessary (though you CAN do it).
Consider using a cloud-image for arm64 or armhf Guests instead of a pi-specific image. Cloud images tend to be smaller, and will make migrating the Guest to another Host easier someday.
LXD containers are flexible - an LXD container behaves like a VM for most purposes, but with a fraction of the overhead of the VM application + Guest. LXD can also run real VM images with a bit of tweaking. LXD containers are even easier to spin-up, easier to migrate, and have a smaller disk footprint than VMs.
If the application that you want to run in the VM is available in a Snap already, then Ubuntu Core is a very-lighweight snap-only flavor of Ubuntu. Of course, you could run the same sandboxed snap safely without a VM in the first place, too.
For advanced folks who really want to tweak the gears on a super-lightweight image: Ubuntu Base (instructions)