NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.04k stars 14.04k forks source link

Error enabling libvirtd #21011

Closed thearchitect closed 7 years ago

thearchitect commented 7 years ago

Issue description

Error while rebuilding after enabling libvirtd. Details in gist below. Need to solve ASAP, looking forward for your help, guys!

Steps to reproduce

gist

Technical details

danbst commented 7 years ago

Probably you don't have latest version of nixpkgs?

You can compare your log to actual xen build log at https://hydra.nixos.org/build/44683057/log

thearchitect commented 7 years ago

danbst, thank you for your answer! I've upgraded right before enabling it (nixos-rebuild switch --upgrade). I am using https://nixos.org/channels/nixos-16.09 channel

Maybe I need to switch to unstable channel?

danbst commented 7 years ago

You see, I'm using nixos-16.09 channel and have libvirtd working. So we have to find out the difference.

Can you install xen only? (nix-env -iA nixos.xen_4_5 or nix-env -f '<nixpkgs>' -iA xen_4_5) and post your log? My system builds /nix/store/h901aghgs2apzg63bj1yzpff1y9dapc6-xen-4.5.5 which corresponds to https://hydra.nixos.org/build/44604698

thearchitect commented 7 years ago

Executing nix-env -f '<nixpkgs>' -iA xen is fine:

installing ‘xen-4.5.5’
these paths will be fetched (10.49 MiB download, 47.15 MiB unpacked):
  /nix/store/h901aghgs2apzg63bj1yzpff1y9dapc6-xen-4.5.5
fetching path ‘/nix/store/h901aghgs2apzg63bj1yzpff1y9dapc6-xen-4.5.5’...

*** Downloading ‘https://cache.nixos.org/nar/12mjqcvfg09rhyf2as35vf6ifm1r71lns3hajqfwkxfkpnhf4ndm.nar.xz’ (signed by ‘cache.nixos.org-1’) to ‘/nix/store/h901aghgs2apzg63bj1yzpff1y9dapc6-xen-4.5.5’...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 10.4M  100 10.4M    0     0   151k      0  0:01:10  0:01:10 --:--:--  156k

building path(s) ‘/nix/store/6a38abygd2qz8d2hhcljmb2rfx33rk9c-user-environment’
created 7 symlinks in user environment

But adding xen to environment.systemPackages results in the following output:

nixos-rebuild switch
building Nix...
building the system configuration...
these derivations will be built:
  /nix/store/hh7d9bsp0a3fi5fy2rammfx0ah6vya4i-xen-4.5.5.drv
  /nix/store/69c0bwni808qgcsd38q75qc5p6r01in0-system-path.drv
  /nix/store/46lypd6mikn57fbhdhwy7pp1nikffjsk-dbus-conf.drv
  /nix/store/98v4vpadhk8h457id9vzcfcbdqgjxb34-unit-polkit.service.drv
  /nix/store/i5i2g3wxbs3vrzl1fspcdn4n2mn2dh53-unit-dbus.service.drv
  /nix/store/9804v8hby6h8bz7byb880i0xafzd39z6-system-units.drv
  /nix/store/z4h6zlgw801wx5dbpppnxk308nl6xjyc-unit-dbus.service.drv
  /nix/store/hlw1vl7yyyxfv18xhf5dfzxsn8hfycr6-user-units.drv
  /nix/store/isl7jn78wc58hhmkzicv9ghjdkz3grgb-etc.drv
  /nix/store/0qam9y0sirfxavfhp5s23xh2vmnv8qqd-nixos-system-zion-16.09.1229.f52eaf4.drv
building path(s) ‘/nix/store/ngdq26bh78hpv2mizby8bz20gd7rl4pc-xen-4.5.5’
unpacking sources
unpacking source archive /nix/store/kl47mr510mp2fdp1z0b19ym3q07bxv08-xen-4.5.5.tar.gz
source root is xen-4.5.5
setting SOURCE_DATE_EPOCH to timestamp 1474351164 of file xen-4.5.5/xen/xsm/xsm_policy.c
patching sources
applying patch /nix/store/frbl4590ah8g1lp1jlfl1c4q6y4v08hs-0001-libxl-Spice-image-compression-setting-support-for-up.patch
patching file docs/man/xl.cfg.pod.5
Hunk #1 succeeded at 1423 (offset -4 lines).
patching file tools/libxl/libxl.h
patching file tools/libxl/libxl_dm.c
Hunk #1 succeeded at 421 (offset 23 lines).
patching file tools/libxl/libxl_types.idl
Hunk #1 succeeded at 240 (offset -1 lines).
patching file tools/libxl/xl_cmdimpl.c
Hunk #1 succeeded at 1938 (offset -10 lines).
applying patch /nix/store/3wa5xlnhfbbq3fwqvs9c31fi7daq08hb-0002-libxl-Spice-streaming-video-setting-support-for-upst.patch
patching file docs/man/xl.cfg.pod.5
Hunk #1 succeeded at 1429 (offset -4 lines).
patching file tools/libxl/libxl.h
patching file tools/libxl/libxl_dm.c
Hunk #1 succeeded at 425 (offset 23 lines).
patching file tools/libxl/libxl_types.idl
Hunk #1 succeeded at 241 (offset -1 lines).
patching file tools/libxl/xl_cmdimpl.c
Hunk #1 succeeded at 1940 (offset -10 lines).
applying patch /nix/store/aqqzc5jfzkaw98630m3q9n97d1zd6j5r-0003-Add-qxl-vga-interface-support-for-upstream-qem.patch
patching file docs/man/xl.cfg.pod.5
Hunk #1 succeeded at 1294 (offset -66 lines).
Hunk #2 succeeded at 1308 (offset -66 lines).
patching file tools/libxl/libxl.h
Hunk #1 succeeded at 506 (offset -29 lines).
patching file tools/libxl/libxl_create.c
Hunk #1 succeeded at 240 (offset -8 lines).
Hunk #2 succeeded at 268 (offset -8 lines).
patching file tools/libxl/libxl_dm.c
Hunk #1 succeeded at 267 (offset 16 lines).
Hunk #2 succeeded at 633 (offset 6 lines).
patching file tools/libxl/libxl_types.idl
Hunk #1 succeeded at 181 (offset -2 lines).
patching file tools/libxl/xl_cmdimpl.c
Hunk #1 succeeded at 1910 (offset -205 lines).
patching file src/Kconfig
configuring
no configure script, doing nothing
substitute(): file 'tools/hotplug/Linux/xen-backend.rules' does not exist
builder for ‘/nix/store/hh7d9bsp0a3fi5fy2rammfx0ah6vya4i-xen-4.5.5.drv’ failed with exit code 1
cannot build derivation ‘/nix/store/69c0bwni808qgcsd38q75qc5p6r01in0-system-path.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/0qam9y0sirfxavfhp5s23xh2vmnv8qqd-nixos-system-zion-16.09.1229.f52eaf4.drv’: 1 dependencies couldn't be built
error: build of ‘/nix/store/0qam9y0sirfxavfhp5s23xh2vmnv8qqd-nixos-system-zion-16.09.1229.f52eaf4.drv’ failed

I have only few months of NixOS experience, but I have 4 servers using NixOS and never seen error of such kind...

danbst commented 7 years ago

Hm, looks like your system's config contains some nasty overrides. I tried to build xen from your system's channel and it starts building ok:

$ NIX_PATH=nixpkgs=https://d3g5gsiof5omrk.cloudfront.net/nixos/16.09/nixos-16.09.1229.f52eaf4/nixexprs.tar.xz nix-shell '<nixpkgs>' -A xen_4_5
$ unpackPhase
unpacking source archive /nix/store/kl47mr510mp2fdp1z0b19ym3q07bxv08-xen-4.5.5.tar.gz
source root is xen-4.5.5
setting SOURCE_DATE_EPOCH to timestamp 1474351164 of file xen-4.5.5/xen/xsm/xsm_policy.c
$ patchPhase
...
$ configurePhase
...
mkdir: cannot create directory ‘wget’: File exists
configure flags: --prefix=/nix/store/h901aghgs2apzg63bj1yzpff1y9dapc6-xen-4.5.5 --prefix=/nix/store/h901aghgs2apzg63bj1yzpff1y9dapc6-xen-4.5.5 --disable-stubdom
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
Will build the following subsystems:
  xen
  tools
  docs
configure: creating ./config.status
config.status: creating config/Toplevel.mk
config.status: creating config/Paths.mk
=== configuring in tools (/tmp/xen-4.5.5/tools)
configure: running /nix/store/28wl3f34vfjpw0y5809bgr6382wqdscf-bash-4.3-p48/bin/bash ./configure --disable-option-checking '--prefix=/nix/store/h901aghgs2apzg63bj1yzpff1y9dapc6-xen-4.5.5'  '--disable-stubdom'
--cache-file=/dev/null --srcdir=.
...

don't you have something in packageOverrides btw?

thearchitect commented 7 years ago

danbst, there is no overrides in my config. You can look at my full config.

BTW same error with qemu.

building Nix...
building the system configuration...
these derivations will be built:
  /nix/store/f5spla6460gr3sbi2mh7wj5hywqkag0j-qemu-2.7.0.drv
  /nix/store/s75jqqga8xmr3171z3cp9k5a05z8sgfz-system-path.drv
  /nix/store/bgh517f9hlm8i2lss3n9z1lcna1ifr20-dbus-conf.drv
  /nix/store/d6bwsf769lpi04vibjbldp451nnpjad0-unit-dbus.service.drv
  /nix/store/388xvzpaj8jxxhbf0hgfzzlcahasckfh-user-units.drv
  /nix/store/3h8fifkyza64hin23hc04q9mn9yhy53c-unit-polkit.service.drv
  /nix/store/qxknxgs8sq35d21bzn3yv59bqm6ys6xx-unit-dbus.service.drv
  /nix/store/nam5pn57fbg1831jigr7fzwpm10dg2jq-system-units.drv
  /nix/store/4svzlllx4v9gjn0dnapq5dn1l70nbr78-etc.drv
  /nix/store/wspkkylqfrvlky8sx87zd61mgg8hk67f-nixos-system-zion-16.09.1229.f52eaf4.drv
building path(s) ‘/nix/store/lqjhhh9xi9zssai10f9g1dpwmzzvqi16-qemu-2.7.0’
unpacking sources
unpacking source archive /nix/store/1sx8xr9mpzn2nrn04wd5js229byknhv5-qemu-2.7.0.tar.bz2
source root is qemu-2.7.0
setting SOURCE_DATE_EPOCH to timestamp 1472830593 of file qemu-2.7.0/roms/vgabios/vgatables.h
patching sources
applying patch /nix/store/x5ybizh5y9233lq0zilxlm8ixqfwigw7-no-etc-install.patch
patching file Makefile
Hunk #1 succeeded at 462 with fuzz 2 (offset 44 lines).
applying patch /nix/store/13nwm2sx5sqqzjys7nwiv3kxr9y0iksc-net-vmxnet-initialise-local-tx-descriptor-CVE-2016-6836.patch
patching file hw/net/vmxnet3.c
applying patch /nix/store/a0rwrypdfr992m3nb6d17iv72680xziq-scsi-mptconfig-fix-an-assert-expression-CVE-2016-7157.patch
patching file hw/scsi/mptconfig.c
applying patch /nix/store/6kljglklk2l8bi1q8rlzzw8p96fwb7cx-scsi-mptconfig-fix-misuse-of-MPTSAS_CONFIG_PACK-CVE-2016-7157.patch
patching file hw/scsi/mptconfig.c
applying patch /nix/store/w9f8xvc8k8wc2q7ipqvgcpzghjhhij8j-scsi-mptsas-use-g_new0-to-allocate-MPTSASRequest-obj-CVE-2016-7423.patch
patching file hw/scsi/mptsas.c
applying patch /nix/store/v71q9p7kyjinrv9mw7rkrbilwdaa9jf2-scsi-pvscsi-check-page-count-while-initialising-descriptor-rings-CVE-2016-7155.patch
patching file hw/scsi/vmw_pvscsi.c
applying patch /nix/store/pc9fjfvh53mkij0k8x2d6lmj11m3i1mx-scsi-pvscsi-limit-loop-to-fetch-SG-list-CVE-2016-7156.patch
patching file hw/scsi/vmw_pvscsi.c
applying patch /nix/store/v4b49d6wczai0q80c0jdj04gw4mpm233-scsi-pvscsi-limit-process-IO-loop-to-ring-size-CVE-2016-7421.patch
patching file hw/scsi/vmw_pvscsi.c
applying patch /nix/store/qganq51bdgbdcghyc8x9x8km3lz6pk0z-usb-xhci-fix-memory-leak-in-usb_xhci_exit-CVE-2016-7466.patch
patching file hw/usb/hcd-xhci.c
Hunk #1 succeeded at 3709 (offset -6 lines).
applying patch /nix/store/7rksfw2h2mzm855ip29xhac1kg22sr0v-virtio-add-check-for-descriptor-s-mapped-address-CVE-2016-7422.patch
patching file hw/virtio/virtio.c
Hunk #1 succeeded at 473 (offset -22 lines).
applying patch /nix/store/pihh0jdiq4bbm41ks9av4fyfv9w5ndly-qemu-CVE-2016-8909.patch
patching file hw/audio/intel-hda.c
applying patch /nix/store/pyn1lklvm6shq02q38ncafxhkf7kjm27-qemu-CVE-2016-8910.patch
patching file hw/net/rtl8139.c
applying patch /nix/store/w2k3as23nkf7fl70i0wdsi9qfchzg43j-qemu-CVE-2016-9103.patch
patching file hw/9pfs/9p.c
Hunk #1 succeeded at 3268 (offset -14 lines).
applying patch /nix/store/z5ch5gqgz03ncsf00kaafd6qp91v9i0r-qemu-CVE-2016-9104.patch
patching file hw/9pfs/9p.c
Hunk #1 succeeded at 1628 (offset -9 lines).
Hunk #2 succeeded at 1965 (offset -11 lines).
applying patch /nix/store/zkb3ijylmbb32p1p8fxrsm0ygggf3367-qemu-CVE-2016-9105.patch
patching file hw/9pfs/9p.c
Hunk #1 succeeded at 2394 (offset -19 lines).
applying patch /nix/store/hvdnxczqc56jbyf4f7vkrmip60h9xc1m-qemu-CVE-2016-9106.patch
patching file hw/9pfs/9p.c
Hunk #1 succeeded at 2071 (offset -19 lines).
applying patch /nix/store/fni3gmx8y4rb1hkx0q5cllvmy06xajmy-qemu-CVE-2016-7994.patch
patching file hw/display/virtio-gpu.c
applying patch /nix/store/h0kmp1szg3khqr7hnidiyd0fp74dbpdg-qemu-CVE-2016-8668.patch
patching file hw/net/rocker/rocker.c
applying patch /nix/store/4n8wc91hrin2f3j8qmidjpvimpy0p9rc-qemu-CVE-2016-7907.patch
patching file hw/net/mcf_fec.c
applying patch /nix/store/fj5mmg4g7fszjp8ljancf3a9nk3628lj-CVE-2016-9102.patch
patching file hw/9pfs/9p.c
configuring
no configure script, doing nothing
building
make flags: SHELL=/nix/store/28wl3f34vfjpw0y5809bgr6382wqdscf-bash-4.3-p48/bin/bash    
Please call configure before running make!
make: *** [Makefile:47: config-host.mak] Error 1
builder for ‘/nix/store/f5spla6460gr3sbi2mh7wj5hywqkag0j-qemu-2.7.0.drv’ failed with exit code 2
cannot build derivation ‘/nix/store/s75jqqga8xmr3171z3cp9k5a05z8sgfz-system-path.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/wspkkylqfrvlky8sx87zd61mgg8hk67f-nixos-system-zion-16.09.1229.f52eaf4.drv’: 1 dependencies couldn't be built
error: build of ‘/nix/store/wspkkylqfrvlky8sx87zd61mgg8hk67f-nixos-system-zion-16.09.1229.f52eaf4.drv’ failed
danbst commented 7 years ago

So, I've found out that noXlibs = true; is the line which forces xen rebuild. Can you try rebuilding without it?

BTW, your config builds fine (at least, xen starts building fine) in my NixOps installation. So I guess there are still some impurities involved (like tmpfs limit reached or bug in tmpfs or some Nix option set, etc...)

thearchitect commented 7 years ago

danbst, your assumption about noXlibs = true; was correct, now everything builds fine. Thank you very much!

danbst commented 7 years ago

Still, you should understand, that noXlibs wasn't a culprit. I was able to build your configuration (with small fixes) in NixOps. The actual problem was during build phase, probably not all sources unpacked from source archive. You have tmp on tmpfs enabled, and Nix builds are done in /tmp, so I think you some tmpfs bug caused broken Nix builds.