NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.94k stars 1.53k forks source link

build failed with nixos/nix docker image on docker 18.06 but succeeded on docker 20.10 #6629

Closed abigcarrot closed 1 year ago

abigcarrot commented 2 years ago

Describe the bug

on debain9 with docker

docker version
Client:
 Version:           18.06.1-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        e68fc7a
 Built:             Tue Aug 21 17:23:18 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.1-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       e68fc7a
  Built:            Tue Aug 21 17:22:21 2018
  OS/Arch:          linux/amd64
  Experimental:     false

get error

11:50:31 building '/nix/store/hq8packkqycm866czppir2l30dcb2b12-builder.pl.drv'...
11:50:31 building '/nix/store/kijzysf68g5hpc87mbridrhghql7lrd2-modules-5.1.0.tar.gz.drv'...
11:50:33 building '/nix/store/is6aj1vn88rp3pp2h4yyvmscipnim5mg-modules-5.1.0.drv'...
11:50:34 error: builder for '/nix/store/is6aj1vn88rp3pp2h4yyvmscipnim5mg-modules-5.1.0.drv' failed with exit code 2;
11:50:34        last 10 log lines:
11:50:34        > ./testsuite/systest0: interpreter directive changed from "#!/bin/sh" to "/nix/store/bcwyhqvik6jhcklib33v6kykdl4zp9d4-bash-5.1-p8/bin/sh"
11:50:34        > ./testsuite/systest: interpreter directive changed from "#!/bin/sh" to "/nix/store/bcwyhqvik6jhcklib33v6kykdl4zp9d4-bash-5.1-p8/bin/sh"
11:50:34        > ./testsuite/mode: interpreter directive changed from "#!/bin/sh" to "/nix/store/bcwyhqvik6jhcklib33v6kykdl4zp9d4-bash-5.1-p8/bin/sh"
11:50:34        > ./testsuite/systest2: interpreter directive changed from "#!/bin/bash" to "/nix/store/bcwyhqvik6jhcklib33v6kykdl4zp9d4-bash-5.1-p8/bin/bash"
11:50:34        > ./testsuite/cmd.exe: interpreter directive changed from "#!/bin/sh" to "/nix/store/bcwyhqvik6jhcklib33v6kykdl4zp9d4-bash-5.1-p8/bin/sh"
11:50:34        > configuring
11:50:34        > no configure script, doing nothing
11:50:34        > building
11:50:34        > build flags: SHELL=/nix/store/bcwyhqvik6jhcklib33v6kykdl4zp9d4-bash-5.1-p8/bin/bash
11:50:34        > Makefile:41: *** Makefile.inc is missing, please run './configure'.  Stop.
11:50:34        For full logs, run 'nix log /nix/store/is6aj1vn88rp3pp2h4yyvmscipnim5mg-modules-5.1.0.drv'.
11:50:34 error: 1 dependencies of derivation '/nix/store/6s945c200kzlj9dm2vxxrvnikd4k7p91-slurm-pack.drv' failed to build

on debain10 with docker

docker version
Client: Docker Engine - Community
 Version:           20.10.17
 API version:       1.41
 Go version:        go1.17.11
 Git commit:        100c701
 Built:             Mon Jun  6 23:03:11 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.17
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.11
  Git commit:       a89b842
  Built:            Mon Jun  6 23:01:17 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.6
  GitCommit:        10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
 runc:
  Version:          1.1.2
  GitCommit:        v1.1.2-0-ga916309
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

get successed and some logs

@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
configure flags: --prefix=/nix/store/bnsd7yjgmlfr7jqzzp18byks6h48gcha-modules-5.1.0 --with-bin-search-path=\$PATH --with-tcl=/nix/store/3zgfy304prl00jg57ccky5li2aldn0ya-tcl-8.6.11/lib/tclConfig.sh
checking for uname... /nix/store/ndkb1hkd009fch9dkzs31p9b7sa61s61-coreutils-9.0/bin/uname
checking for make... /nix/store/30a6rpl8n3zmbl7x40svqqz06jsg6aik-gnumake-4.3/bin/make
checking for sed... /nix/store/zym2hpmaz22x0rc8x09d862g1gr22djw-gnused-4.8/bin/sed
checking for runtest... /nix/store/32xmbjf261zxsw4h377jk02p0fg3zl4m-dejagnu-1.6.3/bin/runtest
checking for manpath... not found
WARNING: Will rely on MANPATH to get enabled man directories
checking for tclsh... /nix/store/3zgfy304prl00jg57ccky5li2aldn0ya-tcl-8.6.11/bin/tclsh
checking for python... not found
checking for python3... not found
checking for python2... not found
checking for ps... /nix/store/p39bv90yfzv1l9y90zddyrsr3a101p8h-ps-procps-3.3.16/bin/ps
checking for basename... /nix/store/ndkb1hkd009fch9dkzs31p9b7sa61s61-coreutils-9.0/bin/basename
checking for less... /nix/store/3igh5s7xmdak6nbm2lmbrg3n2v51a976-less-596/bin/less
TCLSH = /nix/store/3zgfy304prl00jg57ccky5li2aldn0ya-tcl-8.6.11/bin/tclsh
PYTHON = /usr/bin/env python
SPHINXBUILD = sphinx-build
PS = /nix/store/p39bv90yfzv1l9y90zddyrsr3a101p8h-ps-procps-3.3.16/bin/ps
BASENAME = /nix/store/ndkb1hkd009fch9dkzs31p9b7sa61s61-coreutils-9.0/bin/basename
RMDIR_IGN_NON_EMPTY = rmdir --ignore-fail-on-non-empty
SED_ERE = sed -E
VERSION = 5.1.0
RELEASE = 5.1.0
baseprefix = /nix/store/bnsd7yjgmlfr7jqzzp18byks6h48gcha-modules-5.1.0
prefix = /nix/store/bnsd7yjgmlfr7jqzzp18byks6h48gcha-modules-5.1.0
bindir = /nix/store/bnsd7yjgmlfr7jqzzp18byks6h48gcha-modules-5.1.0/bin
libdir = /nix/store/bnsd7yjgmlfr7jqzzp18byks6h48gcha-modules-5.1.0/lib
libexecdir = /nix/store/bnsd7yjgmlfr7jqzzp18byks6h48gcha-modules-5.1.0/libexec
etcdir = /nix/store/bnsd7yjgmlfr7jqzzp18byks6h48gcha-modules-5.1.0/etc
initdir = /nix/store/bnsd7yjgmlfr7jqzzp18byks6h48gcha-modules-5.1.0/init
datarootdir = /nix/store/bnsd7yjgmlfr7jqzzp18byks6h48gcha-modules-5.1.0/share
mandir = /nix/store/bnsd7yjgmlfr7jqzzp18byks6h48gcha-modules-5.1.0/share/man
docdir = /nix/store/bnsd7yjgmlfr7jqzzp18byks6h48gcha-modules-5.1.0/share/doc
vimdatadir = /nix/store/bnsd7yjgmlfr7jqzzp18byks6h48gcha-modules-5.1.0/share/vim/vimfiles
modulefilesdir = /nix/store/bnsd7yjgmlfr7jqzzp18byks6h48gcha-modules-5.1.0/modulefiles
setmanpath = y
appendmanpath = n
setbinpath = y
appendbinpath = n
setmodulespath = n
docinstall = y
vimaddons = y
examplemodulefiles = y
builddoc = p
usemanpath = n
libtclenvmodules = y
SHLIB_SUFFIX = .so
multilibsupport = n
libdir64 = undefined
libdir32 = undefined
versioning = n
silentshdbgsupport = n
setshellstartup = n
quarantinesupport = n
autohandling = y
availindepth = y
implicitdefault = y
extendeddefault = y
moduleshome = /nix/store/bnsd7yjgmlfr7jqzzp18byks6h48gcha-modules-5.1.0
initconfin = etcdir
pager = /nix/store/3igh5s7xmdak6nbm2lmbrg3n2v51a976-less-596/bin/less
pageropts = -eFKRX
verbosity = normal
color = y
darkbgcolors = hi=1:db=2:tr=2:se=2:er=91:wa=93:me=95:in=94:mp=1;94:di=94:al=96:va=93:sy=95:de=4:cm=92:aL=100:L=90;47:H=2:F=41:nF=43:S=46:sS=44:kL=30;48;5;109
lightbgcolors = hi=1:db=2:tr=2:se=2:er=31:wa=33:me=35:in=34:mp=1;34:di=34:al=36:va=33:sy=35:de=4:cm=32:aL=107:L=47:H=2:F=101:nF=103:S=106:sS=104:kL=48;5;109
termbg = dark
lockedconfigs =
icase = search
unloadmatchorder = returnlast
searchmatch = starts_with
modulepath = /nix/store/bnsd7yjgmlfr7jqzzp18byks6h48gcha-modules-5.1.0/modulefiles
loadedmodules =
quarantinevars =
wa277 = n
advversspec = y
ml = y
windowssupport = n
nearlyforbiddendays = 14
implicitrequirement = y
tagabbrev = auto-loaded=aL:loaded=L:hidden=H:hidden-loaded=H:forbidden=F:nearly-forbidden=nF:sticky=S:super-sticky=sS:keep-loaded=kL
tagcolorname =
mcookieversioncheck = y
availoutput = modulepath:alias:dirwsym:sym:tag:key
availterseoutput = modulepath:alias:dirwsym:sym:tag
listoutput = header:idx:variant:sym:tag:key
listterseoutput = header
editor = vi
variantshortcut =
bashcompletiondir =
fishcompletiondir =
zshcompletiondir =
--- configuring extension library sources --------
libarglist = --with-tcl=/nix/store/3zgfy304prl00jg57ccky5li2aldn0ya-tcl-8.6.11/lib/tclConfig.sh
/tmp/nix-build-modules-5.1.0.drv-0/modules-5.1.0/lib /tmp/nix-build-modules-5.1.0.drv-0/modules-5.1.0
checking TEA configuration... ok (TEA 3.13)
configure: configuring Envmodules 1.4.1
checking system version... Linux-5.10.47-linuxkit
checking for Tcl configuration... configure: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself
found /nix/store/3zgfy304prl00jg57ccky5li2aldn0ya-tcl-8.6.11/lib/tclConfig.sh
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for existence of /nix/store/3zgfy304prl00jg57ccky5li2aldn0ya-tcl-8.6.11/lib/tclConfig.sh... loading
checking platform... unix
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /nix/store/hq0dj7mrf3nn4xppyg4ypmm2jb2cpfla-gnugrep-3.7/bin/grep
checking for egrep... /nix/store/hq0dj7mrf3nn4xppyg4ypmm2jb2cpfla-gnugrep-3.7/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking for unistd.h... (cached) yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking for sys/types.h... (cached) yes
checking pwd.h usability... yes
checking pwd.h presence... yes
checking for pwd.h... yes
checking grp.h usability... yes
checking grp.h presence... yes
checking for grp.h... yes
checking for stdlib.h... (cached) yes
checking stdio.h usability... yes
checking stdio.h presence... yes
checking for stdio.h... yes
checking dirent.h usability... yes
checking dirent.h presence... yes
checking for dirent.h... yes
checking time.h usability... yes
checking time.h presence... yes
checking for time.h... yes
checking for ssize_t... yes
checking for uid_t in sys/types.h... yes
checking type of array argument to getgroups... gid_t
checking for size_t... yes
checking for getgroups... yes
checking for working getgroups... yes
checking for sysconf... yes
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking how to run the C preprocessor... gcc -E
checking whether make sets $(MAKE)... yes
checking for ranlib... ranlib
checking if the compiler understands -pipe... yes
checking whether byte ordering is bigendian... no
checking for Tcl public headers... /nix/store/3zgfy304prl00jg57ccky5li2aldn0ya-tcl-8.6.11/include
checking for ranlib... (cached) ranlib
checking if 64bit support is requested... no
checking if 64bit Sparc VIS support is requested... no
checking if compiler supports visibility "hidden"... yes
checking if rpath support is requested... yes
checking system version... (cached) Linux-5.10.47-linuxkit
checking for ar... ar
checking for cast to union support... yes
checking stdbool.h usability... yes
checking stdbool.h presence... yes
checking for stdbool.h... yes
checking for required early compiler flags...  _LARGEFILE64_SOURCE
checking for 64-bit integer type... yes
checking for build with symbols... no
checking how to build libraries... shared
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
/tmp/nix-build-modules-5.1.0.drv-0/modules-5.1.0
--------------------------------------------------
creating ./Makefile.inc
creating ./site.exp
@nix { "action": "setPhase", "phase": "buildPhase" }

Steps To Reproduce

  1. Dockerfile
    
    FROM nixos/nix

WORKDIR /root/

enable flake commands and tuna mirror

COPY nix.conf /etc/nix/nix.conf COPY flake.nix /root/ COPY flake.lock /root/

build the environment

RUN nix build .

2. flake.lock

{ "nodes": { "nixpkgs": { "locked": { "lastModified": 1652881001, "narHash": "sha256-k9JmPCojaJnqGz4aRXXT1HZqJKHCXijoMfBAb24abXk=", "owner": "nixos", "repo": "nixpkgs", "rev": "2d474d6a4a43a0348b78db68dc00c491032cf5cf", "type": "github" }, "original": { "owner": "nixos", "ref": "nixos-21.11", "repo": "nixpkgs", "type": "github" } }, "root": { "inputs": { "nixpkgs": "nixpkgs" } } }, "root": "root", "version": 7 }

4. flake.nix

{ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11"; };

outputs = { self, nixpkgs }: let sys = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${sys}; in { defaultPackage.${sys} = pkgs.buildEnv { name = "slurm-pack"; paths = with pkgs; [ slurm munge openssh tcl self.packages.${sys}."environment-modules" ];

pathsToLink = ["/bin", "/sbin"]

  };

  packages.${sys}."environment-modules" = with pkgs; stdenv.mkDerivation rec {
    pname = "modules";
    version = "5.1.0";

    src = fetchurl {
      url = "https://github.com/cea-hpc/modules/releases/download/v${version}/modules-${version}.tar.gz";
      sha256 = "1ab1e859b9c8bca8a8d332945366567fae4cf8dd7e312a689daaff46e7ffa949";
    };
    buildInputs = [ coreutils dejagnu tcl ps less ];
    postPatch = "patchShebangs .";
    configureFlags = [ "--with-bin-search-path=$PATH" "--with-tcl=${tcl}/lib/tclConfig.sh" ];

    meta = {
      homepage = "http://modules.sourceforge.net/";
      description = "Dynamic modification of a user's environment via modulefiles";
    };
  };
};

}

5. nix.conf

substituters = https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store https://cache.nixos.org/ experimental-features = nix-command flakes


6. run `docker build -t nix:1.6.0 -f Dockerfile .`
SuperSandro2000 commented 1 year ago

This is very likely a problem on Docker which will never be fixed on 18.XX. Sometimes docker needs to update its internal working to support new software. See https://github.com/moby/moby/issues/42055 as an example. Please update your Docker or find a workaround yourself, nothing nix realistically can fix in its Dockerfile unless software is downgraded.

@fricklerhandwerk can you close this?