Page MenuHomeVyOS Platform

Improve error handling when/if config.boot is deleted or missing
Closed, ResolvedPublicBUG

Description

I deleted /config/config.boot on purpose but couldnt then reboot or shutdown the VyOS box through cli:

root@vyos:/config# reboot
Traceback (most recent call last):
  File "/usr/libexec/vyos/op_mode/powerctrl.py", line 236, in <module>
    main()
  File "/usr/libexec/vyos/op_mode/powerctrl.py", line 219, in main
    execute_shutdown(args.reboot, reboot=True, ask=args.yes)
  File "/usr/libexec/vyos/op_mode/powerctrl.py", line 120, in execute_shutdown
    check_unsaved_config()
  File "/usr/libexec/vyos/op_mode/powerctrl.py", line 113, in check_unsaved_config
    if unsaved_commits() and boot_configuration_success():
       ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/vyos/config_mgmt.py", line 76, in unsaved_commits
    ret = not cmp(tmp_save, config_file, shallow=False)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/filecmp.py", line 54, in cmp
    s2 = _sig(os.stat(f2))
              ^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/opt/vyatta/etc/config/config.boot'
root@vyos:/config# poweroff
Traceback (most recent call last):
  File "/usr/libexec/vyos/op_mode/powerctrl.py", line 236, in <module>
    main()
  File "/usr/libexec/vyos/op_mode/powerctrl.py", line 227, in main
    execute_shutdown(args.poweroff, reboot=False, ask=args.yes)
  File "/usr/libexec/vyos/op_mode/powerctrl.py", line 120, in execute_shutdown
    check_unsaved_config()
  File "/usr/libexec/vyos/op_mode/powerctrl.py", line 113, in check_unsaved_config
    if unsaved_commits() and boot_configuration_success():
       ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/vyos/config_mgmt.py", line 76, in unsaved_commits
    ret = not cmp(tmp_save, config_file, shallow=False)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/filecmp.py", line 54, in cmp
    s2 = _sig(os.stat(f2))
              ^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/opt/vyatta/etc/config/config.boot'

Suggestion to add errorhandling for this case which should include an option if config should be restored from archive (commit-revisions).

If admin answers "no" then during next boot a config.boot will be recreated from config.boot.default anyway.

Details

Version
VyOS 1.4-rolling-202308260020
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Event Timeline

dmbaturin triaged this task as Normal priority.Jan 11 2024, 12:00 PM
dmbaturin added a project: VyOS 1.5 Circinus.
dmbaturin claimed this task.
syncer renamed this task from Improve errorhandling when/if config.boot is deleted or missing to Improve error handling when/if config.boot is deleted or missing .Jul 26 2024, 7:26 PM