TNSR Operating System Account Recovery / Password Reset

Certain situations may require recovering access to an operating system account without reinstalling TNSR. For example, if no accessible account on the installation has administrative access. Passwords can be reset from the system console (video or serial) to regain access.

Tip

If any user has administrator access via sudo, they can reset an account password via the shell without following these instructions.

Check Boot Order

Some devices may not be set to boot TNSR as the first priority, which can make this process more difficult. So before making any other changes, ensure TNSR is set to be the first boot option.

Note

The exact procedure varies widely by hardware, and not all hardware has such options. If the device boots TNSR during a regular boot, in many cases these steps can be skipped.

  • Connect to the console

  • Boot the device

  • Enter the system BIOS

    Note

    The key for this action varies by hardware and is typically displayed during the boot process. Common keys to enter the BIOS are Del or Esc.

  • Navigate to Boot options

  • Ensure TNSR (Ubuntu) is listed as the first option

  • Save changes and exit

Display Grub Menu

Reaching recovery mode requires using the Grub menu. This varies by console type.

Installations with a serial console typically hide the Grub menu and require pressing a key combination to display the menu.

To show the Grub menu on installations where it is hidden:

  • Boot the device

  • Wait for the BIOS to start booting the OS

  • Press Esc or Shift-Esc to display the Grub menu

    Warning

    The timing can be difficult as it must be after the BIOS hand-off but before Grub begins booting TNSR.

    Note

    • Only press this once as pressing it repeatedly will drop to a grub> prompt.

    • To return to the menu from the grub> prompt, enter the exit command and grub will restart, then press Esc at the proper moment to show the menu.

    • If all else fails, reboot the device and try again.

../_images/recover-acct-grub-menu.png

Grub Menu

Boot Recovery Mode

Starting recovery mode varies slightly by console type.

  • Highlight Advanced options for Ubuntu on the Grub menu

  • Press Enter to display the Advanced options menu

  • Highlight the option for Recovery Mode under the default entry (typically the most recent/highest numbered kernel)

../_images/recover-acct-grub-menu-advanced.png

Advanced Grub Menu

Choose the tab for the appropriate console type and follow the remaining steps:

Serial consoles require adding the console to the kernel boot command line:

  • Press e to edit the boot configuration

  • Navigate to the end of the line which starts with linux and also mentions recovery

  • Add the console to the end of the command line, for example: console=ttyS0,115200n8

    ../_images/recover-acct-grub-boot-command.png

    Grub Linux kernel command line with the console parameter

    Note

    • The actual console varies by hardware. For example, most use ttyS0 but some like the Netgate 4200 use ttyS4.

    • Make sure there is a space before the console= keyword.

  • Press Ctrl-X to boot using this command

Reset the Password

Now use the recovery menu to start a root shell and reset the account password.

../_images/recover-acct-recovery-menu.png

Recovery Menu

From the recovery mode menu:

  • Highlight the Drop to root shell prompt option

    Tip

    If the menu is not legible, press Ctrl-L to redraw the screen.

  • Press Enter

  • Press Ctrl-D to continue when prompted

    Warning

    If this action prompts for a password and will not continue, then someone set a password for the root account which is non-standard. That requires a different method to recover not within the scope of this document.

  • Type passwd <user> where <user> is the username to reset, such as tnsr

  • Press Enter

  • Enter and confirm the new password

  • Type exit and press Enter to return to the recovery menu

  • Highlight Resume Normal Boot

  • Press Enter

TNSR will reboot normally from this point and the new password will work for the recovered account.