blablacar / dgr

Container build and runtime tool
Apache License 2.0
249 stars 21 forks source link

/tmp is missing inside the chroot #214

Closed f0 closed 7 years ago

f0 commented 8 years ago

Hi,

i am hit by the following error:

i try to install some packages from the builder in the chroot ,(via apt on debian-stretch) this fails because apt cannot create a file in /tmp. The builder has the same image as dependecy as the build

The reason is that /tmp is missing in the chroot (maybe a side effect of https://github.com/blablacar/dgr/issues/200)

i have attached the full build log, in the test build i run ls -l in the builder an in the chroot

missing-tmp.log.txt

in the builder
+ ls -l /
drwxr-xr-x    2 root     root          4096 Nov 18 18:49 bin
drwxr-xr-x    2 root     root          4096 Mar  4  2016 boot
drwxr-xr-x    5 root     root           360 Nov 20 11:02 dev
drwxr-xr-x    1 root     root          4096 Nov 20 11:02 dgr
drwxr-xr-x    1 root     root          4096 Nov 20 11:02 etc
drwxr-xr-x    2 root     root          4096 Mar  4  2016 home
drwxr-xr-x    8 root     root          4096 Nov 18 18:49 lib
drwxr-xr-x    2 root     root          4096 Nov 18 18:49 lib64
drwxr-xr-x    2 root     root          4096 Nov 18 18:49 media
drwxr-xr-x    2 root     root          4096 Nov 18 18:49 mnt
drwxr-xr-x    1 root     root          4096 Nov 20 11:02 opt
dr-xr-xr-x  502 root     root             0 Nov 20 11:02 proc
drwxr-xr-x    1 root     root          4096 Nov  6 01:41 rkt
drwx------    2 root     root          4096 Nov 18 18:49 root
drwxr-xr-x    3 root     root            60 Nov 20 11:02 run
drwxr-xr-x    2 root     root          4096 Nov 18 18:49 sbin
drwxr-xr-x    2 root     root          4096 Nov 18 18:49 srv
dr-xr-xr-x   13 root     root             0 Nov  6 06:02 sys
drwxrwxrwt    2 root     root            40 Nov 20 11:02 tmp
drwxr-xr-x   10 1000     1000          4096 Nov 20 11:02 usr
drwxr-xr-x   11 root     root          4096 Nov 18 18:49 var
+ echo in the chroot
in the chroot
+ chroot /opt/stage2/aci-minideb-jenkins/rootfs ls -l /
total 152
drwxr-xr-x.  2 root root 4096 Nov 18 18:49 bin
drwxr-xr-x.  2 root root 4096 Mar  4  2016 boot
drwxr-xr-x.  4 root root 4096 Nov 18 18:49 dev
drwxr-xr-x.  1 root root 4096 Nov 20 11:02 dgr
drwxr-xr-x.  1 root root 4096 Nov 20 11:02 etc
drwxr-xr-x.  3 root root 4096 Nov 20 10:17 home
drwxr-xr-x.  8 root root 4096 Nov 18 18:49 lib
drwxr-xr-x.  2 root root 4096 Nov 18 18:49 lib64
drwxr-xr-x.  2 root root 4096 Nov 18 18:49 media
drwxr-xr-x.  2 root root 4096 Nov 18 18:49 mnt
drwxr-xr-x.  2 root root 4096 Nov 18 18:49 opt
drwxr-xr-x.  2 root root 4096 Mar  4  2016 proc
drwx------.  2 root root 4096 Nov 18 18:49 root
drwxr-xr-x.  4 root root 4096 Nov 18 18:49 run
drwxr-xr-x.  2 root root 4096 Nov 18 18:49 sbin
drwxr-xr-x.  2 root root 4096 Nov 18 18:49 srv
drwxr-xr-x.  2 root root 4096 Mar  4  2016 sys
drwxr-xr-x. 10 root root 4096 Nov 20 11:02 usr
drwxr-xr-x. 11 root root 4096 Nov 18 18:49 var
ls -l /opt/stage2/aci-minideb-jenkins/rootfs
drwxr-xr-x    2 root     root          4096 Nov 18 17:49 bin
drwxr-xr-x    2 root     root          4096 Mar  4  2016 boot
drwxr-xr-x    4 root     root          4096 Nov 18 17:49 dev
drwxr-xr-x    1 root     root          4096 Nov 20 11:32 dgr
drwxr-xr-x    1 root     root          4096 Nov 20 11:32 etc
drwxr-xr-x    3 root     root          4096 Nov 20 09:17 home
drwxr-xr-x    8 root     root          4096 Nov 18 17:49 lib
drwxr-xr-x    2 root     root          4096 Nov 18 17:49 lib64
drwxr-xr-x    2 root     root          4096 Nov 18 17:49 media
drwxr-xr-x    2 root     root          4096 Nov 18 17:49 mnt
drwxr-xr-x    2 root     root          4096 Nov 18 17:49 opt
drwxr-xr-x    2 root     root          4096 Mar  4  2016 proc
drwx------    2 root     root          4096 Nov 18 17:49 root
drwxr-xr-x    4 root     root          4096 Nov 18 17:49 run
drwxr-xr-x    2 root     root          4096 Nov 18 17:49 sbin
drwxr-xr-x    2 root     root          4096 Nov 18 17:49 srv
drwxr-xr-x    2 root     root          4096 Mar  4  2016 sys
drwxr-xr-x   10 root     root          4096 Nov 20 11:32 usr
drwxr-xr-x   11 root     root          4096 Nov 18 17:49 var
f0 commented 8 years ago

additional info , inside the "build" step it is correct

+ echo -e \033[0;32mRunning script -> /dgr/builder/runlevels/build/10.install.sh\033[0m
Running script -> /dgr/builder/runlevels/build/10.install.sh
+ /dgr/builder/runlevels/build/10.install.sh
+ echo I'm a build script that is run to install applications
I'm a build script that is run to install applications
+ echo build step
build step
+ ls -l
drwxr-xr-x    2 root     root          4096 Nov 18 18:49 bin
drwxr-xr-x    2 root     root          4096 Mar  4  2016 boot
drwxr-xr-x    5 root     root           360 Nov 20 11:53 dev
drwxr-xr-x    1 root     root          4096 Nov 20 11:53 dgr
drwxr-xr-x    1 root     root          4096 Nov 20 11:53 etc
drwxr-xr-x    3 root     root          4096 Nov 20 10:17 home
drwxr-xr-x    8 root     root          4096 Nov 18 18:49 lib
drwxr-xr-x    2 root     root          4096 Nov 18 18:49 lib64
drwxr-xr-x    2 root     root          4096 Nov 18 18:49 media
drwxr-xr-x    2 root     root          4096 Nov 18 18:49 mnt
drwxr-xr-x    2 root     root          4096 Nov 18 18:49 opt
dr-xr-xr-x  509 root     root             0 Nov 20 11:53 proc
drwx------    2 root     root          4096 Nov 18 18:49 root
drwxr-xr-x    3 root     root            60 Nov 20 11:53 run
drwxr-xr-x    2 root     root          4096 Nov 18 18:49 sbin
drwxr-xr-x    2 root     root          4096 Nov 18 18:49 srv
dr-xr-xr-x   13 root     root             0 Nov  6 06:02 sys
drwxrwxrwt    2 root     root            40 Nov 20 11:53 tmp
drwxr-xr-x   10 root     root          4096 Nov 20 11:53 usr
drwxr-xr-x   11 root     root          4096 Nov 18 18:49 var
n0rad commented 7 years ago

Yep this looks like a side effect, systemd-nspawn nomally create /tmp directory.

But in your case, you are in the builder, driving the stage2. There is no systemd-nspawn run on the stage2 yet and since we removed tmp directory from the dependencies, there is no tmp folder until entering into build step.

n0rad commented 7 years ago

I propose to empty tmp directory and set right permission before zipping if exists.

n0rad commented 7 years ago

This is not working, tmp permission are still wrong in the aci. I have updated builder script to prepare tmp stage2 directory instead.

n0rad commented 7 years ago

fixed in v78