Subject: Re: pkg/34125
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Raymond Meyer <raymond.meyer@rambler.ru>
List: pkgsrc-bugs
Date: 08/07/2006 12:35:02
The following reply was made to PR pkg/34125; it has been noted by GNATS.

From: Raymond Meyer <raymond.meyer@rambler.ru>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/34125
Date: Mon, 7 Aug 2006 13:20:43 +0100

 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
 }