Subject: Re: pkg/34125
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Gilles Dauphin <Gilles.Dauphin@enst.fr>
List: pkgsrc-bugs
Date: 08/07/2006 14:05:04
The following reply was made to PR pkg/34125; it has been noted by GNATS.

From: Gilles Dauphin <Gilles.Dauphin@enst.fr>
To: pkg-manager@NetBSD.org, gnats-admin@NetBSD.org,
	gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/34125
Date: Mon, 7 Aug 2006 16:00:14 +0200 (CEST)

 >  Gilles, you must be using my chroot scripts for building packages on Solaris.
 >  This PR can be closed because the problem is related to the way var/run is
 >  mounted inside chroot jail and not to pkgsrc.
 >  
 >  When you run 'chroot.enter os=solaris' var/run is mounted read-write inside
 >  chroot jail, via lofs filesystem. Later, when you try to install cyrus-sasl 
 the
 >  script adds a user 'cyrus' to etc/passwd and then calls 'chown cyrus ...'. 
 The
 >  chown call fails, hence the package build fails.
 >  
 >  The reason why 'chown' call fails inside chroot jail is because var/run is
 >  mounted via lofs, and there is a Solaris door in that directory which is used
 >  by name services. This references /etc/passwd file which is outside the 
 chroot
 >  jail.
 >  
 >  To fix this please modify your /opt/sandbox/chroot.sh file, the function
 >  solaris_chroot_enter() needs to be rewritten in the following way:
 >  
 >  solaris_chroot_enter()
 >  {
 >          if ! test -f $CHROOT_DIR/bin/ls
 >          then
 >                  for i in $SOLARIS_MNT_RO_DIRS
 >                  do
 >                          case $i in
 >                                  # Special case
 >                                  var/run)
 >                                          mount -o ro -F tmpfs swap 
 $CHROOT_DIR/$i
 >                                  ;;
 >                                  *)
 >                                          mount -o ro -F lofs /$i 
 $CHROOT_DIR/$i
 >                                  ;;
 >                          esac
 >                  done
 >                  for i in $SOLARIS_MNT_RW_DIRS
 >                  do
 >                          case $i in
 >                                  # Special case
 >                                  var/run)
 >                                          mount -o rw -F tmpfs swap 
 $CHROOT_DIR/$i
 >                                  ;;
 >                                  *)
 >                                          mount -o rw -F lofs /$i 
 $CHROOT_DIR/$i
 >                                  ;;
 >                          esac
 >                  done
 >          fi
 >  
 >          echo "Running: chroot $CHROOT_DIR /usr/xpg4/bin/sh"
 >          chroot $CHROOT_DIR /usr/xpg4/bin/sh
 >  }
 >  
 
 
 Oh YES ! it works :)
 You can close the PR.
 Just one question: is there a case to mount var/run read/write?
 I put var/run in the RO part and cyrus-sasl build.
 Thanks to Raymond and 'segv' ;)
 Gilles