Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About Virtual Machines #21

Closed
loadcorp opened this issue Apr 5, 2022 · 21 comments
Closed

About Virtual Machines #21

loadcorp opened this issue Apr 5, 2022 · 21 comments

Comments

@loadcorp
Copy link

loadcorp commented Apr 5, 2022

Is it possible to use QEMU (in this case manager - https://virt-manager.org/)? I mean create virtual machines from the Host - which is Arch Linux on Apple M1.

@jannau
Copy link
Member

jannau commented Apr 6, 2022

qemu with kvm works well out of the box on M1 Pro/Max/Ultra. On the original M1 it needs an unreleased qemu version to work well out of the box. It work afaik with higmem=off. No idea if /how that works out of the box with virt-manager.

@loadcorp
Copy link
Author

loadcorp commented Apr 9, 2022

qemu with kvm works well out of the box on M1 Pro/Max/Ultra

You mean it is work from MacOS not from Asahi Linux?

@jannau
Copy link
Member

jannau commented Apr 10, 2022

no, it works in Asahi Linux. On the original M1 it will be easier to setup with the soon to be released qemu 7.0.

@loadcorp
Copy link
Author

Thanks for the clarification :)

@marcan marcan closed this as completed Apr 11, 2022
@wkozaczuk
Copy link

I have just found this issue while I was looking to see if I can use AsahiLinux as a more powerful platform for my virtualization development activities. According to this, I should be able to buy MacMini M1 (2020), install AsahiLinux on it, and run QEMU 7.0 with KVM on, right? Will I need to do anything special to enable KVM?

On a side note, I would imagine MacMini M1 is way more powerful than Odroid N2+ (https://www.hardkernel.com/shop/odroid-n2-with-4gbyte-ram-2/), no?

@wintifrosch
Copy link

@jannau: To install on a MacMini M1, sudo pacman -S qemu-system-aarch64 should work?
As it seems, there is currently a dependency error with edk2-armvirt , as posted in the ArchLinux Forum and in ArchLinux Bug Reports.
Do you have any tips for me how to proceed?

@jannau
Copy link
Member

jannau commented May 17, 2022

@wintifrosch , I don't see qemu-system-aarch64 in arch linux arm's package repo. I only have extra/qemu and extra/qemu-headless and I have the second one installed.

@wintifrosch
Copy link

@jannau I receive several non-resolvable dependencies for qemu-headless:

$ sudo pacman -S qemu-headless
resolving dependencies...
warning: cannot resolve "edk2-ovmf", a dependency of "qemu-system-x86"
warning: cannot resolve "seabios", a dependency of "qemu-system-x86"
warning: cannot resolve "qemu-system-x86", a dependency of "qemu-base"
:: The following package cannot be upgraded due to unresolvable dependencies:
      qemu-base

:: Do you want to skip the above package for this upgrade? [y/N] 

With the new QEMU Release 7, the package setup changed (ArchLinux News posted 2022-05-09 by David Runge).

With the update to qemu 7.0.0 the package has been turned into a more fine grained split package utilizing meta packages.
The qemu package is now virtually provided by the meta packages qemu-base, qemu-desktop and qemu-full.
• The functionality of qemu prior to 7.0.0 is replaced by qemu-desktop
• The functionality of qemu-headless is replaced by qemu-base

I receive the same three errors after sudo pacman -S qemu-base (edk2-ovmf, seabios, qemu-system-x86).

As it seems, QEMU was adapted for ALARM, since there's a folder on github archlinuxarm/PKGBUILDs/extra/QEMU, but I don't know how to use the files published there.


My pacman.conf shows the following entries:

[options]
HoldPkg     = pacman glibc
Architecture = aarch64
CheckSpace

SigLevel    = Required DatabaseOptional
LocalFileSigLevel = Optional

[asahi]
Include = /etc/pacman.d/mirrorlist.asahi

[core]
Include = /etc/pacman.d/mirrorlist

[extra]
Include = /etc/pacman.d/mirrorlist

[community]
Include = /etc/pacman.d/mirrorlist

[alarm]
Include = /etc/pacman.d/mirrorlist

[aur]
Include = /etc/pacman.d/mirrorlist

@jannau
Copy link
Member

jannau commented May 17, 2022

My bad, I was in a hurry and didn't want to update. Reproduced with the restructured qemu 7.0 package. The qemu update in archlinuxarm/PKGBUILDs@dff79d9 missed to add the additional dependencies.

@wintifrosch
Copy link

wintifrosch commented May 17, 2022

I don't know how to fix this. I cloned the repo git clone https://github.com/archlinuxarm/PKGBUILDs.git but couldn't make QEMU.

[~/PKGBUILDs/extra/qemu]$ makepkg
==> ERROR: qemu is not available for the 'aarch64' architecture.

Who might help me to build or install qemu-base: SBDY of the ASHAI team @marcan or kmihelich over at archlinuxarm.org? Open a new Issue here for qemu-base-aarch64?

@zanfix
Copy link

zanfix commented Jun 25, 2022

Hi there,

Well I am still unable to run a vm with kvm...

What i tried:

  • using alarm package from repo (v7): I get "Synchronous Exception" (see https://gitlab.com/qemu-project/qemu/-/issues/1002)
  • tried to revert the commit as mentioned into the link above and recompile the package (same problem)
  • tried compiling version 6.2 from source and running it with with -highmem=off. and I get: qemu-system-aarch64: -accel kvm: -m and ,maxmem option values require an IPA range (40 bits) larger than the one supported by the host (36 bits), even with 512megs of ram (if it even matters)

Am I doing something wrong?

EDIT: ok... forget it, debian 11 runs just fine, it's my attempt to install windows 11 that does not work

@marcan
Copy link
Member

marcan commented Jul 1, 2022

As that issue explains, the problem is that KVM cannot handle heterogeneous CPUs like the performance/efficiency cores in M1 machines (this used to sort of work but was never correct). You need to use taskset to restrict qemu to either the efficiency cores or the performance cores. Otherwise things will go wrong as the virtual CPUs migrate around different physical CPUs.

@zanfix
Copy link

zanfix commented Jul 1, 2022

I think that the problem is something else, efi related.
Anyway, about taskset, i tried making a cpuset cgroup and running the vm inside of it and it did not make any difference

@boris-kolpackov
Copy link

You need to use taskset to restrict qemu to either the efficiency cores or the performance cores.

For those looking at /proc/cpuinfo and wondering which ones are efficiency cores and which -- performance, at lest on M1 it appears 0-3 are E and 4-7 are P. This can be inferred by correlating the lscpu and lscpu -e output.

@marcan Can we assume that this order is reasonably stable and won't change, for example, after a kernel upgrade?

@jannau
Copy link
Member

jannau commented Aug 25, 2022

yes, the order matches how CPU cores are layout in hardware

@boris-kolpackov
Copy link

yes, the order matches how CPU cores are layout in hardware

This is the output I get on M1 from lscpu -e:

CPU NODE SOCKET CORE ONLINE    MAXMHZ   MINMHZ       MHZ
  0    0      0    0    yes 2064.0000 600.0000  600.0000
  1    0      0    1    yes 2064.0000 600.0000  600.0000
  2    0      0    2    yes 2064.0000 600.0000  600.0000
  3    0      0    3    yes 2064.0000 600.0000  600.0000
  4    0      0    0    yes 2988.0000 600.0000 1956.0000
  5    0      0    1    yes 2988.0000 600.0000 1956.0000
  6    0      0    2    yes 2988.0000 600.0000 1956.0000
  7    0      0    3    yes 2988.0000 600.0000 1956.0000

I am fuzzy on the exact meaning, but the CORE column suggests that this might not be the case.

@sheerun
Copy link

sheerun commented Aug 29, 2022

Anyone was able to install qemu? I have the same errors as @wintifrosch

@np22-jpg
Copy link

np22-jpg commented Sep 22, 2022

Anyone was able to install qemu? I have the same errors as @wintifrosch

I was able to get qemu working by downloading each individual file from a mirror (note that even though this is an x86 mirror, the packages are "any"), then using pacman -U /path/to/<package>-any.pkg.tar.zst for each individual package, as per this forum post.

@sheerun
Copy link

sheerun commented Sep 22, 2022

@np22-jpg You mean every package or some specific ones? Isn't it unsecure to mass-install packages?

@np22-jpg
Copy link

@sheerun Just the 3 that aren't in the ARM repos. So edk2-ovmf, seabios, and qemu-system-x86. Sorry for being unclear (and slightly necroposting)

@xet7
Copy link

xet7 commented Jan 1, 2023

I added to Ubuntu Asahi section of wiki https://github.com/AsahiLinux/docs/wiki/SW:Alternative-Distros links how did I build and install at Ubuntu 22.10 Asahi these:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants