Page MenuHomeVyOS Platform

CLI does not work after cutting off the power or reset
Closed, ResolvedPublicBUG

Description

If after the very first login to a new user or after the first boot cut off power (power off VM, reset), the CLI for the user will be broken.


Steps to reproduce:
  1. Boot VyOS for the first time (after installation or from VM image).
  2. After full boot, reset the VM.
  3. Wait for the boot and log in.
  4. Check the CLI.
  5. VyOS-specific commands will not work.
vyos@vyos:~$ show 
showconsolefont  showkey          
vyos@vyos:~$ show interfaces

  Invalid command: [show]

vyos@vyos:~$

Reason

Account settings files are not saved to the permanent filesystem and are empty after the boot:

vyos@vyos:~$ ls -la 
total 12
drwxr-xr-x 3 vyos users 4096 Feb  2 09:37 .
drwxr-xr-x 1 root root  4096 Feb  2 09:37 ..
-rw-r--r-- 1 vyos users    0 Mar 27  2022 .bash_logout
-rw-r--r-- 1 vyos users    0 Nov 21 03:18 .bashrc
-rw-r--r-- 1 vyos users    0 Nov 21 03:18 .profile
drwxr-xr-x 2 vyos users 4096 Feb  2 09:37 .ssh

This happens because the filesystem cache is not written to the storage before the system/VM reset.


Possible Solution

After a configuration is applied, we need to call sync(), to write everything to the permanent storage. This should protect from data loss after resetting or powering off.

Details

Difficulty level
Easy (less than an hour)
Version
1.3.2, 1.4-rolling-202302010317
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)

Event Timeline

zsdc changed the task status from Open to In progress.Feb 2 2023, 9:50 AM
zsdc claimed this task.
zsdc created this task.
zsdc moved this task from Need Triage to In Progress on the VyOS 1.4 Sagitta board.

PR for 1.3 which makes the change available for every config subsystem https://github.com/vyos/vyos-1x/pull/1798

c-po moved this task from Need Triage to 1.3.3 on the VyOS 1.3 Equuleus board.
c-po edited projects, added VyOS 1.3 Equuleus (1.3.3); removed VyOS 1.3 Equuleus.
c-po moved this task from Need Triage to Finished on the VyOS 1.3 Equuleus (1.3.3) board.