-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker: load kernelmodules: loop, binfmt_misc #373
base: master
Are you sure you want to change the base?
Conversation
By the way: I've verified that missing |
Unfortunately, this also assumes |
But I think we can check it inside the debian docker container, i.e. Line 95 in f8f3d6f
to cd /pi-gen; ./docker_module_checks && ./build.sh ${BUILD_OPTS} && There you see a new call function check_kernelmodule_loaded {
local kernelMod="$1"
local fail=0
if ! $SUDO modinfo $kernelMod &>/dev/null; then
# module missing
fail=1
else
if $SUDO modprobe -n --first-time $kernelMod &>/dev/null; then
# module not loaded
fail=1
fi
fi
if [[ $fail == 1 ]]; then
echo "missing this kernel modul: $kernelMod. Please load it in your host (on debian like this: sudo modprobe $kernelMod)"
exit 1
fi
}
check_kernelmodule_loaded loop
check_kernelmodule_loaded binfmt_misc So the code running in the container will fail, if the module is not loaded. Any thoughts? (Thanks) |
At least when running on Debian host, I know that it works, because I've seen that within the running container, I'm not entirely certain of the behaviour, when the host is not debian. Does anybody know? |
Reading up on this a bit, I don't think it will work. |
Not having Docker uses the host kernel. I am not sure what happens if the guest tries to load a module that the host kernel has built in. I wonder if a safe way to load it would be to create a dummy image file, attach it with losetup, and then detach it. So you could check lsmod, if loop is not there then use losetup to trigger loading the module. This could be done in build-docker.sh. |
Correct. this is exactly the behaviour! |
|
||
function install_binfmt_support { | ||
local binfmtSupport="binfmt-support" | ||
if ! dpkg -s $binfmtSupport &>/dev/null; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the docker build is especially made to be run on other distros like Fedora & CentOS this should be taken into consideration here. So please also support rpm
or ignore OSes other than Ubuntu & Debian.
I've seen the failure now even with the loop module loaded in the host. Running
in build-docker.sh would work. |
With this branch the error still appears in Ubuntu 20.04 |
The
loop
kernelmodule is needed, otherwise the scriptexport-image/prerun.sh
fails in this linepi-gen/export-image/prerun.sh
Line 42 in f8f3d6f
with the message
See also: #320 (comment)
So this is a fix for #320
(I suggest you pull my previous pull-request first, in order to reduce the commits in this pull request from 2 to 1. [This pr is based on the previous one])