[Featured][systemd] Generated service should not be enabled in featured#383
Open
mlok-nokia wants to merge 1 commit into
Open
[Featured][systemd] Generated service should not be enabled in featured#383mlok-nokia wants to merge 1 commit into
mlok-nokia wants to merge 1 commit into
Conversation
Signed-off-by: mlok <marty.lok@nokia.com>
|
This PR has backport request for branch(es): 202511. ---Powered by SONiC BuildBot
|
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
|
@anamehra : please sign-off if this looks good. |
Contributor
I will take a look. Thanks |
anamehra
self-requested a review
July 15, 2026 18:03
anamehra
reviewed
Jul 15, 2026
anamehra
left a comment
Contributor
There was a problem hiding this comment.
LGTM, need test coverage.
| # otherwise, start/enable corresponding systemd .service unit | ||
|
|
||
| cmds.append(["sudo", "systemctl", "enable", "{}.{}".format(feature_name, feature_suffixes[-1])]) | ||
| if unit_file_state != "generated": |
Contributor
There was a problem hiding this comment.
This behavior looks fine functionally: generated units should not be enabled, and this still keeps the start path intact. Could you add one targeted unit test in tests/featured/featured_test.py for enable_feature() with get_systemd_unit_state() returning generated, asserting unmask and start are called but no systemctl enable command is issued?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why I did it
On multiasic platform, with Trixie, there will be services that will be defined in /run/systemd/generator as "generatad" UnitFileState. Such as PMON, SNMP, radv and other are generated service. Enabling such services fails because it's assumed to be always enabled. This PR modifies the featured to skip enabling the generated services. Fix issue sonic-net/sonic-buildimage#25414
Work item tracking
How I did it
Featured always enabled the service files based on the configuration of the feature table. This PR add code to check is UnitFileState is generated, skip and not append the "systemctl enable " command to the cmds list.
How to verify it
bootup the new image in the multiasic platform, the following log should not be seen in the syslog:
Which release branch to backport (provide reason below if selected)