Using virtualisation.docker.enableNvidia = true; activates the use of this patch, but the patch fails to apply to the new 2.31 glibc.
nix-build channel:nixos-unstable -A nvidia-docker
nix-build https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz -A nvidia-docker
Expected behavior
To build and use nvidia-docker
Additional context
Using nixos-unstable
Metadata
Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.
Maintainer information:
# a list of nixpkgs attributes affected by the problem
attribute: pkgs.nvidia-docker
# a list of nixos modules affected by the problem
module: virtualization.docker.enableNvidia
Removing the patch from https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/virtualization/nvidia-docker/default.nix#L6 compiles, and I did a quick test with
docker run --gpus all --rm -it nvidia/cuda:10.2-base bash -c 'ln -sf /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.* /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1; ln -sf /usr/lib/x86_64-linux-gnu/libcuda.so.* /usr/lib/x86_64-linux-gnu/libcuda.so.1; nvidia-smi'
but did NOT test a patchelf-ed binary.
Update: test a few binaries, seems to work.
Possible the patch is no longer needed?
https://github.com/NixOS/patchelf/issues/44#issuecomment-639016354
Here Nvidia-docker is not working. I have to disable it. Here is the output:
building '/nix/store/bgrn1riag3sqc3w6nw5r3n1hb3az0219-glibc-2.31.drv'...
unpacking sources
unpacking source archive /nix/store/vm11cfclgfqhp6zpr56g6hs88b8dcx5j-glibc-2.31.tar.xz
building '/nix/store/i1l238pr8i0g79w6sf6x14wbkdnyd7pp-nvidia-runc.drv'...
unpacking sources
unpacking source archive /nix/store/bk6snqv09f4aylwrmwnbnpi50clmfpq9-source
source root is source
patching sources
applying patch /nix/store/49q86l6bmfik726kzpxqnr5k6c3c5z5d-source/runtime/runc/3f2f8b84a77f73d38244dd690525642a72156c64/0001-Add-prestart-hook-nvidia-container-runtime-hook-to-t.patch
patching file utils.go
Hunk #1 succeeded at 3 with fuzz 2.
Hunk #2 succeeded at 55 (offset 2 lines).
Hunk #3 succeeded at 87 (offset 2 lines).
configuring
building
patching script interpreter paths in .
./tests/rootless.sh: interpreter directive changed from "/bin/bash" to "/nix/store/c4wxsn4jays9j31y5z9f83nr2cp7l4pa-bash-4.4-p23/bin/bash"
./script/validate-gofmt: interpreter directive changed from "/bin/bash" to "/nix/store/c4wxsn4jays9j31y5z9f83nr2cp7l4pa-bash-4.4-p23/bin/bash"
./script/validate-c: interpreter directive changed from "/bin/bash" to "/nix/store/c4wxsn4jays9j31y5z9f83nr2cp7l4pa-bash-4.4-p23/bin/bash"
./script/tmpmount: interpreter directive changed from "/bin/bash" to "/nix/store/c4wxsn4jays9j31y5z9f83nr2cp7l4pa-bash-4.4-p23/bin/bash"
./script/release.sh: interpreter directive changed from "/bin/bash" to "/nix/store/c4wxsn4jays9j31y5z9f83nr2cp7l4pa-bash-4.4-p23/bin/bash"
./script/check-config.sh: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/c4wxsn4jays9j31y5z9f83nr2cp7l4pa-bash-4.4-p23/bin/bash"
./man/md2man-all.sh: interpreter directive changed from "/bin/bash" to "/nix/store/c4wxsn4jays9j31y5z9f83nr2cp7l4pa-bash-4.4-p23/bin/bash"
make: git: No such file or directory
go build -buildmode=pie -ldflags "-X main.gitCommit="" -X main.version=1.0.0-rc6 " -tags "seccomp apparmor selinux" -o runc .
source root is glibc-2.31
setting SOURCE_DATE_EPOCH to timestamp 1580557970 of file glibc-2.31/wctype/wctype_l.c
patching sources
applying patch /nix/store/r0rc2prwi70hgw4jray5a8sd41fhvjm7-rpcgen-path.patch
patching file sunrpc/rpc_main.c
applying patch /nix/store/pp29isd0nvy4jrm9q2f92pjlc83xwa0i-nix-locale-archive.patch
patching file locale/loadarchive.c
patching file locale/programs/locale.c
Hunk #1 succeeded at 634 (offset 1 line).
Hunk #2 succeeded at 663 (offset 1 line).
patching file locale/programs/locarchive.c
applying patch /nix/store/5212825a2npxaf7qd81sxfrqq6219rlx-dont-use-system-ld-so-cache.patch
patching file elf/ldconfig.c
patching file elf/Makefile
Hunk #1 succeeded at 620 (offset 61 lines).
patching file sysdeps/generic/dl-cache.h
applying patch /nix/store/mnglr8rr7nl444h7p50ysyq8qd0fm1lm-dont-use-system-ld-so-preload.patch
patching file elf/rtld.c
Hunk #1 succeeded at 1703 (offset 190 lines).
applying patch /nix/store/za0pg7fmysrcwrqcal26fnmzw6vycgdn-fix_path_attribute_in_getconf.patch
patching file sysdeps/unix/confstr.h
applying patch /nix/store/xkd50xxii6k7l1kmw4l5x6xzbhamcs87-allow-kernel-2.6.32.patch
patching file sysdeps/unix/sysv/linux/configure
patching file sysdeps/unix/sysv/linux/configure.ac
patching file sysdeps/unix/sysv/linux/dl-osinfo.h
applying patch /nix/store/3l70d7kcfsh91w6792h4fqs4kjbq17py-glibc-reinstate-prlimit64-fallback.patch?id=eab07e78b691ae7866267fc04d31c7c3ad6b0eeb
patching file sysdeps/unix/sysv/linux/getrlimit64.c
patching file sysdeps/unix/sysv/linux/setrlimit.c
Hunk #2 succeeded at 46 with fuzz 1.
patching file sysdeps/unix/sysv/linux/setrlimit64.c
Hunk #1 succeeded at 36 with fuzz 2.
applying patch /nix/store/nqa9d4yxz1l2cgswzqr1pkm4jfrksm0q-locale-C.diff
patching file localedata/locales/C
applying patch /nix/store/7kw224hdyxd7115lrqh9a4dv2x8msq2s-fix-x64-abi.patch
patching file elf/dl-tls.c
Hunk #1 succeeded at 818 (offset -9 lines).
applying patch /nix/store/3ljvc6lnx6y920zvnm4y3dgj8a68jhii-2.30-cve-2020-1752.patch
patching file posix/glob.c
applying patch /nix/store/j4q5zy8ham782zfk6j5bh0pn0ma85av8-2.31-cve-2020-10029.patch
patching file sysdeps/ieee754/ldbl-96/Makefile
patching file sysdeps/ieee754/ldbl-96/e_rem_pio2l.c
patching file sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c
applying patch /nix/store/s6l6ji4rnhg4yh9la3wkig7f7gc5d28p-ldconfig-patchelf.patch
patching file elf/readelflib.c
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
3 out of 3 hunks ignored -- saving rejects to file elf/readelflib.c.rej
builder for '/nix/store/bgrn1riag3sqc3w6nw5r3n1hb3az0219-glibc-2.31.drv' failed with exit code 1
cannot build derivation '/nix/store/pnzznacakgc3ivyxzj24hg0bpvnibx9g-nvidia-docker-2.0.3.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/n1j7p1ax5biarqkm795lbsisq4clzxq9-etc.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/pnqb7rvzhh5s4d9n9ss2xwwh1lbgc56l-system-path.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/ap1d695av5v087m6x843dcbbak4hrkvp-nixos-system-watchmen-20.09pre235279.5717d9d2f7c.drv': 1 dependencies couldn't be built
error: build of '/nix/store/ap1d695av5v087m6x843dcbbak4hrkvp-nixos-system-watchmen-20.09pre235279.5717d9d2f7c.drv' failed
Removing the patch from https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/virtualization/nvidia-docker/default.nix#L6 compiles, and I did a quick test with
docker run --gpus all --rm -it nvidia/cuda:10.2-base bash -c 'ln -sf /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.* /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1; ln -sf /usr/lib/x86_64-linux-gnu/libcuda.so.* /usr/lib/x86_64-linux-gnu/libcuda.so.1; nvidia-smi'but did NOT test a patchelf-ed binary.
I'm pretty sure this change made the patch redundant:
https://sourceware.org/git/?p=glibc.git;a=blobdiff;f=elf/readelflib.c;h=499cccbcfcc10fdc33c738c297166faa69f055cd;hp=09f5858426e24facd36ab54f0a116796d6addaa5;hb=58e8f5fd2ba47b6dc47fd4d0a35e4175c7c87aaa;hpb=e7c8ffe4ec059da1523c093d6a240cd87d154df2
comparing it to the patch:
https://sourceware.org/bugzilla/attachment.cgi?id=11444
Though I'm not completely sure, so someone else needs to confirm this.
I'm having this issue as well.
builder for '/nix/store/00sc2y4m5vpi10sls5ml7dyy61haf4gd-glibc-2.31.drv' failed with exit code 1
copying path '/nix/store/g0mznkphkqp0ifbr28030h86yadv6z1s-RStudio-1.2.5042' from 'https://cache.nixos.org'...
copying path '/nix/store/4416yq03i4pm35q5xh5q5jjp68y9f2n3-r-KernSmooth-2.23-16' from 'https://cache.nixos.org'...
copying path '/nix/store/8adaz5hcpw1jpzi7ccz0lj76l44gawqj-r-Rcpp-1.0.4.6' from 'https://cache.nixos.org'...
copying path '/nix/store/206jy7n10qd7w0r1y8l285gggsdx4wc9-r-MASS-7.3-51.5' from 'https://cache.nixos.org'...
copying path '/nix/store/b1vzd76c7f8jaybnxzp6hfd79zjcvgxl-r-backports-1.1.6' from 'https://cache.nixos.org'...
copying path '/nix/store/pw2q4vr0p18xnd7d7ax9b9xi26v2w6r3-r-cluster-2.1.0' from 'https://cache.nixos.org'...
copying path '/nix/store/40y5cj8iz5whbs8rbkb5xb0zzxi5ciqx-r-colorspace-1.4-1' from 'https://cache.nixos.org'...
copying path '/nix/store/hlm8ibi87zr557d01d11xi8zh663zxh4-r-digest-0.6.25' from 'https://cache.nixos.org'...
copying path '/nix/store/prp85hbmf4sabcvyzr5g8l7q5mlp4zaz-r-fansi-0.4.1' from 'https://cache.nixos.org'...
copying path '/nix/store/g9ilyva9698vd9hzj49d5h2jpsmijw4l-r-farver-2.0.3' from 'https://cache.nixos.org'...
copying path '/nix/store/1sk4kk6l2wv7v486475wgqyy09w6zi18-r-foreign-0.8-78' from 'https://cache.nixos.org'...
copying path '/nix/store/50gysi3lvgw3qipczi9n3j2zv74jwmxb-r-glue-1.4.0' from 'https://cache.nixos.org'...
copying path '/nix/store/fvn840ryjfqvsw4lp6k9drbx6xv4rcck-r-lattice-0.20-41' from 'https://cache.nixos.org'...
cannot build derivation '/nix/store/sdyhc1mbvza3kga75x8rn92krgij1zc1-nvidia-docker-2.0.3.drv': 1 dependencies couldn't be built