Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reset-factory more robust with exec reboot #16160

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MichaelWangSmci
Copy link

Why I did it

reset-factory dose not flush config_db.json when executed from a console terminal.

Work item tracking
  • Microsoft ADO (number only): None

How I did it

Replace "reboot" with "exec reboot" in the reset-factory script.

How to verify it

Create a VLAN and save the config.
Execute reset-factory from a console terminal.
After reboot check the VLAN should not exist.

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305

Tested branch (Please provide the tested image version)

  • master

Description for the changelog

reset-factory more robust with exec reboot

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@MichaelWangSmci MichaelWangSmci marked this pull request as draft August 15, 2023 23:55
@MichaelWangSmci MichaelWangSmci marked this pull request as ready for review August 15, 2023 23:56
@MichaelWangSmci MichaelWangSmci force-pushed the reset-factory_robust branch 2 times, most recently from b7d1a2a to fa34c76 Compare August 17, 2023 00:08
Signed-off-by: Michael Wang <michaelwang@supermicro.com.tw>
@lguohan
Copy link
Collaborator

lguohan commented Sep 23, 2023

what is the difference between exec reboot and reboot. the explanation is not quite clear.

@MichaelWangSmci
Copy link
Author

what is the difference between exec reboot and reboot. the explanation is not quite clear.

I found that if run "reset-factory" in a console terminal, then after reboot the config_db.json is not reset.
And if replace "reboot" with "exec reboot" in "reset-factory", then config_db.json is reset as expected.
I guess this is because "reset-factory" calls "reboot" which is actually "/usr/local/bin/reboot", and it uses exec to do reboot, makes "reset-factory" lost it's change on config_db.json.
"exec reboot" can trigger config_db.json flushed to disk when the process is replaced with "/usr/local/bin/reboot".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants