Open mariovor opened 2 years ago
Hi @mariovor, thanks for giving Sysbox a shot and for filing the issue.
On a quick look, it seems Kaniko (running inside the Sysbox container) is failing as it's trying to remove file lib/modules/5.15.0-1005-aws/modules.builtin.modinfo
file and it's hitting an error because Sysbox implicitly mounts the host's /lib/modules/<kernel-ver>
into the container as read-only (in this way it's different than other container runtimes).
Sysbox does this implicit mount because several programs that typically run inside Sysbox containers use the files under /lib/modules/<kernel-ver>
.
One work-around (if you are open to it) would be to explicitly mount a dummy Docker volume over the container's /lib/modules/<kernel-ver>
, as follows:
docker run -v $PWD:/app --rm -it --entrypoint="" --runtime=sysbox-runc -v dummyvol:/lib/modules/5.15.0-1005-aws gcr.io/kaniko-project/executor:v1.8.1-debug /bin/sh
This way, inside the container the directory /lib/modules/5.15.0-1005-aws
will now be read-write and empty, and Kaniko should not complain any more.
However, this will not work in Kaniko in fact expects the container's /lib/modules/5.15.0-1005-aws
directory to hold the kernel module files (since we mounted a dummy volume on it). In that case, you would need to create a copy of /lib/modules/5.15.0-1005-aws
into some other dir on the host, and mount that other dir into the Sysbox container. This way Kaniko will see the original contents of the /lib/modules/<kernel>
dir and can modify them as needed.
I don't recommend mounting the host's /lib/modules/5.15.0-1005-aws
into the container as read-write, as otherwise the container can mess up the host's config (e.g., if it decides to delete files in there, like Kaniko is apparently doing).
Hope that makes sense.
Thanks @ctalledo for the analysis. We are seeing this error in our GitLab Runners which we swiched some time ago to Sysbox.
I will try out your workaround, however I'am suprised that Kaniko is trying to remove anything in lib/modules/5.15.0-1005-aws
. Thats sound really strange to me. Maybe that is a bug on their side.
I will try out your workaround, however I'am suprised that Kaniko is trying to remove anything in
lib/modules/5.15.0-1005-aws
. Thats sound really strange to me. Maybe that is a bug on their side.
I was surprised too, but that's clearly what it's doing (apparently is trying to replace the file with a symlink):
error building image: error building stage: failed to get filesystem from image: error removing lib to make way for new symlink: unlinkat //lib/modules/5.15.0-1005-aws/modules.builtin.modinfo: read-only file system
(unlinkat
is Linux jargon for removing a file).
Let me know what you find out @mariovor.
Thanks!
Environment: AWS; Ubuntu 22.04 Shifts:
Sysbox:
Dockerfile:
Steps to reproduce: Start container:
Run Kaniko
Error
Running with default runtime works.
Let me know if you need more information.