Skip to content

systemd-run switchover prepration#2435

Draft
jelly wants to merge 3 commits into
cockpit-project:mainfrom
jelly:exec-systemd-run
Draft

systemd-run switchover prepration#2435
jelly wants to merge 3 commits into
cockpit-project:mainfrom
jelly:exec-systemd-run

Conversation

@jelly
Copy link
Copy Markdown
Member

@jelly jelly commented Feb 12, 2026

No description provided.

Allows us to easier transition to self.execute with systemd-run support.
In the future we want to remove SSHConnection as these are machine core
internals we want to rework. systemd-run supports spawning a logind
session as `admin` which is perfect for running simple commands, but for
`podman run -d` we need to allow systemd-run to run in the background.
For those cases introduce a background mechanism by starting a transient
unit, the downside is that getting stdout out of is impossible.
Comment thread test/check-application
if background:
unit = f'user-{uuid.uuid4()}'
m.execute(f"{sd_run_admin} --unit={unit} /bin/sh -ec '{cmd}'")
m.execute(f"until {sd_run_admin} is-active {unit}; do sleep 1; done")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Isn't that redundant?

systemd-run will start the service asynchronously in the background and return after the command has begun execution (unless --no-block, --wait, --pipe, or --pty are specified, see below)

@jelly jelly mentioned this pull request Apr 17, 2026
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.

2 participants