[Nix-dev] NixOps failes to deploy: bash: Argument list too long

Profpatsch mail at profpatsch.de
Sat Apr 15 00:22:18 CEST 2017


On 17-04-14 09:44pm, 4levels wrote:
> Hi Profpatch,
> 
> Thanks for your reply, but I don't know how to even try implementing your
> suggestions. This file is generated by NixOps and is run just before the
> actual deployment starts. This is at the end of the build phase before the
> actual deploy. It starts with
> 
> Derive([("out","/nix/store/j9p5zwqj03nq4f4id5a0phig5gk0snqd-nixos-system-secure-16.09pre-git","","")],
> ...

This is a derivation.
They are normally generated by nix expressions,
mostly out of the nixpkgs repo.

nixos-system-secure looks like a system derivation
created somewhere in nixpkgs/nixos.
You might try searching for nixos-system-secure.
In this case nixos-system leads you to the correct file.
`buildCommand` is the build description. It is aliased
above as `systemBuilder`. Try adding `set -x` into it
and start nixops with your nixpkgs (man nixops, search for -I).

`-I` is kind of stateful with nixops,
so you might want to build that machine with nix-build first.
nixpkgs/nixos/default.nix, concrete:

nix-build -A vm \
  -E 'import /path/to/nixpkgs/nixos { configuration = /path/to/machine/configuration; };'

Hope that helps finding the bug.

> 
> I have literally no idea where to look or what to change in NixOps itself
> to use the suggestions you made, as this goes way beyond my nix-knowledge.
> For all I know, this issue could come from something totally different as
> well, I'm just gessing here since this is the last output of the nixops
> deploy call before the error message. Below the full output of the call
> 
> [erik at no01:~]$ nixops deploy --build-only --show-trace
> building all machine configurations...
> these derivations will be built:
> 
> /nix/store/wz9mvb6x082h4mvww1gsf0x0l9fq8p7z-nixos-system-secure-16.09pre-git.drv
>   /nix/store/bz3ajdlxalr0c8i1zik40zwvnsb2g8a7-nixops-machines.drv
> building path(s)
> ‘/nix/store/j9p5zwqj03nq4f4id5a0phig5gk0snqd-nixos-system-secure-16.09pre-git’
> while setting up the build environment: executing
> ‘/nix/store/gabjbkwga2dhhp2wzyaxl83r8hjjfc37-bash-4.3-p48/bin/bash’:
> Argument list too long
> builder for
> ‘/nix/store/wz9mvb6x082h4mvww1gsf0x0l9fq8p7z-nixos-system-secure-16.09pre-git.drv’
> failed with exit code 1
> cannot build derivation
> ‘/nix/store/bz3ajdlxalr0c8i1zik40zwvnsb2g8a7-nixops-machines.drv’: 1
> dependencies couldn't be built
> error: build of
> ‘/nix/store/bz3ajdlxalr0c8i1zik40zwvnsb2g8a7-nixops-machines.drv’ failed
> error: unable to build all machine configurations
> 
> 
> Kind regards,
> 
> Erik
> 
> 
> On Fri, 14 Apr 2017, 22:00 Profpatsch, <mail at profpatsch.de> wrote:
> 
> > On 17-04-14 02:26pm, 4levels wrote:
> > > I think this is the generatd file causing the issue:
> > >
> > /nix/store/wz9mvb6x082h4mvww1gsf0x0l9fq8p7z-nixos-system-secure-16.09pre-git.drv
> > > It looks like it's a single line of code, spanning 207073 characters,
> > which
> > > is pbbly more than the allowed argument length for bash.
> > >
> > > Are there any guidelines to avoid running into this argument list error?
> >
> > Depends on your bash use-case.
> > Lots of programs support file-input.
> > xargs may be a good candidate.
> > If you don’t want it sequential, GNU parallel.
> > Or just a plain old bash for; do; done loop.
> >
> > --
> > Proudly written in Mutt with Vim on NixOS.
> > Q: Why is this email five sentences or less?
> > A: http://five.sentenc.es
> > May take up to five days to read your message. If it’s urgent, call me.
> >

-- 
Proudly written in Mutt with Vim on NixOS.
Q: Why is this email five sentences or less?
A: http://five.sentenc.es
May take up to five days to read your message. If it’s urgent, call me.


More information about the nix-dev mailing list