build icon indicating copy to clipboard operation
build copied to clipboard

/tmp missing when calling `acbuild run`

Open chancez opened this issue 10 years ago • 6 comments

Example:

root@core-01:/home/core/testcore-01 test # echo "test" > foo.txt
root@core-01:/home/core/testcore-01 test # rkt image export busybox busybox.aci
root@core-01:/home/core/testcore-01 test # ls
busybox.aci  foo.txt
root@core-01:/home/core/testcore-01 test # acbuild begin busybox.aci
root@core-01:/home/core/testcore-01 test # acbuild copy foo.txt /tmp/foo.txt
root@core-01:/home/core/testcore-01 test # acbuild run cat /tmp/foo.txt
Timezone UTC does not exist in container, not updating container timezone.
cat: can't open '/tmp/foo.txt': No such file or directory
run: exit status 1
root@core-01:/home/core/testcore-01 test # acbuild run ls /tmp
Timezone UTC does not exist in container, not updating container timezone.
root@core-01:/home/core/testcore-01 test # ls .acbuild/
currentaci/        depstore-expanded/ depstore-tar/
core-01 test # ls .acbuild/currentaci/rootfs/tmp
foo.txt

chancez avatar Oct 25 '15 00:10 chancez

Hmph, nspawn mounting a tmpfs that's masking it I guess On Oct 24, 2015 5:26 PM, "Chance Zibolski" [email protected] wrote:

Example:

root@core-01:/home/core/testcore-01 test # echo "test" > foo.txt root@core-01:/home/core/testcore-01 test # rkt image export busybox busybox.aci root@core-01:/home/core/testcore-01 test # ls busybox.aci foo.txt root@core-01:/home/core/testcore-01 test # acbuild begin busybox.aci root@core-01:/home/core/testcore-01 test # acbuild copy foo.txt /tmp/foo.txt root@core-01:/home/core/testcore-01 test # acbuild run cat /tmp/foo.txt Timezone UTC does not exist in container, not updating container timezone. cat: can't open '/tmp/foo.txt': No such file or directory run: exit status 1 root@core-01:/home/core/testcore-01 test # acbuild run ls /tmp Timezone UTC does not exist in container, not updating container timezone. root@core-01:/home/core/testcore-01 test # ls .acbuild/ currentaci/ depstore-expanded/ depstore-tar/ core-01 test # ls .acbuild/currentaci/rootfs/tmp foo.txt

— Reply to this email directly or view it on GitHub https://github.com/appc/acbuild/issues/66.

jonboulle avatar Oct 25 '15 02:10 jonboulle

Maybe a question for AppC? We never persist /tmp either.

krobertson avatar Oct 25 '15 03:10 krobertson

@krobertson what do you do if an image contains a (pre-populated) /tmp?

jonboulle avatar Oct 28 '15 00:10 jonboulle

Until recently, we were mounting a tmpfs on /tmp, so it would have taken over it. We stopped doing that, so now if the image has /tmp, it is preserved. Kurma doesn't currently have snapshot support, but our level Continuum does, and it always skips /tmp.

IMO, it is sane to clear /tmp. If you want to compare a container startup to a system boot, it is common for /tmp to be clean.

krobertson avatar Oct 28 '15 15:10 krobertson

Hm, does someone want to put up a PR for that?

On Wed, Oct 28, 2015 at 8:29 AM Ken Robertson [email protected] wrote:

Until recently, we were mounting a tmpfs on /tmp, so it would have taken over it. We stopped doing that, so now if the image has /tmp, it is preserved. Kurma doesn't currently have snapshot support, but our level Continuum does, and it always skips /tmp.

IMO, it is sane to clear /tmp. If you want to compare a container startup to a system boot, it is common for /tmp to be clean.

— Reply to this email directly or view it on GitHub https://github.com/appc/acbuild/issues/66#issuecomment-151882146.

jonboulle avatar Oct 29 '15 19:10 jonboulle

@ krobertson: "IMO, it is sane to clear /tmp." Fully agreed, and if you use /tmp in the course of building a container you should clear /tmp before acbuild exit. IMO: It is not sane to clobber a folder you don't exclusively own and use. It is not sane to make it difficult clear temporary files, which is the result when it is not possible to simply use /tmp for temporary files and run rm -rf /tmp/.

This hurts in the following context. Previously, I used /tmp but that is prevented by this issue, so I now unpack into a folder in root and install from there - fraught practice that has been frowned on in favor of placing temporary things in a "/tmp" folder:

out=/tmp/aci
if [ ! -e basic_rootfs ]; then
    debootstrap --verbose --force-check-gpg --variant=minbase \
    --components=main,universe,multiverse,restricted --include="${PKG_LIST}" \
    --arch=${arch} $dist $out $mirror
    rm -rf ${out}/var/cache/apt/archives/*
    pushd ${out}**/tmp**
      curl -O https://cran.r-project.org/src/base/R-3/R-${R_VERSION}.tar.gz
      ## Extract source code
      tar -xf R-${R_VERSION}.tar.gz
   popd
    cp ./scripts/${rname}_build.sh ${out}**/tmp**/R-${R_VERSION}/${rname}_build.sh
    chmod +x ${out}**/tmp**/R-${R_VERSION}/${rname}_build.sh
    mv $out basic_rootfs
fi

cp -r basic_rootfs rootfs

# Start the build with ACI bootstrapped above
$ACBUILD begin ./rootfs
# etc.
$ACBUILD run -- /bin/bash -c "eval /tmp/R-${R_VERSION}/${rname}_build.sh"

# Due to https://github.com/containers/build/issues/66
# $ACBUILD run --working-dir=/R-${R_VERSION} -- /bin/bash -c "eval /R-${R_VERSION}/${rname}_build.sh"

# Cleanup is no longer as simple as:
# $ACBUILD run -- rm -rf /tmp/

taqtiqa-mark avatar Jul 16 '17 18:07 taqtiqa-mark