summary refs log tree commit diff
path: root/pkgs/build-support/vm
diff options
context:
space:
mode:
authoraszlig <aszlig@nix.build>2018-07-18 02:42:27 +0200
committeraszlig <aszlig@nix.build>2018-07-18 03:02:55 +0200
commitcaccc40ad01c4159a5a627b17d3db12ac67fa252 (patch)
treede53ad5be3d683fabc752c56d3b4ab28cd9ae7b0 /pkgs/build-support/vm
parente8e96e4b7290471f91f5828734d93945ec26ba2a (diff)
downloadnixpkgs-caccc40ad01c4159a5a627b17d3db12ac67fa252.tar
nixpkgs-caccc40ad01c4159a5a627b17d3db12ac67fa252.tar.gz
nixpkgs-caccc40ad01c4159a5a627b17d3db12ac67fa252.tar.bz2
nixpkgs-caccc40ad01c4159a5a627b17d3db12ac67fa252.tar.lz
nixpkgs-caccc40ad01c4159a5a627b17d3db12ac67fa252.tar.xz
nixpkgs-caccc40ad01c4159a5a627b17d3db12ac67fa252.tar.zst
nixpkgs-caccc40ad01c4159a5a627b17d3db12ac67fa252.zip
vmTools: Fix BusyBox runtime error in initrd
With the recent update of BusyBox to version 1.29.0 in
d6aa506e3baa3565eb375bbf8a4e68c3e3134ec9 there is now a new dependency
on libresolv.

This now throws a runtime error when executing ash, eg. whenever we do
something like this:

nix-build -E 'with import ./. {}; vmTools.runInLinuxVM hello'

The resulting error will be:

  .../ash: error while loading shared libraries: libresolv.so.2: cannot
           open shared object file: No such file or directory

I tried to override BusyBox with enableStatic, but that still requires
parts of glibc:

  Static linking against glibc, can't use --gc-sections
  Trying libraries: crypt m resolv
   Library crypt is not needed, excluding it
   Library m is needed, can't exclude it (yet)
   Library resolv is needed, can't exclude it (yet)
   Library m is needed, can't exclude it (yet)
   Library resolv is needed, can't exclude it (yet)
  Final link with: m resolv

In the long term maybe switching to a more minimal C library such as
musl would make more sense, but for now I just added libresolv.so to the
initrd which fixes the runtime error.

Signed-off-by: aszlig <aszlig@nix.build>
Cc: @edolstra, @rbvermaa
Signed-off-by: aszlig <aszlig@nix.build>
Diffstat (limited to 'pkgs/build-support/vm')
-rw-r--r--pkgs/build-support/vm/default.nix2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkgs/build-support/vm/default.nix b/pkgs/build-support/vm/default.nix
index 6a6deaa875a..221e19ca5ed 100644
--- a/pkgs/build-support/vm/default.nix
+++ b/pkgs/build-support/vm/default.nix
@@ -22,7 +22,6 @@ rec {
 
   hd = "vda"; # either "sda" or "vda"
 
-
   initrdUtils = runCommand "initrd-utils"
     { buildInputs = [ nukeReferences ];
       allowedReferences = [ "out" modulesClosure ]; # prevent accidents like glibc being included in the initrd
@@ -35,6 +34,7 @@ rec {
       cp -p ${pkgs.stdenv.glibc.out}/lib/ld-linux*.so.? $out/lib
       cp -p ${pkgs.stdenv.glibc.out}/lib/libc.so.* $out/lib
       cp -p ${pkgs.stdenv.glibc.out}/lib/libm.so.* $out/lib
+      cp -p ${pkgs.stdenv.glibc.out}/lib/libresolv.so.* $out/lib
 
       # Copy BusyBox.
       cp -pd ${pkgs.busybox}/bin/* $out/bin