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

command sudo config reload --load-sysinfo/-l fails #7433

Closed
slutati1536 opened this issue Apr 26, 2021 · 6 comments · Fixed by sonic-net/sonic-utilities#1611
Closed

command sudo config reload --load-sysinfo/-l fails #7433

slutati1536 opened this issue Apr 26, 2021 · 6 comments · Fixed by sonic-net/sonic-utilities#1611
Assignees

Comments

@slutati1536
Copy link
Contributor

Description

command " sudo config reload" has the option to load system default information,
but when running the command with this option the following trackback is printed and the switch is stuck afterward.

admin@r-lionfish-14:~$ sudo config reload -h
Usage: config reload [OPTIONS] [FILENAME]

  Clear current configuration and import a previous saved config DB dump
  file. <filename> : Names of configuration file(s) to load, separated by
  comma with no spaces in between

Options:
  -y, --yes
  -l, --load-sysinfo        load system default information (mac, portmap etc)
                            first.
  -n, --no_service_restart  Do not restart docker services
  -d, --disable_arp_cache   Do not cache ARP table before reloading (applies
                            to dual ToR systems only)
  -?, -h, --help            Show this message and exit.
admin@r-lionfish-14:~$ sudo config reload -l
Clear current config and reload config from the default config file(s) ? [y/N]: y
Traceback (most recent call last):
  File "/usr/local/bin/sonic-cfggen", line 431, in <module>
    main()
  File "/usr/local/bin/sonic-cfggen", line 326, in main
    _process_json(args, data)
  File "/usr/local/bin/sonic-cfggen", line 236, in _process_json
    with open(json_file, 'r') as stream:
FileNotFoundError: [Errno 2] No such file or directory: 'None'
Stopping SONiC target ...
Running command: /usr/local/bin/sonic-cfggen -H -k  --write-to-db
usage: sonic-cfggen [-h] [-m [MINIGRAPH] | -M DEVICE_DESCRIPTION | -k HWSKU] [-n [NAMESPACE]] [-p [PORT_CONFIG]]
                    [-S [HWSKU_CONFIG]] [-y YAML] [-j JSON] [-a ADDITIONAL_DATA] [-d] [-H] [-s REDIS_UNIX_SOCK_FILE]
                    [-t TEMPLATE] [-T TEMPLATE_DIR] [-v VAR] [--var-json VAR_JSON] [--preset {t1,l2,empty}]
                    [--print-data | -w | -K KEY]
sonic-cfggen: error: argument -k/--hwsku: expected one argument
admin@r-lionfish-14:~$

Steps to reproduce the issue:

  1. sudo config reload -l

Describe the results you received:

traceback prints in the command output


sudo config reload -l
Clear current config and reload config from the default config file(s) ? [y/N]: y
Traceback (most recent call last):
  File "/usr/local/bin/sonic-cfggen", line 433, in <module>
    main()
  File "/usr/local/bin/sonic-cfggen", line 328, in main
    _process_json(args, data)
  File "/usr/local/bin/sonic-cfggen", line 236, in _process_json
    with open(json_file, 'r') as stream:
FileNotFoundError: [Errno 2] No such file or directory: 'None'
Disabling container monitoring ...
Stopping SONiC target ...
Running command: /usr/local/bin/sonic-cfggen -H -k  --write-to-db
usage: sonic-cfggen [-h] [-m [MINIGRAPH] | -M DEVICE_DESCRIPTION | -k HWSKU]
                    [-n [NAMESPACE]] [-p [PORT_CONFIG]] [-S [HWSKU_CONFIG]]
                    [-y YAML] [-j JSON] [-a ADDITIONAL_DATA] [-d] [-H]
                    [-s REDIS_UNIX_SOCK_FILE] [-t TEMPLATE] [-T TEMPLATE_DIR]
                    [-v VAR] [--var-json VAR_JSON] [--preset {t1,l2,empty}]
                    [--print-data | -w | -K KEY]
sonic-cfggen: error: argument -k/--hwsku: expected one argument

there is no option to pass the hwsku parameter when running the config reload with -l.

admin@r-lionfish-14:~$ sudo config reload -l -k ACS-MSN3420
Usage: config reload [OPTIONS] [FILENAME]
Try "config reload -h" for help.

Error: no such option: -k

Describe the results you expected:

the command should execute: "/usr/local/bin/sonic-cfggen -H -k --write-to-db" successfully and apply reload.

Output of show version:

show boot
Current: SONiC-OS-202012.72-193c376f_Internal
Next: SONiC-OS-202012.72-193c376f_Internal
Available: 
SONiC-OS-202012.72-193c376f_Internal

Output of show techsupport:

no techsupport as switch become stuck after the command is excuted

Additional information you deem important (e.g. issue happens only occasionally):

@zhenggen-xu
Copy link
Collaborator

Can you share the configdb.json? do you have below in it?

    "DEVICE_METADATA": {
        "localhost": {
            "hwsku": "ACS-MSN3420"
        }
    }

@anshuv-mfst
Copy link

@zhenggen-xu , @praveen-li - could you please take a look, thanks.

@slutati1536
Copy link
Contributor Author

@zhenggen-xu we do have it in the config_db:
},
"DEVICE_METADATA": {
"localhost": {
"default_bgp_status": "up",
"default_pfcwd_status": "disable",
"hwsku": "ACS-MSN3420",
"type": "ToRRouter",
"mac": "1c:34:da:1c:a0:00",
"platform": "x86_64-mlnx_msn3420-r0",
"hostname": "r-lionfish-14"
}

no option to add this file type

@zhenggen-xu
Copy link
Collaborator

This is not related to DPB changes, the CLI on master is broken. Tried to build master image with some errors:

make[4]: Entering directory '/sonic/src/wpasupplicant/sonic-wpa-supplicant/wpa_supplicant/wpa_gui-qt4'
/usr/lib/qt5/bin/uic wpagui.ui -o .ui/ui_wpagui.h
/usr/lib/qt5/bin/uic eventhistory.ui -o .ui/ui_eventhistory.h
/usr/lib/qt5/bin/uic: error while loading shared libraries: libQt5Core.so.5: cannot open shared object file: No such file or directory
make[4]: *** [Makefile:491: .ui/ui_wpagui.h] Error 127
make[4]: *** Waiting for unfinished jobs....
/usr/lib/qt5/bin/uic: error while loading shared libraries: libQt5Core.so.5: cannot open shared object file: No such file or directory
make[4]: *** [Makefile:495: .ui/ui_eventhistory.h] Error 127
make[4]: Leaving directory '/sonic/src/wpasupplicant/sonic-wpa-supplicant/wpa_supplicant/wpa_gui-qt4'
dh_auto_build: cd wpa_supplicant/wpa_gui-qt4 && make -j8 returned exit code 2
make[3]: *** [debian/rules:48: override_dh_auto_build] Error 2
make[3]: Leaving directory '/sonic/src/wpasupplicant/sonic-wpa-supplicant'
make[2]: *** [debian/rules:114: binary] Error 2

@samaity
Copy link
Collaborator

samaity commented May 12, 2021

I guess the problem is here in sonic-utilities repo. If user does not provide filename with config reload -l, command = "{} -j {} -v DEVICE_METADATA.localhost.hwsku".format(SONIC_CFGGEN_PATH, filename) will not provide cfg_hwsku i.e. hwsku parameter as it should which will later cause problem here command = "{} -H -k {} --write-to-db".format(SONIC_CFGGEN_PATH, cfg_hwsku) as hwsku is not available around that time.

that's why we notice errors like No such file or directory: 'None' as pasted in this issue.

File "/usr/local/bin/sonic-cfggen", line 328, in main
    _process_json(args, data)
  File "/usr/local/bin/sonic-cfggen", line 236, in _process_json
    with open(json_file, 'r') as stream:
FileNotFoundError: [Errno 2] No such file or directory: 'None'

this problem is not related to DPB. however, need a fix in sonic-utilities repo.

@zhenggen-xu
Copy link
Collaborator

Thanks @samaity for the fix. Meanwhile, if @slutati1536 want to continue the test, just do:

/usr/local/bin/sonic-cfggen -H -k ACS-MSN3420 --write-to-db

to get the the table into the configDB.

liat-grozovik pushed a commit to sonic-net/sonic-utilities that referenced this issue Dec 23, 2021
…1611)

Fix sonic-net/sonic-buildimage#7433

Right now config reload -l is getting failed due to an error.
I guess the problem is here in sonic-utilities repo. If user does not provide filename with config reload -l, command = "{} -j {} -v DEVICE_METADATA.localhost.hwsku".format(SONIC_CFGGEN_PATH, filename) will not provide cfg_hwsku i.e. hwsku parameter as it should which will later cause problem here command = "{} -H -k {} --write-to-db".format(SONIC_CFGGEN_PATH, cfg_hwsku) as hwsku is not available around that time.

that's why we notice errors like No such file or directory: 'None' as pasted in this issue.

- How I did it
To Fix the issue, moved the part where the code gets cfg_hwsku command = "{} -j {} -v DEVICE_METADATA.localhost.hwsku".format(SONIC_CFGGEN_PATH, file) to the same location it needed as we get filename by default.

- How to verify it
'sudo config reload -l'
Added test cases.

Signed-off-by: Sangita Maity <samaity@linkedin.com>
judyjoseph pushed a commit to sonic-net/sonic-utilities that referenced this issue Jan 9, 2022
…1611)

Fix sonic-net/sonic-buildimage#7433

Right now config reload -l is getting failed due to an error.
I guess the problem is here in sonic-utilities repo. If user does not provide filename with config reload -l, command = "{} -j {} -v DEVICE_METADATA.localhost.hwsku".format(SONIC_CFGGEN_PATH, filename) will not provide cfg_hwsku i.e. hwsku parameter as it should which will later cause problem here command = "{} -H -k {} --write-to-db".format(SONIC_CFGGEN_PATH, cfg_hwsku) as hwsku is not available around that time.

that's why we notice errors like No such file or directory: 'None' as pasted in this issue.

- How I did it
To Fix the issue, moved the part where the code gets cfg_hwsku command = "{} -j {} -v DEVICE_METADATA.localhost.hwsku".format(SONIC_CFGGEN_PATH, file) to the same location it needed as we get filename by default.

- How to verify it
'sudo config reload -l'
Added test cases.

Signed-off-by: Sangita Maity <samaity@linkedin.com>
praveen-li pushed a commit to praveen-li/sonic-utilities that referenced this issue Feb 8, 2022
…onic-net#1611)

Fix sonic-net/sonic-buildimage#7433

Right now config reload -l is getting failed due to an error.
I guess the problem is here in sonic-utilities repo. If user does not provide filename with config reload -l, command = "{} -j {} -v DEVICE_METADATA.localhost.hwsku".format(SONIC_CFGGEN_PATH, filename) will not provide cfg_hwsku i.e. hwsku parameter as it should which will later cause problem here command = "{} -H -k {} --write-to-db".format(SONIC_CFGGEN_PATH, cfg_hwsku) as hwsku is not available around that time.

that's why we notice errors like No such file or directory: 'None' as pasted in this issue.

- How I did it
To Fix the issue, moved the part where the code gets cfg_hwsku command = "{} -j {} -v DEVICE_METADATA.localhost.hwsku".format(SONIC_CFGGEN_PATH, file) to the same location it needed as we get filename by default.

- How to verify it
'sudo config reload -l'
Added test cases.

Signed-off-by: Sangita Maity <samaity@linkedin.com>
 Conflicts:
	tests/config_test.py
praveen-li pushed a commit to praveen-li/sonic-utilities that referenced this issue Feb 11, 2022
…onic-net#1611)

Fix sonic-net/sonic-buildimage#7433

Right now config reload -l is getting failed due to an error.
I guess the problem is here in sonic-utilities repo. If user does not provide filename with config reload -l, command = "{} -j {} -v DEVICE_METADATA.localhost.hwsku".format(SONIC_CFGGEN_PATH, filename) will not provide cfg_hwsku i.e. hwsku parameter as it should which will later cause problem here command = "{} -H -k {} --write-to-db".format(SONIC_CFGGEN_PATH, cfg_hwsku) as hwsku is not available around that time.

that's why we notice errors like No such file or directory: 'None' as pasted in this issue.

- How I did it
To Fix the issue, moved the part where the code gets cfg_hwsku command = "{} -j {} -v DEVICE_METADATA.localhost.hwsku".format(SONIC_CFGGEN_PATH, file) to the same location it needed as we get filename by default.

- How to verify it
'sudo config reload -l'
Added test cases.

Signed-off-by: Sangita Maity <samaity@linkedin.com>
 Conflicts:
	tests/config_test.py
praveen-li pushed a commit to praveen-li/sonic-utilities that referenced this issue Mar 22, 2022
…onic-net#1611)

Fix sonic-net/sonic-buildimage#7433

Right now config reload -l is getting failed due to an error.
I guess the problem is here in sonic-utilities repo. If user does not provide filename with config reload -l, command = "{} -j {} -v DEVICE_METADATA.localhost.hwsku".format(SONIC_CFGGEN_PATH, filename) will not provide cfg_hwsku i.e. hwsku parameter as it should which will later cause problem here command = "{} -H -k {} --write-to-db".format(SONIC_CFGGEN_PATH, cfg_hwsku) as hwsku is not available around that time.

that's why we notice errors like No such file or directory: 'None' as pasted in this issue.

- How I did it
To Fix the issue, moved the part where the code gets cfg_hwsku command = "{} -j {} -v DEVICE_METADATA.localhost.hwsku".format(SONIC_CFGGEN_PATH, file) to the same location it needed as we get filename by default.

- How to verify it
'sudo config reload -l'
Added test cases.

Signed-off-by: Sangita Maity <samaity@linkedin.com>
 Conflicts:
	tests/config_test.py
malletvapid23 added a commit to malletvapid23/Sonic-Utility that referenced this issue Aug 3, 2023
…1611)

Fix sonic-net/sonic-buildimage#7433

Right now config reload -l is getting failed due to an error.
I guess the problem is here in sonic-utilities repo. If user does not provide filename with config reload -l, command = "{} -j {} -v DEVICE_METADATA.localhost.hwsku".format(SONIC_CFGGEN_PATH, filename) will not provide cfg_hwsku i.e. hwsku parameter as it should which will later cause problem here command = "{} -H -k {} --write-to-db".format(SONIC_CFGGEN_PATH, cfg_hwsku) as hwsku is not available around that time.

that's why we notice errors like No such file or directory: 'None' as pasted in this issue.

- How I did it
To Fix the issue, moved the part where the code gets cfg_hwsku command = "{} -j {} -v DEVICE_METADATA.localhost.hwsku".format(SONIC_CFGGEN_PATH, file) to the same location it needed as we get filename by default.

- How to verify it
'sudo config reload -l'
Added test cases.

Signed-off-by: Sangita Maity <samaity@linkedin.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants