unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* 'build-use-chroot = true' leads to 'ERROR: In procedure system*: No such file or directory'
@ 2012-12-12  4:52 Nikita Karetnikov
  2012-12-12 13:33 ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Nikita Karetnikov @ 2012-12-12  4:52 UTC (permalink / raw)
  To: bug-guix

Hi,

I'm trying to configure 'nix-worker --daemon' to run in chroot.

nix.conf:

build-users-group = nixbld
build-use-chroot = true
build-chroot-dirs = /dev /proc /bin

'/nix/store' is owned by root. [1]

# nix-channel --add http://nixos.org/releases/nixos/channels/nixos-unstable

# nix-channel --update

# nix-env -i attr
installing `attr-2.4.46'
accepted connection from pid 5411, uid 0
these paths will be fetched (0.08 MiB download, 0.19 MiB unpacked):
  /nix/store/qcyvmb71faqndsb4bb0v5lgsnsn7w6rr-attr-2.4.46
fetching path `/nix/store/qcyvmb71faqndsb4bb0v5lgsnsn7w6rr-attr-2.4.46'...

*** Downloading
‘http://nixos.org/binary-cache/nar/0ifa78jihwhhrwm5d8v64ipfc5rhd3bbyfrsz2k805apzvh0vwfp.nar.bz2’
to ‘/nix/store/qcyvmb71faqndsb4bb0v5lgsnsn7w6rr-attr-2.4.46’...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 86661  100 86661    0     0   282k      0 --:--:-- --:--:-- --:--:--  352k

building path(s) `/nix/store/qkf644f78376zk085kac3cixh386i8cc-user-environment'
created 85 symlinks in user environment
113 operations

# ls /nix/store/qcyvmb71faqndsb4bb0v5lgsnsn7w6rr-attr-2.4.46/bin/
attr  getfattr  setfattr

# ./pre-inst-env guix-build -K attr

[...]

Backtrace:
In ice-9/boot-9.scm:
 157: 12 [catch #t #<catch-closure 865ad20> ...]
In unknown file:
   ?: 11 [apply-smob/1 #<catch-closure 865ad20>]
In ice-9/boot-9.scm:
  63: 10 [call-with-prompt prompt0 ...]
In ice-9/eval.scm:
 414: 9 [eval # #]
In ice-9/boot-9.scm:
2131: 8 [save-module-excursion #<procedure 85fe180 at
ice-9/boot-9.scm:3660:3 ()>]
3665: 7 [#<procedure 85fe180 at ice-9/boot-9.scm:3660:3 ()>]
1456: 6 [%start-stack load-stack ...]
1461: 5 [#<procedure 86728a0 ()>]
In unknown file:
   ?: 4 [primitive-load
"/nix/store/1gnzbap69kiqk8nczz3ypa41ag40adcx-attr-2.4.46-guile-builder"]
In ice-9/eval.scm:
 375: 3 [eval # ()]
In srfi/srfi-1.scm:
 830: 2 [every1 #<procedure 88010c0 at
/nix/store/lwfq1dnscczk8h06kyfw60svsnhf0cid-module-import/guix/build/gnu-build-system.scm:238:9
(expr)> ...]
In /nix/store/lwfq1dnscczk8h06kyfw60svsnhf0cid-module-import/guix/build/gnu-build-system.scm:
 127: 1 [configure #:outputs (#) #:configure-flags ...]
In unknown file:
   ?: 0 [system* "./configure" ...]

ERROR: In procedure system*:
ERROR: In procedure system*: No such file or directory
note: keeping build directory
`/tmp/nix-build-jkjb2q02df1mjv57rcnzdalbyiwbavqz-attr-2.4.46.drv-5'
builder for `/nix/store/jkjb2q02df1mjv57rcnzdalbyiwbavqz-attr-2.4.46.drv'
failed with exit code 1
@ build-failed /nix/store/jkjb2q02df1mjv57rcnzdalbyiwbavqz-attr-2.4.46.drv
/nix/store/c6dysd7p362i583h8cwmvyw4v7mxqfig-attr-2.4.46 1 builder for
`/nix/store/jkjb2q02df1mjv57rcnzdalbyiwbavqz-attr-2.4.46.drv' failed
with exit code 1
error: build failed: build of
`/nix/store/jkjb2q02df1mjv57rcnzdalbyiwbavqz-attr-2.4.46.drv' failed
1919 operations

I also tried with 'hello' and got the same error.

Nikita

[1] http://nixos.org/releases/nix/nix-0.12/manual/#id2478985

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 'build-use-chroot = true' leads to 'ERROR: In procedure system*: No such file or directory'
  2012-12-12  4:52 'build-use-chroot = true' leads to 'ERROR: In procedure system*: No such file or directory' Nikita Karetnikov
@ 2012-12-12 13:33 ` Ludovic Courtès
  2012-12-16 15:08   ` Nikita Karetnikov
  0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2012-12-12 13:33 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: bug-guix

Nikita Karetnikov <nikita.karetnikov@gmail.com> skribis:

> build-chroot-dirs = /dev /proc /bin

[...]

>    ?: 0 [system* "./configure" ...]
>
> ERROR: In procedure system*:
> ERROR: In procedure system*: No such file or directory

Is /bin/sh a symlink?  If it is, its target has to be in one of the
directories listed in ‘build-chroot-dirs’.

But more importantly, /bin/sh is likely to be a dynamically-linked
executable, linked against stuff from /lib, which is not in
‘build-chroot-dirs’.  Thus, it won’t run in the chroot.

An option is to replace /bin/sh by the statically-linked Bash that’s in
distro/packages/bootstrap/*-linux/bash.

Another one, which I think we’ll do, is to change gnu-build-system.scm
to either run (system* "/path/to/our/bash" "./configure" ...), or call
‘patch-shebangs’ on ‘configure’.

HTH,
Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 'build-use-chroot = true' leads to 'ERROR: In procedure system*: No such file or directory'
  2012-12-12 13:33 ` Ludovic Courtès
@ 2012-12-16 15:08   ` Nikita Karetnikov
  2012-12-16 16:46     ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Nikita Karetnikov @ 2012-12-16 15:08 UTC (permalink / raw)
  To: bug-guix

Hi,

I'm getting the same error with the following command:

# ./pre-inst-env guix-daemon --build-users-group=nixbld -C 0

> Is /bin/sh a symlink?  If it is, its target has to be in one of the
> directories listed in ‘build-chroot-dirs’.

Yes. It points to bash, which is in '/bin'.

> An option is to replace /bin/sh by the statically-linked Bash that’s in
> distro/packages/bootstrap/*-linux/bash

Same error.

> Another one, which I think we’ll do, is to change gnu-build-system.scm
> to either run (system* "/path/to/our/bash" "./configure" ...), or call
> ‘patch-shebangs’ on ‘configure’.

I don't know how to change the former, but I've tried the latter.

gnu-build-system.scm:

(phases set-paths unpack patch patch-shebangs configure build check
        install strip)

AFAICT, it changed the build order, but the same error appeared
anyway.

> But more importantly, /bin/sh is likely to be a dynamically-linked
> executable, linked against stuff from /lib, which is not in
> ‘build-chroot-dirs’.  Thus, it won’t run in the chroot.

The following works.

nix.conf:

build-users-group = nixbld
build-use-chroot = true
build-chroot-dirs = /dev /proc /bin /lib

Does it make sense? Will it help to catch impurities?

'attr' failed with the following backtrace, but 'hello' and 'wget' succeeded.

make[1]: Leaving directory
`/tmp/nix-build-jihisz016g3yjdrfgls0zn718cz0rzxm-attr-2.4.46.drv-0/attr-2.4.46'
starting phase `check'
Backtrace:
In ice-9/boot-9.scm:
 157: 12 [catch #t #<catch-closure 97f5d20> ...]
In unknown file:
   ?: 11 [apply-smob/1 #<catch-closure 97f5d20>]
In ice-9/boot-9.scm:
  63: 10 [call-with-prompt prompt0 ...]
In ice-9/eval.scm:
 414: 9 [eval # #]
In ice-9/boot-9.scm:
2131: 8 [save-module-excursion #<procedure 9799180 at
ice-9/boot-9.scm:3660:3 ()>]
3665: 7 [#<procedure 9799180 at ice-9/boot-9.scm:3660:3 ()>]
1456: 6 [%start-stack load-stack ...]
1461: 5 [#<procedure 980d8a0 ()>]
In unknown file:
   ?: 4 [primitive-load
"/nix/store/bkcw55gxkccqcc1kj4d56n4nhd2g3572-attr-2.4.46-guile-builder"]
In ice-9/eval.scm:
 375: 3 [eval # ()]
In srfi/srfi-1.scm:
 830: 2 [every1 #<procedure 998b4b0 at
/nix/store/lwfq1dnscczk8h06kyfw60svsnhf0cid-module-import/guix/build/gnu-build-system.scm:238:9
(expr)> ...]
In ice-9/eval.scm:
 375: 1 [eval # #]
In unknown file:
   ?: 0 [system* "test/run"]

ERROR: In procedure system*:
ERROR: In procedure system*: No such file or directory
note: keeping build directory
`/tmp/nix-build-jihisz016g3yjdrfgls0zn718cz0rzxm-attr-2.4.46.drv-0'
builder for `/nix/store/jihisz016g3yjdrfgls0zn718cz0rzxm-attr-2.4.46.drv'
failed with exit code 1
@ build-failed /nix/store/jihisz016g3yjdrfgls0zn718cz0rzxm-attr-2.4.46.drv
/nix/store/zpzl9z209wnrfi4f90rq7k0lzz7q7ixy-attr-2.4.46 1 builder for
`/nix/store/jihisz016g3yjdrfgls0zn718cz0rzxm-attr-2.4.46.drv' failed
with exit code 1
error: build failed: build of
`/nix/store/jihisz016g3yjdrfgls0zn718cz0rzxm-attr-2.4.46.drv' failed

Is this a different issue?

('attr' builds fine on x86_64. [1])

Nikita

[1] http://hydra.nixos.org/job/gnu/guix-distro-master/attr-2.4.46

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 'build-use-chroot = true' leads to 'ERROR: In procedure system*: No such file or directory'
  2012-12-16 15:08   ` Nikita Karetnikov
@ 2012-12-16 16:46     ` Ludovic Courtès
  2012-12-16 19:09       ` Nikita Karetnikov
  0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2012-12-16 16:46 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: bug-guix

Hi Nikita,

Nikita Karetnikov <nikita.karetnikov@gmail.com> skribis:

> I'm getting the same error with the following command:
>
> # ./pre-inst-env guix-daemon --build-users-group=nixbld -C 0

[...]

>> An option is to replace /bin/sh by the statically-linked Bash that’s in
>> distro/packages/bootstrap/*-linux/bash
>
> Same error.

OK.  Can you copy/paste the actual error, because I’m losing track.  ;-)

>> Another one, which I think we’ll do, is to change gnu-build-system.scm
>> to either run (system* "/path/to/our/bash" "./configure" ...), or call
>> ‘patch-shebangs’ on ‘configure’.
>
> I don't know how to change the former, but I've tried the latter.
>
> gnu-build-system.scm:
>
> (phases set-paths unpack patch patch-shebangs configure build check
>         install strip)
>
> AFAICT, it changed the build order, but the same error appeared
> anyway.

I actually made this change I had in mind in commit d008415, in the
‘core-updates’ branch.

Currently many packages can be built in ‘core-updates’ in a chroot
without /bin.  The only thing remaining to be fixed is execv* in glibc:
http://sourceware.org/ml/libc-alpha/2012-12/msg00311.html .

>> But more importantly, /bin/sh is likely to be a dynamically-linked
>> executable, linked against stuff from /lib, which is not in
>> ‘build-chroot-dirs’.  Thus, it won’t run in the chroot.
>
> The following works.
>
> nix.conf:
>
> build-users-group = nixbld
> build-use-chroot = true
> build-chroot-dirs = /dev /proc /bin /lib
>
> Does it make sense? Will it help to catch impurities?

(Note that guix-daemon does *not* read nix.conf.)

Adding /bin and /lib means that many binaries beyond /bin/sh are leaked
into the build environment, which is workable, but not great.

If we can manage to build in chroots without /bin at all, that’ll be best.
If we cannot, then we’ll have to do that.

>    ?: 0 [system* "test/run"]
>
> ERROR: In procedure system*:
> ERROR: In procedure system*: No such file or directory

Again that’s because /bin/sh is either missing from the chroot, or it’s
there but it’s a symlink whose target is missing, or it’s a
dynamically-linked binary and some of its requirements are missing.

Just try ‘ldd /bin/sh’.  Everything listed there should be in the chroot.

> ('attr' builds fine on x86_64. [1])

[...]

> [1] http://hydra.nixos.org/job/gnu/guix-distro-master/attr-2.4.46

That’s because hydra.nixos.org runs NixOS; on NixOS /bin/sh is a symlink
to /nix/store/xxx-bash/bin/sh, and the chroot is setup with all the
dependencies of that path added to ‘build-chroot-dirs’.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 'build-use-chroot = true' leads to 'ERROR: In procedure system*: No such file or directory'
  2012-12-16 16:46     ` Ludovic Courtès
@ 2012-12-16 19:09       ` Nikita Karetnikov
  2012-12-16 21:56         ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Nikita Karetnikov @ 2012-12-16 19:09 UTC (permalink / raw)
  To: bug-guix

> OK.  Can you copy/paste the actual error, because I’m losing track.  ;-)

I was talking about this error. [1]

> Again that’s because /bin/sh is either missing from the chroot, or it’s
> there but it’s a symlink whose target is missing, or it’s a
> dynamically-linked binary and some of its requirements are missing.

> Just try ‘ldd /bin/sh’.  Everything listed there should be in the chroot.

Yeah, got it.

First I tried to use 'nix-worker --daemon'.

nix.conf:

build-users-group = nixbld
build-use-chroot = true
build-chroot-dirs = /dev /proc /bin

I copied our 'bash' to '/bin/sh', ran './pre-inst-env
guix-build -K attr', and it succeeded.

Then I tried
'./pre-inst-env guix-daemon --build-users-group=nixbld -C 0 &'.

This error [1] appeared again.

Nikita

[1] https://lists.gnu.org/archive/html/bug-guix/2012-12/msg00093.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 'build-use-chroot = true' leads to 'ERROR: In procedure system*: No such file or directory'
  2012-12-16 19:09       ` Nikita Karetnikov
@ 2012-12-16 21:56         ` Ludovic Courtès
  0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2012-12-16 21:56 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: bug-guix

Nikita Karetnikov <nikita.karetnikov@gmail.com> skribis:

> Then I tried
> './pre-inst-env guix-daemon --build-users-group=nixbld -C 0 &'.
>
> This error [1] appeared again.

By default /bin is not in the chroot.  So you have to run (using, again,
a newly-added option):

  guix-daemon --build-users-group=nixbld --chroot-directory=/bin

(There can be several --chroot-directory options.)

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-12-16 21:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-12  4:52 'build-use-chroot = true' leads to 'ERROR: In procedure system*: No such file or directory' Nikita Karetnikov
2012-12-12 13:33 ` Ludovic Courtès
2012-12-16 15:08   ` Nikita Karetnikov
2012-12-16 16:46     ` Ludovic Courtès
2012-12-16 19:09       ` Nikita Karetnikov
2012-12-16 21:56         ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).