Skip to content
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

Support release image on modern docker, upgrade guest distro to 22.04 #27

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ConnorNelson
Copy link

The first commit fixes #24. It is not clear if #18 is still relevant, but it seems like passing --init is simpler to guarantee our docker-init.

The second commit brings the guest distro to ubuntu 22.04 (Linux 5.15.0-87-generic as of this PR).

@pmorjan
Copy link
Member

pmorjan commented Oct 24, 2023

Thanks for the PR.

The first commit looks good to me.
I think we don't have to support overriding DOCKER_INIT if we instead search for docker-init in $PATH.
Your changes and this should make it work with old and new Docker:

  • in initrd/Makefile: remove all references to docker-init
  • in initrd/mkinitrd.sh: cp $(command -v docker-init) $TMP_DIR/sbin/

Regarding Ubuntu 22.04
Is there a special reason for switching to 22.04? Keep in mind that we must also support s390x.
I would prefer to stay on 20.04 for now unless there is a good reason to switch.
But we could put an additional Dockerfile.2204 in qemu/x86_64/ together with your change in qemu_amd64.go for people who want to try out 22.04.

@ConnorNelson
Copy link
Author

So the issue with searching $PATH for docker-init is that modern installs put it at /usr/libexec/docker/docker-init, which is not in $PATH. We can of course search $PATH:/usr/libexec/docker.

It's not clear to me what the downsides are of --init, but I'm happy to switch the PR to either strategy, just let me know which you prefer and I'll update the PR.


As for Ubuntu 22.04, there isn't a specific reason other than getting a newer kernel (I need some newer features). The s390x part of this project is irrelevant to me, but I understand the concern for maintaining support for it. Another option here (though maybe too-clever) would be to parameterize FROM ubuntu:20.04, e.g.:

ARG UBUNTU_VERSION=20.04
FROM ubuntu:$UBUNTU_VERSION

The we have the Makefile pass through an optional --build-arg UBUNTU_VERSION=22.04.

However, the downside, and where we'll introduce some more complexity is that we'll need some system for constructing kernel.conf dependent on our kernel version. For example, in our ubuntu:22.04 version, we needed to add netfs.ko. If you know what are core requirements are, we can dynamically construct this dependency list using lib/modules/*/modules.dep. Or probably, even better, change the logic of init to remove loadKernelModules/kernel.conf and instead use logic more similar in modprobe.go to automatically resolve these dependencies at runtime (probably a tiny performance hit in parsing modules.dep at runtime).

Alternatively, we can add a Dockerfile.2204 and have the Makefile take care of that optionally. However, there may be interest in 24.04 next year 😉.

Again, let me know what strategy you prefer, and I'd be happy to update the PR.

@pmorjan
Copy link
Member

pmorjan commented Oct 25, 2023

I'm sorry for the confusing regarding the PATH. In all my systems the mount path is always /sbin/docker-init. So your commit is ok. But we could consider removing the check in initrd/Makefile. With your changes it's no longer needed.
So please create a PR with your first commit.

@pmorjan
Copy link
Member

pmorjan commented Oct 25, 2023

If /sbin/docker-init does not exist we could simple try to copy from /usr/libexec/docker/docker-init to support "modern installs". You can add this to your PR if you like.

@pmorjan
Copy link
Member

pmorjan commented Oct 25, 2023

Regarding 22.04 I would prefer a second Dockerfile. If we integrate a second distro/version then we must always test and support it. The base kernel modules are copied into the initrd. Therefore we need the kernel.conf. I think we should make it possible to use 22.04+ but I don't want to switch now nor support two versions. There are other things waiting to be fixed, e.g. removing 'pkg/errors'. A 2nd. PR with a Dockerfile.2022 and maybe some instructions in the readme on how to use it is very welcome.

@pmorjan
Copy link
Member

pmorjan commented May 19, 2024

Thanks @ConnorNelson
See branch ubuntu2204.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failed create release image in Ubuntu 22.04
2 participants