Bug 15892

Summary: systemctl on root user only devices misses /usr/bin/systemd-tty-ask-password-agent
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Steffen Kothe <Steffen.Kothe>
Component: coreAssignee: Unassigned <unassigned>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: Undecided CC: meta.mr.watcher, meta.watcher, ross.burton
Version: 5.0.8   
Target Milestone: 0.0.0   
Hardware: All   
OS: arm64   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Steffen Kothe 2025-06-03 11:55:40 UTC
We recognized following behaviour on a systemd based custom distribution with root user only (headless).

When systemctl is executed with start, stop or restart, a error message is printed on the console:

"Failed to execute /usr/bin/systemd-tty-ask-password-agent: No such file or directory"

A remarkable note on the configuration of our distribution: 

NO_RECOMMENDATIONS = "1" is set to prevent installation of unnecessary or not needed packages on an embedded linux platform. 

Analysis: 

This flaw was introduced in systemd [1] and backported to systemd-stable version v255 [2]. v255.10 > was introduced with bump to yocto-5.0.6 [3] by
changing systemd version v255.4 to 255.13. 

systemd-extra-utils is declared as RRECOMMENDS, but installs systemd-tty-ask-password-agent and companions.

This error message was always existent but hidden, because the log was never displayed.

Additionally, systemctl gets executed by default with tty_ask_password=true when access to the system bus is requested, which in fact tries to fork off the password-agent.

Since I am insecure on how to fix this reliably, I just have a workaround for now. For me, it looks obvious that the password-agent is not required when only a root user is on the system, but it may make sense to install it due to the way systemctl is implemented. 

[4] indicates that arg_ask_password is set to false when systemctl is using the user context of the bus/services.

It must be considered, that systemd-extra-utils installs tools and helpers, which are not necessarily needed on a specific embedded platform at all.

Suggestions:

- Move password-agent to mandatory packages rather then keeping it in extra-utils, preventing issues with NO_RECOMMENDS. 

Workaround:

systemctl --no-ask-password <start, stop, restart>

The workaround assumes a foundational understanding of systemd, which can not be assumed necessarily.

I would appreciate to contribute a patch after confirmation and clarification of a possible and sustainable solution. 

Links:

[1] https://github.com/systemd/systemd.git 
    - since: v256-919-ga408d44531
    - commit: a408d4453145 ("shared: log error when execve fail")

[2] https://github.com/systemd/systemd-stable.git
    - contained since: v255.10~9
    - commit: 76fe6ebee84c ("shared: log error when execve fail")

[3] git://git.openembedded.org/openembedded-core
    - contained since: yocto-5.0.6~66
    - commit: 39eb4070503a ("systemd: stable update 255.4 -> 255.13")

[4] https://github.com/systemd/systemd-stable/blob/v255-stable/src/systemctl/systemctl.c#L1038
Comment 1 Ross Burton 2025-06-05 14:51:25 UTC
I believe we actually just merged a fix for this in oe-core a87d523ab24e4ea87d1b19ea3a0c515cc47db1b6:

https://git.openembedded.org/openembedded-core/commit/?id=a87d523ab24e4ea87d1b19ea3a0c515cc47db1b6

If you need this in a stable branch then please test and send a backport of that commit.

If this isn't the resolution then feel free to reopen this ticket.
Comment 2 Steffen Kothe 2025-06-05 15:42:32 UTC
Confirm fix for scarthgap in:

https://git.openembedded.org/openembedded-core/commit/?h=scarthgap&id=180455ee76a3819933f45ddd6ce9a5610b3ba947

Not yet officially released.

Sorry for bothering you with this!