!xmLtiCaAJxfhURjrXl:matrix.org

NixOS RISC-V

225 Members
NixOS on RISC-V https://wiki.nixos.org/wiki/RISC-V https://pad.lassul.us/NixOS-riscv64-linux https://github.com/orgs/NixOS/teams/risc-v66 Servers

Load older messages


SenderMessageTime
17 Mar 2026
@alex:tunstall.xyzAlexUpdate: it worked, thanks.00:22:11
@eljamm:matrix.orgeljamm

You could I guess try building the driverInteractive version of the test, then inside the interactive prompt run machine.shell_interact() to get a prompt (assuming this doesn't require the backdoor service, which it might).

I tried that, but I wasn't able to do anything:

  • shell_interact(): same issues and doesn't give return a shell
  • ssh backdoor: crashes the VM

It's also pretty slow.

I think that's because you're emulating RISC-V using binfmt emulation to run a riscv64-linux build of qEMU to run the test? That sounds to me like you have qEMU running under qEMU.

When I first read this comment, I thought so as well, but then it got me thinking: why not enable binfmt inside the test itself? So I commented out everything I previously made and did just that. Performance-wise, everything seemed ... fine, actually.

The test fails ofc, because the package wasn't installed. But then I noticed something interesting:

{
  # the package works when installed directly
  environment.systemPackages = [
    pkgs.pkgsCross.riscv64.felix86
  ];
}

Whereas:

{
  # enabling the module, I get the previous issue with `backdoor.service`
  programs.felix86.enable = true;
}

Investigating further, I tracked this back to the felix86 boot.binfmt.registrations. More importantly, the logs now actually print something useful:

machine # [    6.846377] systemd[1]: lastlog2-import.service: Failed to spawn executor: Exec format error
machine # [    6.852359] systemd[1]: lastlog2-import.service: Failed to spawn 'start' task: Exec format error
machine # [    6.857462] firewall-start[607]: /nix/store/qhsrmq9784wvy0la4nr62dhgrjwn93sv-firewall-start/bin/firewall-start: line 105: /nix/store/s657hsrj1cknm7c4cbi87f6w7f3mlv11-iptables-1.8.11/bin/iptables: cannot execute binary file: Exec format error

Then everything clicked: my system is x86_64-linux and I'm using binfmt to emulate risc64-linux, but the module also enables emulation in the other direction, after which chaos ensues.

I already suspected this would happen, but I'm glad to actually confirm it. In a way, this kinda means the module's binfmt registration is working and I can just disable it for now in the test.

12:52:49
@eljamm:matrix.orgeljamm *

You could I guess try building the driverInteractive version of the test, then inside the interactive prompt run machine.shell_interact() to get a prompt (assuming this doesn't require the backdoor service, which it might).

I tried that, but I wasn't able to do anything:

  • shell_interact(): same issues and doesn't return a shell
  • ssh backdoor: crashes the VM

It's also pretty slow.

I think that's because you're emulating RISC-V using binfmt emulation to run a riscv64-linux build of qEMU to run the test? That sounds to me like you have qEMU running under qEMU.

When I first read this comment, I thought so as well, but then it got me thinking: why not enable binfmt inside the test itself? So I commented out everything I previously made and did just that. Performance-wise, everything seemed ... fine, actually.

The test fails ofc, because the package wasn't installed. But then I noticed something interesting:

{
  # the package works when installed directly
  environment.systemPackages = [
    pkgs.pkgsCross.riscv64.felix86
  ];
}

Whereas:

{
  # enabling the module, I get the previous issue with `backdoor.service`
  programs.felix86.enable = true;
}

Investigating further, I tracked this back to the felix86 boot.binfmt.registrations. More importantly, the logs now actually print something useful:

machine # [    6.846377] systemd[1]: lastlog2-import.service: Failed to spawn executor: Exec format error
machine # [    6.852359] systemd[1]: lastlog2-import.service: Failed to spawn 'start' task: Exec format error
machine # [    6.857462] firewall-start[607]: /nix/store/qhsrmq9784wvy0la4nr62dhgrjwn93sv-firewall-start/bin/firewall-start: line 105: /nix/store/s657hsrj1cknm7c4cbi87f6w7f3mlv11-iptables-1.8.11/bin/iptables: cannot execute binary file: Exec format error

Then everything clicked: my system is x86_64-linux and I'm using binfmt to emulate risc64-linux, but the module also enables emulation in the other direction, after which chaos ensues.

I already suspected this would happen, but I'm glad to actually confirm it. In a way, this kinda means the module's binfmt registration is working and I can just disable it for now in the test.

12:54:51
@colemickens:matrix.orgcolemickens joined the room.19:36:38
@colemickens:matrix.orgcolemickensa huge amount of native riscv64-linux builds fail with > /nix/store/shkw4qm9qcw5sc5n1k5jznc83ny02r39-default-builder.sh: line 1: genericBuild: command not found ? bit surprising to me?19:36:44
@colemickens:matrix.orgcolemickensNot sure if I'm doing something very wrong or not...19:54:19
@silvio:booq.orgSilvio joined the room.21:14:31
@alex:tunstall.xyzAlexWhich Nixpkgs commit?21:15:56
@colemickens:matrix.orgcolemickensI just tried nixos/nixpkgs/nixos-unstable#tmux21:28:00
@colemickens:matrix.orgcolemickensso 5b2c2d84341b2afb5647081c1386a80d7a8d8605 I suppose21:28:17
@alex:tunstall.xyzAlex Try latest master. There is an important change not yet in unstable that might fix the problem. 21:44:11
@colemickens:matrix.orgcolemickensokay, any chance you can link the PR so I can keep an eye on it on https://nixpk.gs?21:52:24
@colemickens:matrix.orgcolemickensthanks!21:52:26
@alex:tunstall.xyzAlex It is https://github.com/NixOS/nixpkgs/pull/498702 (linked earlier by dramforever). 21:55:06
@colemickens:matrix.orgcolemickensthat appears to be in nixos-unstable though22:18:37
@colemickens:matrix.orgcolemickenshttps://nixpk.gs/pr-tracker.html?pr=49870222:18:42
@alex:tunstall.xyzAlexOh maybe now it is. It wasn't when I checked yesterday.22:18:54
@alex:tunstall.xyzAlex I'm in the middle of building b0515cbf9eb44508f90c8cf5b39654dd9af16b80.
It is currently at 537 derivations completed with no failures so far, so perhaps this version is OK?
22:21:19
18 Mar 2026
@colemickens:matrix.orgcolemickens and it seems like native ghc is still not a thing. I'm getting libffi errors when I try to crossPkgs it? #error "libffi was configured for a RISC-V target but this does not appear to be a RISC-V compiler." :'( 01:47:06
@colemickens:matrix.orgcolemickensI left this stuff behind almost 3 years ago. I definitely was naive and assumed native ghc would be here by now01:47:22
@alex:tunstall.xyzAlex It is possible to go via x86_64 cross and, if you're lucky, pkgsCross.riscv64.haskell.compiler.ghc94 will be in Nixpkgs cache (otherwise you'll need to copy it). 01:48:58
@colemickens:matrix.orgcolemickensoh, right, I switched by testing apparatus to a flake that has an older nixpkgs. I might need to bump and try again.01:49:54
@alex:tunstall.xyzAlex

I'm getting libffi errors when I try to crossPkgs it?

Can you share what exactly you're doing? It should just work.

01:49:56
@colemickens:matrix.orgcolemickensoh actually this is on nixos-unstable, one second, let me still bump it anyway and then I'll show you if it still errors01:50:33
@colemickens:matrix.orgcolemickens okay I have this in a flake check attr and I'm just doing nix flake check in CI:
inputs.nixpkgs.legacyPackages.x86_64-linux.pkgsCross.riscv64.cachix.
01:52:32
@alex:tunstall.xyzAlex

Cross-compiling GHC and cross-compiling Haskell packages are two slightly different things.

[nixos@nixos:~]$ uname -a
Linux nixos 6.6.0 #1-NixOS SMP Tue Jan  1 00:00:00 UTC 1980 riscv64 GNU/Linux

[nixos@nixos:~]$ /nix/store/lcrs211p33jp89jm8a08m7d5vpi7533k-ghc-9.6.6/bin/ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.6.6
01:54:12
@colemickens:matrix.orgcolemickensuh sorry I thought I sent a clarifying message, yes, I XY'd the problem a bit.01:55:07
@colemickens:matrix.orgcolemickensI'm actually after cachix. Sorry, important context.01:55:16
@colemickens:matrix.orgcolemickens* uh sorry I thought I sent a clarifying message (I definitely didn't from what I can see...), yes, I XY'd the problem a bit.01:55:38
@alex:tunstall.xyzAlex pkgsCross.riscv64.cachix evals for me on latest unstable. What commit of Nixpkgs is pinned in flake.lock? 01:56:06

Show newer messages


Back to Room ListRoom Version: 10