Skip to content

[featured] fix non existing feature start#234

Merged
qiluo-msft merged 1 commit intosonic-net:masterfrom
stepanblyschak:fix-non-existing-feature-start
Apr 4, 2025
Merged

[featured] fix non existing feature start#234
qiluo-msft merged 1 commit intosonic-net:masterfrom
stepanblyschak:fix-non-existing-feature-start

Conversation

@stepanblyschak
Copy link
Contributor

Fix an issue that when starting a non existing feature and then installing it with sonic-package-manager it won't start.

E.g:

admin@sonic:~$ redis-cli -n 4 hmset 'FEATURE|non-existing' state enabled OK
admin@sonic:~$ sudo zless /var/log/syslog | grep featured 2025 Mar 26 15:19:33.237090 sonic INFO featured: Feature non-existing is enabled and started

With this patch an error is recordded and feature state is not cached:

2025 Mar 26 15:35:32.794640 sonic INFO featured: Running cmd: '['sudo', 'systemctl', 'unmask', 'non-existing.service']'
2025 Mar 26 15:35:33.233685 sonic INFO featured: Output:  , Stderr: Unit non-existing.service does not exist, proceeding anyway.
2025 Mar 26 15:35:33.233743 sonic INFO featured: Running cmd: '['sudo', 'systemctl', 'enable', 'non-existing.service']'
2025 Mar 26 15:35:33.247238 sonic ERR featured: ['sudo', 'systemctl', 'enable', 'non-existing.service'] - failed: return code - 1, output:
2025 Mar 26 15:35:33.247300 sonic ERR featured: Feature 'non-existing.service' failed to be enabled and started
2025 Mar 26 15:35:39.331762 sonic INFO featured: Running cmd: '['sudo', 'systemctl', 'unmask', 'non-existing.service']'
2025 Mar 26 15:35:39.780474 sonic INFO featured: Output:  , Stderr: Unit non-existing.service does not exist, proceeding anyway.
2025 Mar 26 15:35:39.780513 sonic INFO featured: Running cmd: '['sudo', 'systemctl', 'enable', 'non-existing.service']'
2025 Mar 26 15:35:39.795113 sonic ERR featured: ['sudo', 'systemctl', 'enable', 'non-existing.service'] - failed: return code - 1, output:
2025 Mar 26 15:35:39.795153 sonic ERR featured: Feature 'non-existing.service' failed to be enabled and started

Feature will start next time when setting state field in FEATURE table

Fix an issue that when starting a non existing feature and then
installing it with sonic-package-manager it won't start.

E.g:

admin@sonic:~$ redis-cli -n 4 hmset 'FEATURE|non-existing' state enabled
OK

admin@sonic:~$ sudo zless /var/log/syslog | grep featured
2025 Mar 26 15:19:33.237090 sonic INFO featured: Feature non-existing is enabled and started

With this patch an error is recorded and feature state is not cached:

2025 Mar 26 15:35:32.794640 sonic INFO featured: Running cmd: '['sudo', 'systemctl', 'unmask', 'non-existing.service']'
2025 Mar 26 15:35:33.233685 sonic INFO featured: Output:  , Stderr: Unit non-existing.service does not exist, proceeding anyway.
2025 Mar 26 15:35:33.233743 sonic INFO featured: Running cmd: '['sudo', 'systemctl', 'enable', 'non-existing.service']'
2025 Mar 26 15:35:33.247238 sonic ERR featured: ['sudo', 'systemctl', 'enable', 'non-existing.service'] - failed: return code - 1, output:
2025 Mar 26 15:35:33.247300 sonic ERR featured: Feature 'non-existing.service' failed to be enabled and started
2025 Mar 26 15:35:39.331762 sonic INFO featured: Running cmd: '['sudo', 'systemctl', 'unmask', 'non-existing.service']'
2025 Mar 26 15:35:39.780474 sonic INFO featured: Output:  , Stderr: Unit non-existing.service does not exist, proceeding anyway.
2025 Mar 26 15:35:39.780513 sonic INFO featured: Running cmd: '['sudo', 'systemctl', 'enable', 'non-existing.service']'
2025 Mar 26 15:35:39.795113 sonic ERR featured: ['sudo', 'systemctl', 'enable', 'non-existing.service'] - failed: return code - 1, output:
2025 Mar 26 15:35:39.795153 sonic ERR featured: Feature 'non-existing.service' failed to be enabled and started

Feature will start next time when setting state field in FEATURE table

Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
@mssonicbld
Copy link

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@qiluo-msft qiluo-msft merged commit 29b8be8 into sonic-net:master Apr 4, 2025
5 checks passed
@yejianquan
Copy link

Hi @stepanblyschak , this change is blocking submodule advance in master and 202505 branch, could you check:
master:
sonic-net/sonic-buildimage#22160
https://elastictest.org/scheduler/testplan/68451b5304595a8ba1c1f6e3?testcase=pc%2Ftest_lag_member_forwarding.py%7C%7C%7C2&type=console

202505:
sonic-net/sonic-buildimage#22660
https://elastictest.org/scheduler/testplan/6843da51d2f1accb40ff9130?testcase=pc%2Ftest_retry_count.py%7C%7C%7C2&type=console

@qiluo-msft @zbud-msft for viz, since in 202505, telemetry is the only one reporting issue(in master, both frr_bmp and telemetry report issues), not sure whether it's the hidden issue is exposed.

@zbud-msft
Copy link

Hi @yejianquan, telemetry is not a built container in public image. Thats why test fails when running sudo systemctl stop telemetry.service.

@yejianquan
Copy link

Hi @yejianquan, telemetry is not a built container in public image. Thats why test fails when running sudo systemctl stop telemetry.service.

Hi @zbud-msft so we should add the error msg into common ignore list of log analyzer?

@zbud-msft
Copy link

Hi @stepanblyschak seems like featured is trying to stop telemetry.service that is already disabled in public image. Seems like this PR is responsible for that change and needs to be fixed.

qiluo-msft added a commit to qiluo-msft/sonic-host-services that referenced this pull request Jun 19, 2025
@stepanblyschak
Copy link
Contributor Author

@zbud-msft Featured does not do anything special with telemetry.

Errors:

E               Match Messages:
E               2025 Jun  8 06:54:56.883029 vlab-03 ERR featured: ['sudo', 'systemctl', 'enable', 'frr_bmp.service'] - failed: return code - 1, output:
E               
E               2025 Jun  8 06:54:56.883076 vlab-03 ERR featured: Feature 'frr_bmp.service' failed to be enabled and started
E               
E               2025 Jun  8 06:55:11.159750 vlab-03 ERR featured: ['sudo', 'systemctl', 'stop', 'telemetry.service'] - failed: return code - 5, output:
E               
E               2025 Jun  8 06:55:11.159991 vlab-03 ERR featured: Feature 'telemetry.service' failed to be stopped and disabled

could happen only if user provided telemetry in CONFIG_DB when telemetry is not built in the image and correctly reports the issue.

qiluo-msft added a commit that referenced this pull request Jun 20, 2025
This reverts commit 29b8be8.

Because it blocks submodule update in sonic-buildimage repo.
The build and test are verified in a draft PR sonic-net/sonic-buildimage#23027.
mssonicbld added a commit to mssonicbld/sonic-host-services that referenced this pull request Jun 21, 2025
This reverts commit 29b8be8.

Because it blocks submodule update in sonic-buildimage repo.
The build and test are verified in a draft PR sonic-net/sonic-buildimage#23027.
mssonicbld added a commit that referenced this pull request Jun 21, 2025
This reverts commit 29b8be8.

Because it blocks submodule update in sonic-buildimage repo.
The build and test are verified in a draft PR sonic-net/sonic-buildimage#23027.
zbud-msft added a commit that referenced this pull request Jan 13, 2026
zbud-msft pushed a commit to zbud-msft/sonic-host-services that referenced this pull request Jan 13, 2026
Fix an issue that when starting a non existing feature and then installing it with sonic-package-manager it won't start.

E.g:

admin@sonic:~$ redis-cli -n 4 hmset 'FEATURE|non-existing' state enabled OK
admin@sonic:~$ sudo zless /var/log/syslog | grep featured 2025 Mar 26 15:19:33.237090 sonic INFO featured: Feature non-existing is enabled and started
With this patch an error is recordded and feature state is not cached:

2025 Mar 26 15:35:32.794640 sonic INFO featured: Running cmd: '['sudo', 'systemctl', 'unmask', 'non-existing.service']'
2025 Mar 26 15:35:33.233685 sonic INFO featured: Output:  , Stderr: Unit non-existing.service does not exist, proceeding anyway.
2025 Mar 26 15:35:33.233743 sonic INFO featured: Running cmd: '['sudo', 'systemctl', 'enable', 'non-existing.service']'
2025 Mar 26 15:35:33.247238 sonic ERR featured: ['sudo', 'systemctl', 'enable', 'non-existing.service'] - failed: return code - 1, output:
2025 Mar 26 15:35:33.247300 sonic ERR featured: Feature 'non-existing.service' failed to be enabled and started
2025 Mar 26 15:35:39.331762 sonic INFO featured: Running cmd: '['sudo', 'systemctl', 'unmask', 'non-existing.service']'
2025 Mar 26 15:35:39.780474 sonic INFO featured: Output:  , Stderr: Unit non-existing.service does not exist, proceeding anyway.
2025 Mar 26 15:35:39.780513 sonic INFO featured: Running cmd: '['sudo', 'systemctl', 'enable', 'non-existing.service']'
2025 Mar 26 15:35:39.795113 sonic ERR featured: ['sudo', 'systemctl', 'enable', 'non-existing.service'] - failed: return code - 1, output:
2025 Mar 26 15:35:39.795153 sonic ERR featured: Feature 'non-existing.service' failed to be enabled and started
Feature will start next time when setting state field in FEATURE table
zbud-msft pushed a commit to zbud-msft/sonic-host-services that referenced this pull request Jan 13, 2026
Fix an issue that when starting a non existing feature and then installing it with sonic-package-manager it won't start.

E.g:

admin@sonic:~$ redis-cli -n 4 hmset 'FEATURE|non-existing' state enabled OK
admin@sonic:~$ sudo zless /var/log/syslog | grep featured 2025 Mar 26 15:19:33.237090 sonic INFO featured: Feature non-existing is enabled and started
With this patch an error is recordded and feature state is not cached:

2025 Mar 26 15:35:32.794640 sonic INFO featured: Running cmd: '['sudo', 'systemctl', 'unmask', 'non-existing.service']'
2025 Mar 26 15:35:33.233685 sonic INFO featured: Output:  , Stderr: Unit non-existing.service does not exist, proceeding anyway.
2025 Mar 26 15:35:33.233743 sonic INFO featured: Running cmd: '['sudo', 'systemctl', 'enable', 'non-existing.service']'
2025 Mar 26 15:35:33.247238 sonic ERR featured: ['sudo', 'systemctl', 'enable', 'non-existing.service'] - failed: return code - 1, output:
2025 Mar 26 15:35:33.247300 sonic ERR featured: Feature 'non-existing.service' failed to be enabled and started
2025 Mar 26 15:35:39.331762 sonic INFO featured: Running cmd: '['sudo', 'systemctl', 'unmask', 'non-existing.service']'
2025 Mar 26 15:35:39.780474 sonic INFO featured: Output:  , Stderr: Unit non-existing.service does not exist, proceeding anyway.
2025 Mar 26 15:35:39.780513 sonic INFO featured: Running cmd: '['sudo', 'systemctl', 'enable', 'non-existing.service']'
2025 Mar 26 15:35:39.795113 sonic ERR featured: ['sudo', 'systemctl', 'enable', 'non-existing.service'] - failed: return code - 1, output:
2025 Mar 26 15:35:39.795153 sonic ERR featured: Feature 'non-existing.service' failed to be enabled and started
Feature will start next time when setting state field in FEATURE table
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.

6 participants