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:
- Boot VyOS for the first time (after installation or from VM image).
- After full boot, reset the VM.
- Wait for the boot and log in.
- Check the CLI.
- 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.