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

When running systemd in a container set container_uuid #13622

Merged
merged 1 commit into from
Mar 24, 2022

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Mar 23, 2022

systemd expects the container_uuid environment variable be set
when it is running in a container.

Fixes: #13187

Signed-off-by: Daniel J Walsh [email protected]

@rhatdan
Copy link
Member Author

rhatdan commented Mar 23, 2022

@edsantiago PTAL

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 23, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhatdan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 23, 2022
@mheon
Copy link
Member

mheon commented Mar 23, 2022

LGTM

@Luap99
Copy link
Member

Luap99 commented Mar 23, 2022

You have the wrong issue number linked!

@edsantiago
Copy link
Member

Yeah, I don't understand the Fixes line. #13619 is another PR. I can't find (from a quick glance at issues) what the real issue should be.

run_podman inspect test --format '{{ .ID }}'
run expr substr "${output}" 1 32
is "$uuid" "$output" "UUID should be first 32 chars of Container id"

Copy link
Member

Choose a reason for hiding this comment

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

Suggestion:

    run_podman inspect ...
    is "$uuid" "${output:0:32}" "container_uuid envariable should be the first 32 chars of container ID"
    run_podman rm test

Copy link
Member Author

Choose a reason for hiding this comment

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

I figured you'd have an easier way.

Copy link
Member

Choose a reason for hiding this comment

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

I find the use of UUID here (in the comment) misleading, that's why I suggested "container_uuid envariable" instead.

Also, could you remove the unneeded trailing empty line?

Also, this seems the sort of thing that needs documenting, I just can't find where it should go

@@ -968,6 +968,7 @@ func (c *Container) mountNotifySocket(g generate.Generator) error {
// systemd expects to have /run, /run/lock and /tmp on tmpfs
// It also expects to be able to write to /sys/fs/cgroup/systemd and /var/log/journal
func (c *Container) setupSystemd(mounts []spec.Mount, g generate.Generator) error {
g.AddProcessEnv("container_uuid", c.ID()[:32])
Copy link
Member

Choose a reason for hiding this comment

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

I think you should check that container_uuid is not already set

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

@rhatdan
Copy link
Member Author

rhatdan commented Mar 23, 2022

Fixed the fixed link as well.

systemd expects the container_uuid environment variable be set
when it is running in a container.

Fixes: containers#13187

Signed-off-by: Daniel J Walsh <[email protected]>
@mheon
Copy link
Member

mheon commented Mar 24, 2022

LGTM

@edsantiago
Copy link
Member

/lgtm

@rhatdan rhatdan added the lgtm Indicates that a PR is ready to be merged. label Mar 24, 2022
@openshift-merge-robot openshift-merge-robot merged commit e657c7a into containers:main Mar 24, 2022
@rhatdan rhatdan deleted the systemd1 branch December 1, 2022 22:02
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 20, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set $container_uuid for systemd containers
5 participants