Dell Networking SONiC Password Recovery

Summary: This article explains how to reset or recover your password in Dell Networking SONiC.

This article applies to This article does not apply to This article is not tied to any specific product. Not all product versions are identified in this article.

Instructions

 
NOTE: This procedure requires a reboot of the switch. Schedule necessary downtime, if applicable. Any unsaved changes are lost on a reboot.

You can recover your admin password from GRUB. You can use this procedure if you forget or lose the admin password on Dell Networking SONiC.
  1. Connect to the switch using Serial or USB console port.
  2. Reboot or Power ON the switch. You can do a hard reboot. 
  3. Wait for the GRUB menu to appear.
                             GNU GRUB  version 2.02
 +----------------------------------------------------------------------------+                                                                                                             
 |*SONiC-OS-4.0.5-Enterprise_Base                                             |
 | ONIE                                                                       |                                                                                                             
 |                                                                            |                                                                                                                                                                                           
 |                                                                            |                                                                                                                                                                                          
 +----------------------------------------------------------------------------+
      Use the ^ and v keys to select which entry is highlighted.
      Press enter to boot the selected OS, `e' to edit the commands
      before booting or `c' for a command-line.
  1. Select the SONiC version from GRUB menu and Press e to open the GRUB editor.
                             GNU GRUB  version 2.02
 /----------------------------------------------------------------------------\
 |setparams 'SONiC-OS-4.0.5-Enterprise_Base'                                  |
 |                                                                            |
 |        search --no-floppy --label --set=root SONiC-OS                      |
 |        echo    'Loading SONiC-OS OS kernel ...'                            |
 |        insmod gzio                                                         |
 |        if [ x = xxen ]; then insmod xzio; insmod lzopio; fi                |
 |        insmod part_msdos                                                   |
 |        insmod ext2                                                         |
 |        linux   /image-4.0.5-Enterprise_Base/boot/vmlinuz-4.19.0-9-2-amd64 \|
 |root=UUID=1ef6ad59-xxxx-xxxx-xxxx-68fe15d8a089  rw console=tty0 console=tty\|
 |S0,115200n8 quiet intel_idle.max_cstate=0                  net.ifnames=0 bi\|
 |osdevname=0                 loop=image-4.0.5-Enterprise_Base/fs.squashfs lo\|v
 |opfstype=squashfs                                       crashkernel=0M-2G:2\|v
 \----------------------------------------------------------------------------/
      Minimum Emacs-like screen editing is supported. TAB lists
      completions. Press Ctrl-x or F10 to boot, Ctrl-c or F2 for a
      command-line or ESC to discard edits and return to the GRUB menu.
  1. Use the arrow keys to go to the line which is starting with "linux    /image---." The line is indicated in the below sample output.
                                      GNU GRUB  version 2.02
 /----------------------------------------------------------------------------\
 |setparams 'SONiC-OS-4.0.5-Enterprise_Base'                                  |
 |                                                                            |
 |        search --no-floppy --label --set=root SONiC-OS                      |
 |        echo    'Loading SONiC-OS OS kernel ...'                            |
 |        insmod gzio                                                         |
 |        if [ x = xxen ]; then insmod xzio; insmod lzopio; fi                |
 |        insmod part_msdos                                                   |
 |        insmod ext2                                                         |
 |        linux   /image-4.0.5-Enterprise_Base/boot/vmlinuz-4.19.0-9-2-amd64 \|
 |root=UUID=1ef6ad59-xxxx-xxxx-xxxx-68fe15d8a089  rw console=tty0 console=tty\|
 |S0,115200n8 quiet intel_idle.max_cstate=0                  net.ifnames=0 bi\|
 |osdevname=0                 loop=image-4.0.5-Enterprise_Base/fs.squashfs lo\|v
 |opfstype=squashfs                                       crashkernel=0M-2G:2\|v
 \----------------------------------------------------------------------------/
      Minimum Emacs-like screen editing is supported. TAB lists
      completions. Press Ctrl-x or F10 to boot, Ctrl-c or F2 for a
      command-line or ESC to discard edits and return to the GRUB menu.
 
If the arrow keys do not work in GRUB editor, you can use the below keys to go to the line.
UP: CTRL+p
DOWN: CTRL+n
LEFT: CTRL+b
RIGHT: CTRL+f
 
  1. Type the following line between r/w and console=tty0.
init=/bin/bash
A sample output is shown below (no colors are seen in the actual output):
                             GNU GRUB  version 2.02
 /----------------------------------------------------------------------------\
 |setparams 'SONiC-OS-4.0.5-Enterprise_Base'                                  |
 |                                                                            |
 |        search --no-floppy --label --set=root SONiC-OS                      |
 |        echo    'Loading SONiC-OS OS kernel ...'                            |
 |        insmod gzio                                                         |
 |        if [ x = xxen ]; then insmod xzio; insmod lzopio; fi                |
 |        insmod part_msdos                                                   |
 |        insmod ext2                                                         |
 |        linux   /image-4.0.5-Enterprise_Base/boot/vmlinuz-4.19.0-9-2-amd64 \|
 |root=UUID=aaa4e106-1eed-xxxx-xxxx-1d7bb8cdb93c  rw init=/bin/bash console=t\|
 |ty0 console=ttyS0,115200n8 quiet intel_idle.max_cstate=0                  n\|
 |et.ifnames=0 biosdevname=0                 loop=image-4.0.5-Enterprise_Base\|v
 |/fs.squashfs loopfstype=squashfs                                       cras\|v
 \----------------------------------------------------------------------------/
      Minimum Emacs-like screen editing is supported. TAB lists
      completions. Press Ctrl-x or F10 to boot, Ctrl-c or F2 for a
      command-line or ESC to discard edits and return to the GRUB menu.
If you want to discard any changes that were made, press ESC. This action returns you to the GRUB menu without saving changes.
 
NOTE: This insertion does not survive a reboot. You do not have to edit GRUB once the password is recovered. 
 
  1. Press F10 or Ctrl+x to boot.
Sample boot sequence
Booting a command listBooting a command list
Loading SONiC-OS OS kernel ...Loading SONiC-OS OS kernel ...
Loading SONiC-OS OS initial ramdisk ...Loading SONiC-OS OS initial ramdisk ...
AF,
DXE_EXIT_BOOT_SERVICES(03101019)
B, B, bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
root@(none):/#
  1. You can modify the password by using the following Linux command. In the below example, we are modifying the user account admin: 
passwd <username>

root@(none):/# passwd admin
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
  1. Reboot the switch with the following command:  
root@(none):/# echo "b" > /proc/sysrq-trigger
Or
root@(none):/# reboot -f

After the switch has rebooted, you can log in to the switch with the new credentials.

Affected Products

Enterprise SONiC Distribution, PowerSwitch E3200-ON Series, Dell EMC Networking N3200-ON, PowerSwitch S5212F-ON, PowerSwitch S5224F-ON, PowerSwitch S5232F-ON, PowerSwitch S5248F-ON, PowerSwitch S5296F-ON, PowerSwitch Z9264F-ON, PowerSwitch Z9332F-ON , PowerSwitch Z9432F-ON ...
Article Properties
Article Number: 000212939
Article Type: How To
Last Modified: 13 Dec 2023
Version:  2
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.