Skip to content

incus: incus-agent static builds with interpreter unusable on non-nix Linux VMs #468512

@psychomario

Description

@psychomario

Nixpkgs version

  • Unstable (26.05)

Describe the bug

incus-agent.linux.* as built from the script in #446389 causes the static incus-agent binaries to be built with an interpreter (ld-linux-x86-64.so.2) which is in the nix store, and is therefore causes the agent to not run on non-Nix Linux VMs (and assumes an identical host/VM store for Nix linux VMs).

This breaks tooling which requires the agent, such as incus shell

Steps to reproduce

nix shell nixpkgs#patchelf nixpkgs#incus -c /bin/sh -c 'patchelf --print-interpreter $(dirname $(dirname $(which incus)))/share/agent/incus-agent.linux.x86_64'

outputs something like

/nix/store/rcp9sdrrq8sfxkm5zdykglx7hd2gzbfy-glibc-2.40-66/lib/ld-linux-x86-64.so.2

Launching a VM, and using incus console [vm] --show-log will show incus-agent.service fails to start. Mounting the root filesystem to set a password, logging in with incus console, and trying to manually run the /run/incus_agent/incus-agent binary gives an error due to the missing interpreter.

Expected behaviour

The interpreter in the built ELFs should probably not be a Nix store path

Screenshots

No response

Relevant log output

Additional context

The following override can be used to hardcode a different interpreter which allows the incus-agent to work on e.g Ubuntu VMs.

  incuspatched = pkgs.incus.overrideAttrs (
    final: prev: {
      postBuild =
        builtins.replaceStrings [ ''-ldflags="-s"'' ] [ ''-ldflags="-s -I /lib64/ld-linux-x86-64.so.2"'' ] prev.postBuild;
    }
  );

This is probably not a proper fix (it won't then work on Nix VMs) but it works.

System metadata

  • system: "x86_64-linux"
  • host os: Linux 6.12.58, NixOS, 25.11 (Xantusia), 25.11.20251117.89c2b23
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.31.2
  • channels(root): "nixos"
  • nixpkgs: /nix/store/f640ps0hcp7w5jzg18djf8gdhl6r2rnl-source

Notify maintainers

@aanderse @adamcstephens @megheaiulian @mkg20001


Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)

I assert that this issue is relevant for Nixpkgs

Is this issue important to you?

Add a 👍 reaction to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions