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

[Quadlet] Implicit network online dependencies cannot be removed #24193

Closed
lambinoo opened this issue Oct 7, 2024 · 4 comments · Fixed by #24194
Closed

[Quadlet] Implicit network online dependencies cannot be removed #24193

lambinoo opened this issue Oct 7, 2024 · 4 comments · Fixed by #24194
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. quadlet

Comments

@lambinoo
Copy link
Contributor

lambinoo commented Oct 7, 2024

Issue Description

As explained in the quadlet man page, we should be able to remove the network-online.target implicit dependency by just overriding it with After=. But this doesn't really seem to work at all. The network-online dependencies seem to stick even by adding a After= in a [Unit] section.

In the systemd.unit man page itself, it even seems to say that you cannot reset "dependencies" (After=, Wants=) into an empty list.

Dependencies (After=, etc.) cannot be reset to an empty list, so dependencies can only be added in
drop-ins. If you want to remove dependencies, you have to override the entire unit.

Steps to reproduce the issue

Steps to reproduce the issue

  1. Create a sleep.container file
    [Unit]
    After=
    Wants=
    
    [Container]
    Image=docker://docker.io/ubuntu:jammy
    Exec=sleep infinity
    

Describe the results you received

systemctl cat sleep.service will show the following:

# /run/systemd/generator/sleep.service
# Automatically generated by /usr/lib/systemd/system-generators/podman-system-generator
[Unit]
Wants=network-online.target
After=network-online.target
After=
Wants=
[...]

But looking at the effective dependencies of the unit, we can see the following:

# systemctl show sleep.service -p After -p Wants
Wants=network-online.target
After=network-online.target sysinit.target basic.target systemd-journald.socket -.mount system.slice

Describe the results you expected

That we do not see the network-online.target default dependencies added by quadlet.

podman info output

Running podman version 5.2.2 on Centos 9 stream on an amd64 machine.

Podman in a container

No

Privileged Or Rootless

Privileged

Upstream Latest Release

No

Additional environment details

Additional environment details

Additional information

Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting

@lambinoo lambinoo added the kind/bug Categorizes issue or PR as related to a bug. label Oct 7, 2024
@Luap99
Copy link
Member

Luap99 commented Oct 7, 2024

Oh, I did not expect that. I assumed you can unset them like other settings. I guess we need a special quadlet key then to unset this.

cc @ygalblum

@Luap99 Luap99 added the quadlet label Oct 7, 2024
@lambinoo
Copy link
Contributor Author

lambinoo commented Oct 7, 2024

I was under the same impression, but this was buried quite deep in the man pages.. Noticed this issue while looking at boot plots from systemd-analyze to check why everything seemed to start later than expected.

Something like QuadletDefaultDependencies= would make sense, to stay close to how systemd does things with DefaultDependencies=

@ygalblum
Copy link
Contributor

ygalblum commented Oct 7, 2024

I agree. @lambinoo would like to contribute this?

@lambinoo
Copy link
Contributor Author

lambinoo commented Oct 7, 2024

@ygalblum Sure, got the PR ready!

lambinoo added a commit to lambinoo/podman that referenced this issue Oct 9, 2024
Quadlet inserts network-online.target Wants/After dependencies to ensure pulling works.
Those systemd statements cannot be subsequently reset.

In the cases where those dependencies are not wanted, we add a new
configuration item called `DefaultDependencies=` in a new section called
[Quadlet]. This section is shared between different unit types.

fixes containers#24193

Signed-off-by: Farya L. Maerten <[email protected]>
@stale-locking-app stale-locking-app bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Jan 8, 2025
@stale-locking-app stale-locking-app bot locked as resolved and limited conversation to collaborators Jan 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. quadlet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants