Skip to content

Conversation

@tianon
Copy link
Member

@tianon tianon commented May 16, 2023

Upstart has been EOL for 8 years and isn't used by any distributions we support any more.

Additionally, this removes the "cgroups v1" setup code because it's more reasonable now for us to expect something else to have set up cgroups appropriately (especially cgroups v2).

Honestly, I think we should probably go further and deprecate our sysvinit scripts entirely, but this is a hopefully less controversial change.

Upstart has been EOL for 8 years and isn't used by any distributions we support any more.

Additionally, this removes the "cgroups v1" setup code because it's more reasonable now for us to expect something _else_ to have set up cgroups appropriately (especially cgroups v2).

Signed-off-by: Tianon Gravi <admwiggin@gmail.com>
Copy link
Collaborator

@ctalledo ctalledo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ... thanks!

@ctalledo
Copy link
Collaborator

@tianon: is this the same script that gets installed under /etc/init.d/docker and runs on service docker start on hosts without systemd?

@tianon
Copy link
Member Author

tianon commented May 16, 2023

Yep, the very same!

@tianon
Copy link
Member Author

tianon commented May 16, 2023

Oh, I guess we make a copy at https://github.com/docker/docker-ce-packaging/blob/dcebf9d2dcfd61e22b7a83b442697221084c91d4/deb/common/docker-ce.docker.init that we'll need to update also...

@thaJeztah
Copy link
Member

Ah, yeah; can we do the same as for the systemd unit, and make the packaging repo scripts take the file from this repo?

@tianon
Copy link
Member Author

tianon commented May 17, 2023

can we do the same as for the systemd unit

No, the systemd unit doesn't include this function because with systemd we get to assume cgroups are set up appropriately (as systemd itself does that).

make the packaging repo scripts take the file from this repo

Yes*

* the way that's normally done in "proper" Debian packaging is making the file I linked into a dangling symlink such that when the package is built, it links to the appropriate place from the "orig" source, but I don't remember enough about the build process in that repository to know whether that would work as-is or if we have to do something more complex like bringing the file into the right place during the build.

(See https://github.com/tianon/debian-moby/blob/cc1c7d4d1c1b77b220b55cd93213d3682e778f87/moby-engine/debian/moby-engine.udev for an example of what I mean by "dangling" symlink - it's a symlink that points to a file that doesn't exist in the Git repository, but it does exist in the appropriate place during the actual package build.)

@tianon
Copy link
Member Author

tianon commented May 17, 2023

We technically have

pre-start script
# see also https://github.com/tianon/cgroupfs-mount/blob/master/cgroupfs-mount
if grep -v '^#' /etc/fstab | grep -q cgroup \
|| [ ! -e /proc/cgroups ] \
|| [ ! -d /sys/fs/cgroup ]; then
exit 0
fi
if ! mountpoint -q /sys/fs/cgroup; then
mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
fi
(
cd /sys/fs/cgroup
for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
mkdir -p $sys
if ! mountpoint -q $sys; then
if ! mount -n -t cgroup -o $sys cgroup $sys; then
rmdir $sys || true
fi
fi
done
)
end script
, which is another copy of this same block, but I would argue very strongly that we should remove that entire directory instead (because as noted in the OP here, Upstart is very dead).

Edit: done in #45551

@tianon tianon mentioned this pull request May 17, 2023
@thaJeztah
Copy link
Member

No, the systemd unit doesn't include this function because with systemd we get to assume cgroups are set up appropriately (as systemd itself does that).

Ah, sorry, I mostly meant the "second part" (make sure docker-ce-packaging takes this script from upstream, so that we don't have two separate versions of it in separate repositories.

Dangling symlink could work (or perhaps a "copy the file" as part of packaging if we don't like the dangling symlink?)

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thaJeztah thaJeztah merged commit 6e98a7f into moby:master May 22, 2023
@ctalledo
Copy link
Collaborator

@thaJeztah: would this fix be present in the next Docker Engine release (and when would that be)?

@neersighted
Copy link
Member

I think we'll have a 24.0.2 relatively soon with some correctness fixes for issues we already identified; I'm not sure that getting this into the packaging side (which is still unsolved/todo as you can see from the above conversation) will be a blocker.

That being said we can likely get this out in a couple of weeks worst-case, but this is a pretty rough band-aid (I will try and discuss more of my concerns in the email thread with the WSL team)/probably not the right way to solve the WSL 'problem.'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants