Skip to content

Unable to build raw efi image, "cannot allocate memory" errors. #13

@Seikm

Description

@Seikm

Following the steps to install NixOS with UEFI on an Orange Pi 5, I can't get past step "2. Flash NixOS to SD card".

During the process of building the raw EFI image (with nix build github:gnull/nixos-rk3588#rawEfiImage-opi5 --show-trace -L --verbose), I'm getting thousands of practically identical "Cannot allocate memory" error messages, e.g.:

nixos-disk-image> error while reading directory /build/root[/nix/store/XXX]: Cannot allocate memory
nixos-disk-image> error while reading directory /build/root: Cannot allocate memory

The instructions suggest a way to solve this (check dmesg, and use echo 1 > /proc/sys/vm/compact_memory), but nothing has worked for me. I searched and haven't found anything that solves this (and similar problems dont have answers), so any kind of help would be useful to me at this point.

Some additional information:

These are the lines I put in my config:

{
  boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
  nix.settings.extra-platforms = config.boot.binfmt.emulatedSystems;
}

I also added a systemd service with some "solutions" that i found to run when the system starts:

{
  systemd.services."enable-vm-compact-memory" = {
    description = "Enable VM compact memory to mitigate cannot allocate memory errors";
    wantedBy = [ "multi-user.target" ];
    script = ''
      echo 1 > /proc/sys/vm/compact_memory
      echo 1 > /proc/sys/vm/overcommit_memory
      echo 3 > /proc/sys/vm/drop_caches
    '';
  };
}

Using dmesg to find logs, nothing returned using sudo dmesg | grep qemu and sudo dmesg | grep "out of memory".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions