Description

This article details the procedure for recovering the root password for Juniper Networks EX/QFX/ACX Series switches.

 

Symptoms

If you forget the root password, use the password recovery procedure to reset the root password.

 

Solution

EX Series: Refer to Troubleshooting Loss of the Root Password.

QFX Series: You will see that the switch boots from Juniper Linux. Although the system gives you the option to navigate through other options, you should just allow it to display the following output on console

  Booting `Juniper Linux'

Loading Linux ...
error: no suitable video mode found.
Booting in blind mode
i8042: No controller found
First Level Bootstrap using initramfs...
Mounting boot device LABEL=LINUX-BOOT
Unpacking initrd.cpio.gz ....
1062416 blocks
Unmount boot device LABEL=LINUX-BOOT
Starting init
INIT: Mounting VAR to /var
Starting udev
sysvinit-2.88dsf-r500.0.core2_64
running pre rc steps on QFX5_5120
Changing boot device enable from  0xEF to 0xEF
  1 logical volume(s) in volume group "vg0_vjunos" now active
Starting udev...


After that, you will see the following screen on console very briefly (about 3 seconds). You should press "Ctrl + C" keys multiple times until you see the main menu.

Wind River Linux 7.0.0.9 localhost console

INIT: ost login:


Continue with step 3.

Exceptions: For the following products, the root password recovery procedure is different from other switch products:

  • EX2300
  • EX3400
  • EX4100
  • EX4400
  • EX9200 which is running with 15.1 and later
  • QFX5200 which is running with 15.1X53-D30 and later
  • QFX10000 which is running with 15.1X53-D60 and later
 

The difference is due to the upgraded FreeBSD. Refer to Understanding Junos OS with Upgraded FreeBSD for more information.

For the product exceptions in the above list, take the following steps:

  1. Ensure that you have console access to the switch.

  2. Reboot the switch and do the following depending on which Junos version the switch is running,

    1. Prior 17.3: Press any key when you see 'Main Menu' to avoid loading Junos.
    2. For the EX4400, do a physical reboot first, once presented with the Boot Menu, select Continue and then press Ctrl+c to go into the Main Menu in step 3.
    3. 17.3 and Onwards: Press Ctrl+c when you see the following:

FreeBSD/x86 bootstrap loader, Revision 1.1

([email protected], Sun Feb  4 13:06:24 PST 2018)
/
Autoboot in 1 seconds... (press Ctrl-C to interrupt)
  1. After successfully entering Main Menu, the following will be shown:

Choice:
Main Menu

1. Boot [J]unos volume
2. Boot Junos volume in [S]afe mode

3. [R]eboot

4. [B]oot menu
5. [M]ore options 
  1. Press either "M" or "5" for "[M]ore options" to see the Options Menu as follows:

Choice:
Options Menu

1. Recover [J]unos volume
2. Recovery mode - [C]LI
3. Check [F]ile system

4. [B]oot prompt

5. [M]ain menu
  1. In this menu, press either "C" or "2" to choose "Recovery mode - [C]LI". Then Junos OS will be loaded with recovery mode.

Choice:
Booting Junos in CLI recovery mode ...

~snip~

NOTE: Once in the CLI, you will need to enter configuration mode using
NOTE: the 'configure' command to make any required changes. For example,
NOTE: to reset the root password, type:
NOTE: configure
NOTE: set system root-authentication plain-text-password
NOTE: (enter the new password when asked)
NOTE: commit
NOTE: exit
NOTE: exit
NOTE: When you exit the CLI, you will be in a shell.
Starting CLI ...

warning: This chassis is operating in a non-master role as part of a virtual-chassis (VC) system.
warning: Use of interactive commands should be limited to debugging and VC Port operations.
warning: Full CLI access is provided by the Virtual Chassis Master (VC-M) chassis.
warning: The VC-M can be identified through the show virtual-chassis status command executed at this console.
warning: Please logout and log into the VC-M to use CLI.

{linecard:0}
root>
  1. Set the root password as guided below:

{linecard:0}
root> configure
Entering configuration mode
The configuration has been changed but not committed

{linecard:0}[edit]
root# set system root-authentication plain-text-password
New password:
Retype new password:

{linecard:0}[edit]
root# commit
2017-02-01 18:09:37 UTC: Running FIPS Self-tests
veriexec: no signatures for device. file='/sbin/kats/cannot-exec' fsid=167 fileid=51404 gen=1 uid=0 pid=3262
2017-02-01 18:09:38 UTC: FIPS Self-tests Passed
commit complete
  1. After saving the configuration, exit from CLI so that the system is rebooted again with the saved password.

{linecard:0}
root> exit

NOTE: Type 'exit' to restart the system.
# exit
Waiting (max 60 seconds) for system process `vnlru' to stop...done
Waiting (max 60 seconds) for system process `bufdaemon' to stop...done
Waiting (max 60 seconds) for system process `syncer' to stop...
Syncing disks, vnodes remaining...0 0 0 0 0 done
All buffers synced.
Uptime: 1m17s
usbus0: controller did not stop
Khelp module "jsocket" can't unload until its refcount drops from 1 to 0.
Rebooting...
cpu_reset: Stopping other CPUs
Consoles: serial port
BIOS drive C: is disk0
BIOS drive D: is disk1

~snip~

No core dumps found.
Prefetch chassisd....
Starting jlaunchhelperd.
Wed Feb  1 18:11:24 UTC 2017 platform_fixups: 3719 3732
Wed Feb  1 18:11:24 UTC 2017 platform_fixups: Give sighup to (pid:3719) parse new file ...
/etc/rc: WARNING: run_rc_command: cannot run
Starting cron.

Wed Feb  1 18:11:24 UTC 2017

FreeBSD/amd64 (Amnesiac) (ttyu0)

login: Feb  1 18:11:24 jlaunchd: exec_command: /usr/sbin/eventd (PID 3761) started
Feb  1 18:11:24 jlaunchd: event-processing (PID 3761) started
Feb  1 18:11:24 jlaunchd: exec_command: /usr/sbin/sdk-mgmtd (PID 3762) started
Feb  1 18:11:24 jlaunchd: app-engine-management-service (PID 3762) started
Feb  1 18:11:24 jlaunchd: exec_command: /usr/sbin/sdk-vmmd (PID 3763) started
Feb  1 18:11:24 jlaunchd: app-engine-virtual-machine-management-service (PID 3763) started
Feb  1 18:11:24 jlaunchd: exec_command: /usr/sbin/vccpd (PID 3764) started
Feb  1 18:11:24 jlaunchd: virtual-chassis-control (PID 3764) started
Feb  1 18:11:24 jlaunchd: can not access /usr/sbin/chassism: No such file or directory
Feb  1 18:11:25 jlaunchd: chassis-manager (PID 0) started


FreeBSD/amd64 (Amnesiac) (ttyu0)

login: root
Password:
Last login: Wed Feb  1 15:40:16 on ttyu0
  1. Check if you can log in to the system with the new password.

 

Modification History

2023-03-20: Added step B for EX4400 to access the Main Menu. Refreshed links. 
2020-04-02: Additions made to step 2 in Solution section

2019-07-19: A few additional details added to Steps 4 and 5 in the Solution section; other minor, non-technical edits made
2023-10-12: Added the step on how to get to the main menu on QFX Series switches such as QFX5100, QFX5110 and QFX5120.
2023-11-03: Added EX4100 to the exception list as per validated in lab.
2024-09-25: Added EX4400 to the exception list.