Skip to content

man: systemctl doesn't operate multiple units in a single transaction - #7947

Closed
johnlinp wants to merge 1 commit into
systemd:mainfrom
johnlinp:fix-systemctl-no-single-transaction
Closed

johnlinp wants to merge 1 commit into
systemd:mainfrom
johnlinp:fix-systemctl-no-single-transaction

Conversation

@johnlinp

Copy link
Copy Markdown
Contributor

Fixes: #7877

Comment thread man/systemctl.xml Outdated

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.

The first sentence is not clear for me. Sorry for my poor English reading skill. Do you want to say the following?
%%%
When more than two units are specified in the single operation, then no ordering dependency between them are considered in the operation. For example, ...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review. English is not my native language either, so don't be sorry for anything. However, I saw 2 issues in your statement:

  1. it's "more than one unit" instead of "more than two units"
  2. systemctl start first second will make the ordering dependency take effect. Therefore, I don't think it's safe to say "no ordering dependency between them are considered in the operation".

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.

  1. Oops...
  2. Is it? I do not check the relevant code. But if so, what is the real limitation here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

I see. Not tested, but it makes sense for me. I did not catch that from your original commit. I hope it is explained as the answer.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

OK. I will modify my commit. Thanks!

@bl33pbl0p

Copy link
Copy Markdown
Contributor

I still feel it would be nice if systemctl is taught to do it as a single transaction, idk about how this impacts backwards compatibility, but I very much expect it to behave as a single transaction, and I'm pretty sure it has just gone unnoticed until now. Fixing this as a documentation problem would create other issues (as then 237 ships and now it's documented behaviour which can only be changed by adding a switch on top).

@poettering

Copy link
Copy Markdown
Member

I still feel it would be nice if systemctl is taught to do it as a single transaction, idk about how this impacts backwards compatibility, but I very much expect it to behave as a single transaction, and I'm pretty sure it has just gone unnoticed until now. Fixing this as a documentation problem would create other issues (as then 237 ships and now it's documented behaviour which can only be changed by adding a switch on top).

So, yes we should have this as single transaction, but I think it's too late to make this change silently now, in order not to break compa. So yes, we should add the single-transaction concept, but in a new option --combine or so. And that means the status quo should be documented, hence I think this patch should go in

@johnlinp
johnlinp force-pushed the fix-systemctl-no-single-transaction branch from cf06364 to d93dbde Compare January 25, 2018 03:29
@keszybz

keszybz commented Jan 27, 2018

Copy link
Copy Markdown
Member

Do we really want to document this? Current behaviour seems bad, but since it's not documented, there are no guarantees either way. Once we document it, we can't change it. I'd rather not merge this, but instead keep the question open, and make it a single transaction in the future.

@johnlinp

Copy link
Copy Markdown
Contributor Author

@keszybz According to Lennart's previous email:

I figure the original plan was to keep our options open by not documenting the precise effect, in order that we can change behaviour here and make it a single transaction, but since we still didn't do that I figure we should document behaviour here, and when we add this later do so in an opt-in way via some switch, since such a change of behaviour would be pretty much a compat breakage at this point.

I agree with Lennart's point. What do you think @keszybz?

@keszybz

keszybz commented Jan 27, 2018

Copy link
Copy Markdown
Member

I don't think this would be compat breakage. If I wanted to be sure that I get separate transactions, I'd use systemctl start a.service && systemdctl start b.service, and in fact, I recall doing that in cases where I thought it'd matter. I think it's totally OK to change the behaviour (when we get around to it), as long as this detail is not documented.

@johnlinp

Copy link
Copy Markdown
Contributor Author

@keszybz Is there an existing issue about the single transaction API? I can create one if there is none.

@arvidjaar

arvidjaar commented Jan 28, 2018 •

Copy link
Copy Markdown
Contributor

@keszybz

Current behaviour seems bad

I still fail to understand why. The only use case for "transnational systemctl" I can think of is to workaround incomplete unit definitions that do not define needed dependencies. Instead of properly configuring your units so service manager can make all necessary work for you you want to sidestep service manager.

I'd still love to see real life example of configuration that requires transnational behavior of systemctl.

Either two units cannot be started in arbitrary order in which case their definition must clearly say so, or they can be started in arbitrary order in which case I do not understand why systemctl start second; systemctl start first is acceptable but systemctl start second first suddenly not.

@keszybz

keszybz commented Jan 28, 2018

Copy link
Copy Markdown
Member

You're right, "bad" is the wrong word here. It should just be a single transaction for efficiency / simplicity reasons. I don't think we want to document it as being separate transactions.

@johnlinp

Copy link
Copy Markdown
Contributor Author

@arvidjaar

I'd still love to see real life example of configuration that requires transnational behavior of systemctl.

I have a real world example here: smbd.service and nmbd.service. smbd.service
specifies After=nmbd.service, but no requirement dependencies
on nmbd.service. It means that the 2 services can live without each other,
but when the two services are starting together, ordering matters.

@fbuihuu

fbuihuu commented Feb 5, 2018

Copy link
Copy Markdown
Contributor

FWIW I agree with @keszybz

@fbuihuu

fbuihuu commented Feb 5, 2018

Copy link
Copy Markdown
Contributor

@johnlinp could you open a RFE for it ?

Whatever the default behavior will be, I think it needs to be tracked.

@johnlinp

johnlinp commented Feb 5, 2018

Copy link
Copy Markdown
Contributor Author

@fbuihuu Done. It's at #8102.

Base automatically changed from master to main January 21, 2021 11:54
@keszybz keszybz added the please-review PR is ready for (re-)review by a maintainer label Dec 8, 2022
@daandemeyer daandemeyer added ci-fails/needs-rework 🔥 Please rework this, the CI noticed an issue with the PR needs-rebase and removed please-review PR is ready for (re-)review by a maintainer labels Jan 10, 2023
bluca added a commit to bluca/systemd that referenced this pull request Jun 22, 2026
@bluca

bluca commented Jun 22, 2026

Copy link
Copy Markdown
Member

Superseded by #42182

@bluca bluca closed this Jun 22, 2026
@github-actions github-actions Bot removed needs-discussion 🤔 needs-rebase ci-fails/needs-rework 🔥 Please rework this, the CI noticed an issue with the PR labels Jun 22, 2026
bluca added a commit to bluca/systemd that referenced this pull request Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

man: systemctl doesn't start/stop multiple units in single transaction

10 participants