Skip to content

Add After=dbus.service to containerd.service#10798

Merged
dmcgowan merged 1 commit into
containerd:mainfrom
benjaminp:patch-1
Oct 17, 2024
Merged

Add After=dbus.service to containerd.service#10798
dmcgowan merged 1 commit into
containerd:mainfrom
benjaminp:patch-1

Conversation

@benjaminp

Copy link
Copy Markdown
Contributor

containerd launches runc, which communicates via dbus with systemd to start transient units. Thus, containerd should have an After dependency on dbus.service to prevent dbus from being shut down concurrently with containerd.

@k8s-ci-robot

Copy link
Copy Markdown

Hi @benjaminp. Thanks for your PR.

I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@dosubot dosubot Bot added the area/runtime Runtime label Oct 8, 2024
@AkihiroSuda

Copy link
Copy Markdown
Member

/ok-to-test

@AkihiroSuda AkihiroSuda added cherry-pick/1.6.x cherry-pick/1.7.x Change to be cherry picked to release/1.7 branch labels Oct 17, 2024
@AkihiroSuda

Copy link
Copy Markdown
Member

CI failing

 Version '2022.02-3ubuntu0.22.04.2' for 'ovmf' was not found

Please try rebasing

@benjaminp

Copy link
Copy Markdown
Contributor Author

I've now rebased.

containerd launches runc, which communicates via dbus with systemd to start transient units. Thus, containerd should have an `After` dependency on `dbus.service` to prevent dbus from being shut down concurrently with containerd.

Signed-off-by: Benjamin Peterson <benjamin@engflow.com>
@dmcgowan dmcgowan added this pull request to the merge queue Oct 17, 2024
Merged via the queue into containerd:main with commit ce265ff Oct 17, 2024
@benjaminp benjaminp deleted the patch-1 branch October 18, 2024 20:51
@austinvazquez austinvazquez added cherry-picked/1.6.x PR commits are cherry-picked into release/1.6 branch cherry-picked/1.7.x PR commits are cherry-picked into release/1.7 branch and removed cherry-pick/1.6.x cherry-pick/1.7.x Change to be cherry picked to release/1.7 branch labels Nov 20, 2024
@champtar

champtar commented Dec 5, 2024

Copy link
Copy Markdown
Contributor

I don't think this is needed, containerd.service has an implicit After=basic.target (see systemctl show containerd -p After), and dbus has an explicit Before=basic.target (systemctl cat dbus | grep Before)
EDIT: on EL9, on EL8 dbus has no Before

@VannTen

VannTen commented Dec 5, 2024

Copy link
Copy Markdown

sidenote: the same thing can be said for local-fs.target, it is implied in basic.target (see the graphic in man 7 bootup)

@benjaminp

Copy link
Copy Markdown
Contributor Author

I don't think this is needed, containerd.service has an implicit After=basic.target (see systemctl show containerd -p After), and dbus has an explicit Before=basic.target (systemctl cat dbus | grep Before) EDIT: on EL9, on EL8 dbus has no Before

The upstream dbus service file does not have a Before dependency on basic.target. As you've noted, some distributions or distribution versions add this Before. It's safest for the containerd.service to be explicit for the lowest common denominator.

@VannTen

VannTen commented Dec 5, 2024 via email

Copy link
Copy Markdown

@benjaminp

Copy link
Copy Markdown
Contributor Author

As the PR request message notes, the need for this dependency most is most acutely demonstrated in practice during shutdown. It's undesirable to have dbus shut down when containerd is still managing runc containers.

@VannTen

VannTen commented Dec 5, 2024 via email

Copy link
Copy Markdown

@champtar

champtar commented Dec 6, 2024

Copy link
Copy Markdown
Contributor

Actually EL9 / Fedora use dbus-broker (https://github.com/bus1/dbus-broker/blob/main/src/units/system/dbus-broker.service.in) and not the original dbus, thus the difference in unit files.
After=dbus.service is indeed needed for distro using the original dbus.

ameukam added a commit to ameukam/kops that referenced this pull request Sep 5, 2025
Needed to ensure shutdown ordering so dbus does its cleanup after
containers are shutdown.
See:
 - containerd/containerd#10798
 - https://bugs-devel.debian.org/cgi-bin/bugreport.cgi?bug=1083290

Signed-off-by: Arnaud Meukam <ameukam@gmail.com>
ameukam added a commit to ameukam/kops that referenced this pull request Sep 5, 2025
Needed to ensure shutdown ordering so dbus does its cleanup after
containers are shutdown.
See:
 - containerd/containerd#10798
 - https://bugs-devel.debian.org/cgi-bin/bugreport.cgi?bug=1083290

Signed-off-by: Arnaud Meukam <ameukam@gmail.com>
ameukam added a commit to ameukam/kops that referenced this pull request Sep 5, 2025
Needed to ensure shutdown ordering so dbus does its cleanup after
containers are shutdown.
See:
 - containerd/containerd#10798
 - https://bugs-devel.debian.org/cgi-bin/bugreport.cgi?bug=1083290

Signed-off-by: Arnaud Meukam <ameukam@gmail.com>
ameukam added a commit to ameukam/kops that referenced this pull request Feb 25, 2026
Needed to ensure shutdown ordering so dbus does its cleanup after
containers are shutdown.
See:
 - containerd/containerd#10798
 - https://bugs-devel.debian.org/cgi-bin/bugreport.cgi?bug=1083290

Signed-off-by: Arnaud Meukam <ameukam@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/runtime Runtime cherry-picked/1.6.x PR commits are cherry-picked into release/1.6 branch cherry-picked/1.7.x PR commits are cherry-picked into release/1.7 branch ok-to-test size/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants