Subject: pkg/18968: mksandbox causes exec error when chrooting
To: None <>
From: Julio Merino <>
List: netbsd-bugs
Date: 11/08/2002 10:52:20
>Number:         18968
>Category:       pkg
>Synopsis:       mksandbox causes exec error when chrooting
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 08 01:48:01 PST 2002
>Originator:     Julio Merino
>Release:        NetBSD 1.6K
System: NetBSD darkstar.local 1.6K NetBSD 1.6K (DARKSTAR) #130: Thu Nov 7 23:22:44 CET 2002 jmmv@darkstar.local:/var/build/kernel/DARKSTAR i386
Architecture: i386
Machine: i386
	Now that all /bin and /sbin are dynamically linked and we have basic
	libraries in /lib and /libexec, the sandbox generated by the mksandbox
	script does not work properly. This uses the dynamically linked
	binaries but does not include the shared libraries inside the chroot
	environment. (That is, while chrooting, binary programs fail to open
	required libraries, libc).

	This only happens in -current. Haven't checked with 1.6 but it's
	obvious that the problem will not appear.
	# /usr/pkgsrc/mk/bulk/mksandbox /tmp/sandbox
	# /tmp/sandbox/sandbox
	/bin/sh: Exec error
	This fix works in current but I do not know if this will continue to
	work in stable and non netbsd systems (hope mount failures are
	non fatal).

Index: mksandbox
RCS file: /cvsroot/pkgsrc/mk/bulk/mksandbox,v
retrieving revision 1.9
diff -u -u -r1.9 mksandbox
--- mksandbox	2002/08/22 08:21:30	1.9
+++ mksandbox	2002/11/08 09:41:32
@@ -159,6 +159,8 @@
 echo "Make empty dirs upon which to mount the null mounts"
 for d in	/bin							\
+		/lib							\
+		/libexec						\
 		/sbin							\
 		/usr/X11R6						\
 		/usr/bin						\