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

virtualisation.msize error #52

Closed
573 opened this issue Mar 7, 2022 · 9 comments
Closed

virtualisation.msize error #52

573 opened this issue Mar 7, 2022 · 9 comments

Comments

@573
Copy link
Contributor

573 commented Mar 7, 2022

error: The option `virtualisation.msize' defined in `<unknown-file>' does not exist.
  • system: "aarch64-linux"
  • host os: Linux 4.4.111-21427293
  • multi-user?: no
  • sandbox: no
  • version: nix-env (Nix) 2.3.16
  • channels(nix-on-droid): "home-manager-21.11, nix-on-droid-21.11, nixpkgs-21.11.336020.2128d0aa28e"
  • nixpkgs: /nix/store/3xxi7mfxzc2cr39z7slpiksl524aj9ma-nixexprs.tar.xz
@Mic92
Copy link
Owner

Mic92 commented Mar 7, 2022

Not sure what is going wrong on your device. This option definitely exists on 21.11: https://github.com/NixOS/nixpkgs/blob/17ee68bc368e175369258b97316328d6bca11d3b/nixos/modules/virtualisation/qemu-vm.nix#L306

@573
Copy link
Contributor Author

573 commented Mar 7, 2022

I did as described in https://github.com/Mic92/nixos-shell#channelsnix_path

Then started nixos-shell as in

NIX_PATH=nixpkgs=channel:nixos-19.09-small make test

Reason:

/nix/store/qcsabcswq1sswl20nrnyi1i14zx24sp4-nixos-shell/bin/nixos-shell examples/vm.nix /nix/store/y5kvyby13kv6li8c1zaagmx0i651in9g-nixos-vm
Could not access KVM kernel module: No such file or directory
qemu-system-aarch64: failed to initialize kvm: No such file or directory

I want to circumvent this error by using the old channel. Does not seem to use the channel though.

@573
Copy link
Contributor Author

573 commented Mar 7, 2022

With kvm disabled and 21.11 channel I got the same error message.

@Mic92
Copy link
Owner

Mic92 commented Mar 7, 2022

the virtualisation module in nixos uses qemu-kvm by default: https://github.com/NixOS/nixpkgs/blob/17ee68bc368e175369258b97316328d6bca11d3b/nixos/modules/virtualisation/qemu-vm.nix#L563
You would need to disable that if you want to use on a platform without kvm support.

@Mic92
Copy link
Owner

Mic92 commented Mar 7, 2022

@573
Copy link
Contributor Author

573 commented Mar 7, 2022

diff --git a/examples/vm.nix b/examples/vm.nix
index 54480b8..9751765 100644
--- a/examples/vm.nix
+++ b/examples/vm.nix
@@ -1,4 +1,8 @@
 { pkgs, ... }: {
+  virtualisation.qemu = {
+    package = pkgs.qemu;
+    options = [ "-cpu max" ];
+  };
   boot.kernelPackages = pkgs.linuxPackages_latest;
   services.openssh.enable = true;
 }

The error persists.

@573
Copy link
Contributor Author

573 commented Mar 7, 2022

I'd have to replace the options differently I guess as they seem to not get picked up.

@Mic92
Copy link
Owner

Mic92 commented Mar 7, 2022

aarch64 seems to pass -enable-kvm regardless: https://github.com/NixOS/nixpkgs/blob/master/nixos/lib/qemu-common.nix#L27
This is a limitation that needs to be fixed in nixpkgs itself. It cannot be fixed in nixos-shell.

@Mic92 Mic92 closed this as completed Mar 7, 2022
@573
Copy link
Contributor Author

573 commented Mar 18, 2022

qemu-common-patched.nix:

aarch64-linux = "${qemuPkg}/bin/qemu-system-aarch64 -machine virt -cpu max";

changes in local copies of the files you linked, qemu-vm.nix importing the locally patched copy
allow me to boot nixos-shell on https://github.com/t184256/nix-on-droid

NIXOS_EXTRA_MODULE_PATH=~/nixos-shell/qemu-vm.nix NIX_PATH=nixpkgs=file:///data/data/com.termux.nix/files/home/nixexprs.tar.xz nix-shell -p gnumake --run "bin/nixos-shell -v --show-trace examples/vm.nix"
diff --git a/examples/vm.nix b/examples/vm.nix
index 54480b8..d37f371 100644
--- a/examples/vm.nix
+++ b/examples/vm.nix
@@ -1,4 +1,11 @@
 { pkgs, ... }: {
   boot.kernelPackages = pkgs.linuxPackages_latest;
   services.openssh.enable = true;
+  nixos-shell = {
+    mounts = {
+      mountHome = false;
+      mountNixProfile = false;
+      cache = "none"; # default is "loose"
+    };
+  };
 }
diff --git a/share/modules/nixos-shell.nix b/share/modules/nixos-shell.nix
index c0fec7a..e55365f 100644
--- a/share/modules/nixos-shell.nix
+++ b/share/modules/nixos-shell.nix
@@ -1,7 +1,7 @@
 { lib, options, pkgs, modulesPath, ... }:
 
 {
-  imports = [
+  disabledModules = [
     "${toString modulesPath}/virtualisation/qemu-vm.nix"
   ];

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

2 participants