this post was submitted on 24 Jan 2025
14 points (85.0% liked)
Linux
50208 readers
1242 users here now
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I am testing this currently to ensure correctness, but if you're using Android Studio via Flatpak, you may need to enable kvm permissions for the application to have hardware-accelerated VMs. This can be done using Flatseal. The relevant permission (device=kvm) is under the Device section labeled as Virtualization.
Additionally, if problems are occurring outside of Flatpak, you might need to enable certain hardware virtualization technologies from your computer's BIOS (AMD-V, VT-x, VT-d, Intel VT, Virtualization, or some other similar term depending on CPU and motherboard).
EDIT: Doing testing, it seems the default permissions provided for Android Studio's Flathub Flatpak includes device=all. No permissions edits are necessary by default. If there are problems with the /dev/kvm device not being reachable, it is almost certainly due to the necessary extensions not being enabled in the BIOS, or your CPU doesn't support virtualization. Pop! OS 22.04 has the necessary components in software for KVM to function pre-installed, so nothing should be wrong on the OS side.
Thanks for the reply and the testing. It's not via Flatpak (I figured it would be best not to, since Flatpak Gnome Boxes could not create a VM because of KVM issues, while Boxes installed via sudo apt install gnome-boxes gave me no error), but a simple tar extracted in desktop.
Since AMD Virtualization is Enabled in BIOS (although I can't toggle it) and Gnome Boxes can create a VM when installed via terminal, I don't think it's a BIOS or CPU problem (otherwise no version of Boxes would allow me to run a VM, but I did launch Arch btw from inside Boxes).
Am I wrong?
Thanks!
Based on using a local installation without elevated permissions (outside of /usr/(local)), I can only guess of two things happening:
The first is GNOME Boxes asks for elevated permissions when running or otherwise uses Polkit to gain those permissions. Your user by default likely isn't granted access to /dev/kvm and running userland software without additional permissions will inherently not allow KVM access.
To allow this sanely, you can add your user to the KVM group to allow userland KVM access. It can be done via
sudo adduser "<username>" kvm
and then restarting your computer. To note, this is something that can allow any application to access virtualization without special permissions. If you don't want this change to remain forever, the commandsudo usermod -r -G kvm "<username>"
followed by a restart can revert this change.Alternatively, installing Android Studio via the Flathub Flatpak may handle permissions without needing to modify user groups in this case.
The second (unlikely, but possible) problem is the AppArmor profile blocking KVM access for userland. I don't have particularly any experience with creating modified profiles for AppArmor, if this is the cause. I could only offer terrible advice for AppArmor (disabling AppArmor or switching to warn-only, both things I do not recommend doing). Again, it might be worth trying to install Android Studio via flatpak to see if things work better if this is the cause.
Thanks a lot, appreciated. I think I'll try Flatpak Android Studio first, and move on to the suggestion of adding myself to the KVM group in case Flatpak install doesn't fix the issue. Thanks again!