From owner-freebsd-current@freebsd.org Tue Jun 11 18:52:35 2019 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F329E15C392B for ; Tue, 11 Jun 2019 18:52:34 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 972377295F; Tue, 11 Jun 2019 18:52:34 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from [10.46.14.95] (wsip-72-212-151-146.ph.ph.cox.net [72.212.151.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: johalun) by smtp.freebsd.org (Postfix) with ESMTPSA id 147224DA4; Tue, 11 Jun 2019 18:52:33 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Subject: Re: pkg: Cannot open /dev/null:No such file or directory To: jbwlists@hilltopgroup.com, Baptiste Daroussin Cc: freebsd-current References: <20190604073209.4e42a0eb@freyja> <20190604054409.4anei2ljzimqc75m@ivaldir.net> <935a44aa7587cdc07fadc2e33caed1f7@hilltopgroup.com> From: Johannes Lundberg X-Tagtoolbar-Keys: D20190611115231840 Message-ID: Date: Tue, 11 Jun 2019 11:52:31 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <935a44aa7587cdc07fadc2e33caed1f7@hilltopgroup.com> Content-Type: multipart/mixed; boundary="------------F545AD8270A6D91ADDA344E0" Content-Language: en-US X-Rspamd-Queue-Id: 972377295F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_SHORT(-0.95)[-0.954,0]; ASN(0.00)[asn:11403, ipnet:96.47.64.0/20, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jun 2019 18:52:35 -0000 This is a multi-part message in MIME format. --------------F545AD8270A6D91ADDA344E0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi This is probably overkill but I've attached a diff that show my patches to image.sh. It's just a hack so far to make it do what I want and not meant as general purpose. Use the changes you need for your application. Changes (only meant to work for building usb images on amd64 and i386) - mount devfs so pkg will work properly - add "install packages from official repo" option so you won't have to build your own packages for each jail - downloaded packages from official repo is cached locally to avoid excessive downloads - hack for i386 so packages are installed properly - increase swap space to allow for kernel core dumps (for usb image) - execute post-install script "overlay.sh" in the jail if provided in the overlay folder Bapt: Maybe you'll find some of these changes useful? :) /Johannes On 6/11/19 8:52 AM, jbwlists@hilltopgroup.com wrote: > I'm having the same issue with poudriere image; could you please let > me know what you did to fix it?  I'm assuming the image.sh you're > referring to is /usr/local/share/poudriere/image.sh, but I'm not sure > where the change would need to be made. > > Thanks in advance, > Joseph > > > On 2019-06-04 13:02, Johannes Lundberg wrote: >> On 6/3/19 10:44 PM, Baptiste Daroussin wrote: >>> On Tue, Jun 04, 2019 at 07:32:16AM +0200, O. Hartmann wrote: >>>> Hello List, >>>> >>>> lately I ran into a serious problem installing packages in a nanoBSD >>>> environment, in which the package repository server is "remotely" >>>> on site. The >>>> issue as documented below occurs on both 12-STABLE r348529 and >>>> CURRENT r348600 >>>> and must have been introduced shortly, since the last known good >>>> installation >>>> with the environment of ours was on 21st May 2019. >>>> >>>> As far as I know,, the package installation is performed via >>>> "chroot'ed" >>>> environment and somehow /dev/null is out of a sudden not accessible >>>> anymore >>>> while pkg tries to delegate some output to /dev/null. >>>> >>>> What happened here? >>>> >>>> Kind regards and thanks in advance, >>>> >>>> oh >>>> >>>> [...] >>>> All repositories are up to date. >>>> The following 10 package(s) will be affected (of 0 checked): >>>> >>>> New packages to be INSTALLED: >>>>         python3: 3_3 [zeit4] >>>>         sudo: 1.8.27_1 [zeit4] >>>>         devcpu-data: 1.22 [zeit4] >>>>         python36: 3.6.8_2 [zeit4] >>>>         readline: 8.0.0 [zeit4] >>>>         indexinfo: 0.3.1 [zeit4] >>>>         libffi: 3.2.1_3 [zeit4] >>>>         gettext-runtime: 0.19.8.1_2 [zeit4] >>>>         openldap-sasl-client: 2.4.47 [zeit4] >>>>         cyrus-sasl: 2.1.27 [zeit4] >>>> >>>> Number of packages to be installed: 10 >>>> >>> What is new is that pkg is using /dev/null as input when running >>> script? this is >>> new since pkg 1.11 . Somehow this does not seems to be avaalaible in >>> your >>> environement. >> >> Hi >> >> Same things applies to poudriere-image. I had to add a mount devfs >> command to the image.sh script. >> >>> >>> Best regards, >>> Bapt >> >> _______________________________________________ >> freebsd-current@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/freebsd-current >> To unsubscribe, send any mail to >> "freebsd-current-unsubscribe@freebsd.org" --------------F545AD8270A6D91ADDA344E0 Content-Type: text/x-patch; name="image.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="image.diff" --- image.sh.orig 2019-06-06 08:24:36.445264000 -0700 +++ image.sh 2019-06-08 17:44:57.852022000 -0700 @@ -40,6 +40,7 @@ -n imagename -- The name of the generated image -o outputdir -- Image destination directory -p portstree -- Ports tree + -P -- Install packages from official repo -s size -- Set the image size -t type -- Type of image can be one of (default iso+zmfs): -- iso, iso+mfs, iso+zmfs, usb, usb+mfs, usb+zmfs, @@ -112,7 +113,7 @@ . ${SCRIPTPREFIX}/common.sh HOSTNAME=poudriere-image -while getopts "c:f:h:j:m:n:o:p:s:t:X:z:" FLAG; do +while getopts "c:f:h:j:m:n:o:Pp:s:t:X:z:" FLAG; do case "${FLAG}" in c) [ -d "${OPTARG}" ] || err 1 "No such extract directory: ${OPTARG}" @@ -146,6 +147,9 @@ OPTARG="${SAVED_PWD}/${OPTARG}" OUTPUTDIR=${OPTARG} ;; + P) + PKGREPO=1 + ;; p) PTNAME=${OPTARG} ;; @@ -239,7 +243,6 @@ mkdir -p ${WRKDIR}/out [ -z "${EXCLUDELIST}" ] || cat ${EXCLUDELIST} > ${excludelist} cat >> ${excludelist} << EOF -usr/src var/db/freebsd-update var/db/etcupdate boot/kernel.old @@ -351,8 +354,11 @@ make -C ${mnt}/usr/src DESTDIR=${WRKDIR}/world BATCH_DELETE_OLD_FILES=yes SRCCONF=${WRKDIR}/src.conf delete-old delete-old-libs [ ! -d "${EXTRADIR}" ] || cp -fRPp ${EXTRADIR}/ ${WRKDIR}/world/ -mv ${WRKDIR}/world/etc/login.conf.orig ${WRKDIR}/world/etc/login.conf -cap_mkdb ${WRKDIR}/world/etc/login.conf +if [ -e "${WRKDIR}/world/etc/login.conf.orig" ]; then + # No login.conf.orig on 13.0-CURRENT-i386 + mv ${WRKDIR}/world/etc/login.conf.orig ${WRKDIR}/world/etc/login.conf + cap_mkdb ${WRKDIR}/world/etc/login.conf +fi # Set hostname if [ -n "${HOSTNAME}" ]; then @@ -367,12 +373,15 @@ local REPOS_DIR=$(mktemp -dt poudriere_repo) local ABI_FILE - # This pkg rquery is always ran in host so we need a host-centric - # repo.conf always. - cat > "${REPOS_DIR}/repo.conf" <<-EOF - FreeBSD: { enabled: false } - local: { url: file:///${WRKDIR}/world/tmp/packages } - EOF + if [ -n "${PKGREPO}" ]; then + else + # This pkg rquery is always ran in host so we need a host-centric + # repo.conf always. + cat > "${REPOS_DIR}/repo.conf" <<-EOF + FreeBSD: { enabled: false } + local: { url: file:///${WRKDIR}/world/tmp/packages } + EOF + fi export REPOS_DIR PKG_DBDIR # Always need this from host. @@ -387,36 +396,83 @@ # install packages if any is needed if [ -n "${PACKAGELIST}" ]; then mkdir -p ${WRKDIR}/world/tmp/packages - ${NULLMOUNT} ${POUDRIERE_DATA}/packages/${MASTERNAME} ${WRKDIR}/world/tmp/packages + mount -t devfs devfs ${WRKDIR}/world/dev + chroot "${WRKDIR}/world" env /usr/sbin/pwd_mkdb -p /etc/master.passwd + [ -n "${RESOLV_CONF}" ] && cp -v "${RESOLV_CONF}" "${WRKDIR}/world/etc/" + mkdir -p ${POUDRIERE_DATA}/pkgcache/${MASTERNAME} + mkdir -p ${WRKDIR}/world/var/cache/pkg if [ "${arch}" == "${host_arch}" ]; then - cat > "${WRKDIR}/world/tmp/repo.conf" <<-EOF - FreeBSD: { enabled: false } - local: { url: file:///tmp/packages } - EOF - convert_package_list "${PACKAGELIST}" | \ - xargs chroot "${WRKDIR}/world" env \ - REPOS_DIR=/tmp ASSUME_ALWAYS_YES=yes \ - pkg install + if [ -n "${PKGREPO}" ]; then + ${NULLMOUNT} ${POUDRIERE_DATA}/pkgcache/${MASTERNAME} \ + ${WRKDIR}/world/var/cache/pkg + convert_package_list "${PACKAGELIST}" | \ + xargs chroot "${WRKDIR}/world" env \ + ASSUME_ALWAYS_YES=yes \ + pkg install + umount ${WRKDIR}/world/var/cache/pkg + else + ${NULLMOUNT} ${POUDRIERE_DATA}/packages/${MASTERNAME} ${WRKDIR}/world/tmp/packages + cat > "${WRKDIR}/world/tmp/repo.conf" <<-EOF + FreeBSD: { enabled: false } + local: { url: file:///tmp/packages } + EOF + convert_package_list "${PACKAGELIST}" | \ + xargs chroot "${WRKDIR}/world" env \ + REPOS_DIR=/tmp ASSUME_ALWAYS_YES=yes \ + pkg install + umount ${WRKDIR}/world/tmp/packages + fi else - cat > "${WRKDIR}/world/tmp/repo.conf" <<-EOF - FreeBSD: { enabled: false } - local: { url: file:///${WRKDIR}/world/tmp/packages } - EOF - ( - export ASSUME_ALWAYS_YES=yes SYSLOG=no \ - REPOS_DIR="${WRKDIR}/world/tmp/" \ - ABI_FILE="${WRKDIR}/world/usr/lib/crt1.o" - pkg -r "${WRKDIR}/world/" install pkg + if [ -n "${PKGREPO}" ]; then + # Try do same as for amd64 (we only care about i386) + ${NULLMOUNT} ${POUDRIERE_DATA}/pkgcache/${MASTERNAME} \ + ${WRKDIR}/world/var/cache/pkg convert_package_list "${PACKAGELIST}" | \ - xargs pkg -r "${WRKDIR}/world/" install - ) + xargs chroot "${WRKDIR}/world" env \ + ASSUME_ALWAYS_YES=yes \ + pkg install + umount ${WRKDIR}/world/var/cache/pkg + # ${NULLMOUNT} ${POUDRIERE_DATA}/pkgcache/${MASTERNAME} \ + # ${WRKDIR}/world/var/cache/pkg + # ( + # export ASSUME_ALWAYS_YES=yes SYSLOG=no \ + # ABI_FILE="${WRKDIR}/world/usr/lib/crt1.o" + # pkg -r "${WRKDIR}/world/" install pkg + # convert_package_list "${PACKAGELIST}" | \ + # xargs pkg -r "${WRKDIR}/world/" install + # ) + # umount ${WRKDIR}/world/var/cache/pkg + else + ${NULLMOUNT} ${POUDRIERE_DATA}/packages/${MASTERNAME} ${WRKDIR}/world/tmp/packages + cat > "${WRKDIR}/world/tmp/repo.conf" <<-EOF + FreeBSD: { enabled: false } + local: { url: file:///${WRKDIR}/world/tmp/packages } + EOF + ( + export ASSUME_ALWAYS_YES=yes SYSLOG=no \ + REPOS_DIR="${WRKDIR}/world/tmp/" \ + ABI_FILE="${WRKDIR}/world/usr/lib/crt1.o" + pkg -r "${WRKDIR}/world/" install pkg + convert_package_list "${PACKAGELIST}" | \ + xargs pkg -r "${WRKDIR}/world/" install + ) + umount ${WRKDIR}/world/tmp/packages + fi fi - rm -rf ${WRKDIR}/world/var/cache/pkg - umount ${WRKDIR}/world/tmp/packages + umount ${WRKDIR}/world/dev rmdir ${WRKDIR}/world/tmp/packages + rm -rf ${WRKDIR}/world/var/cache/pkg rm ${WRKDIR}/world/var/db/pkg/repo-* 2>/dev/null || : fi + +if [ -e "${WRKDIR}/world/overlay.sh" ]; then + export MASTERNAME + mount -t devfs devfs ${WRKDIR}/world/dev + chroot "${WRKDIR}/world" env LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib /overlay.sh + umount ${WRKDIR}/world/dev +fi + case ${MEDIATYPE} in *mfs) cat >> ${WRKDIR}/world/etc/fstab <<-EOF @@ -574,8 +630,8 @@ mkimg -s gpt -b ${mnt}/boot/pmbr \ -p efi:=${mnt}/boot/boot1.efifat \ -p freebsd-boot:=${mnt}/boot/gptboot \ - -p freebsd-ufs:=${WRKDIR}/raw.img \ - -p freebsd-swap::1M \ + -p freebsd-ufs/gfx-root:=${WRKDIR}/raw.img \ + -p freebsd-swap/gfx-swap::1G \ -o ${OUTPUTDIR}/${FINALIMAGE} ;; tar) --------------F545AD8270A6D91ADDA344E0--