Recovery of Junos OS
In case of failed software installation or failure after installing Junos OS such as CLI not working, you can recover the failed software. You can recover the software by installing Junos OS and remove the existing Junos OS image to install a new image.
Recovering from a Failed Software Installation
Description: If the Junos OS appears to have been installed but the CLI does not work, or if the switch has no software installed, you can use this recovery installation procedure to install the Junos OS.
If a Junos OS image already exists on the switch, you can either install the new Junos OS package in a separate partition, in which case both Junos OS images remain on the switch, or you can remove the existing Junos OS image before you start the new installation process.
QFX5100, QFX5200, EX4600, QFX10000, and OCX Series switches do not have a separate partition to reinstall a Junos OS image.
A recovery image is created automatically on these switches. If a previously-running switch is powered on and unable to boot using a Junos OS image, you can boot the switch using the recovery Junos OS image by selecting an option in the “Select a recovery image” menu.
We suggest creating a system snapshot on your switch onto the
external USB flash drive, and using the snapshot for recovery purposes.
The system snapshot feature takes a “snapshot” of the
files currently used to run the device—the complete contents
/config directories, which
include the running Juniper Networks Junos OS, the active configuration,
and the rescue configuration, as well as the host OS—and copies
all of these files into an external USB flash drive. See Creating a Snapshot and Using It to Boot a QFX3500 and QFX3600 Series Switch or Creating a Snapshot and Using It to Boot a QFX Series Switch.
System snapshot is not supported on QFX5200 and QFX10000 switches.
To perform a recovery installation:
- Power on the switch. The loader script starts.
- After the message
Loading /boot/defaults/loader.confappears, you are prompted with the following message:
Hit [Enter] to boot immediately, or space bar for command prompt.
Press the Spacebar to enter the manual loader. The loader> prompt appears.
The loader prompt does not appear on QFX5100, QFX5200, EX4600, QFX10000, and OCX Series switches.
On QFX5100, QFX5200, EX4600, QFX10000, and OCX Series switches only, a recovery image is automatically saved if a previously-running switch is powered on and unable to boot using a Junos OS image.
The “Select a recovery image” menu appears on the console when one of these switches is booted and unable to load a version of Junos OS. Follow the instructions in the “Select a recovery image” menu to load the recovery version of Junos OS for one of these switches.
You can ignore the remainder of this procedure if you are using a QFX5100, QFX5200, EX4600, QFX10000, or OCX Series switch.
- Enter the following command:
loader> install [– –format] [– –external] source
format—Enables you to erase the installation media before installing the installation package. If you do not include this option, the system installs the new Junos OS in a different partition from that of the most recently installed Junos OS.
external—Installs the installation package onto external media (a USB stick, for example).
source—Represents the name and location of the Junos OS package, either on a server on the network or as a file on an external media, as shown in the following two examples:
Network address of the server and the path on the server; for example,
Junos OS package on a USB device (commonly stored in the root drive as the only file), for example,
The installation now proceeds normally and ends with a login prompt.
Recovering Junos OS on a Device Running Junos OS with Upgraded FreeBSD
Juniper Networks devices that run Junos OS with upgraded FreeBSD have two separate volumes:
/junosfor short) volume that is used to run Junos OS and to store the configuration and log files
/oamfor short), an Operations, Administration, and Maintenance (OAM) volume that is used to store a complete backup of Junos OS and the configuration.
In case of damage to the device’s software or failure
/junos volume, you can use
the backed up software and configuration stored in the
/oam volume to boot the system and restore Junos
OS with the recovery configuration. To perform this reboot and restore
the configuration, the
must have all of the information required to provide the system with
a running configuration. This information is provided by the recovery
snapshot, created using the request system snapshot recovery command.
You need console access to perform the following procedure to recover Junos OS.
To recover Junos OS by using the recovery snapshot stored
- Power off the device, such as a router or a switch, by pressing the power button on the front panel.
- Connect and configure the management device, such as a
PC or a laptop, as follows:
- Turn off the power to the management device.
- Plug one end of the Ethernet rollover cable supplied with the device into the RJ-45–to–DB-9 serial port adapter supplied with the device.
- Plug the RJ-45–to–DB-9 serial port adapter into the serial port on the management device.
- Connect the other end of the Ethernet rollover cable to the console port on the device.
- Turn on the power to the management device.
- On the management device, start your asynchronous terminal emulation application (such as Microsoft Windows Hyperterminal) and select the appropriate communication (COM) port to use (for example, COM1).
- Configure the port settings as follows:
Bits per second: 9600
Data bits: 8
Stop bits: 1
Flow control: None
- Power on the device by pressing the power button on the
Verify that the
POWERLED on the front panel turns green.
The terminal emulation screen on your management device displays the boot sequence of the device.
- Access the Junos Main Menu.
In released before Junos OS Release 17.3, the Junos Main Menu appears for 3 seconds on startup before automatically booting the
/junosvolume. Press any key within the 3-second window to stop the automatic boot sequence and display the Junos Main Menu.
The Junos Main Menu will appear every time you reboot the router while connected to the console.
Starting in Junos OS Release 17.3, press Ctrl+c within the 3-second window to stop the automatic boot sequence and display the Junos Main Menu.
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 Choice:
- At the Choice: prompt in Junos Main Menu, enter B or 4 to choose 4.
[B]oot menu :
Boot Menu 1. Boot [P]revious installed Junos packages 2. Boot Junos in [S]ingle user mode 3. Boot from [R]ecovery snapshot 4. Boot from [U]SB 5. Boot to [O]AM shell 6. Snapshot [B]oot menu 7. [M]ain menu Choice:
- At the Choice: prompt in Boot Menu, enter R or 3 to choose the 3. Boot from [R]ecovery snapshot option. The device reboots
into recovery mode. The following sample output shows the messages
displayed on the terminal when you recover Junos OS on an EX2300 switch.
Booting from recovery snapshot ... - /boot/junos/boot/os-kernel/kernel data=0xe8c000 syms=[0x4+0x6b020+0x4+0x72cfe] /boot/junos/boot/os-kernel/ex2300-48mp.dtb size=0x18b8 /boot/junos/boot/os-kernel/ex2300.dtb size=0x1e67 /boot/junos/boot/junos-modules/fips_core.ko text=0x13bc data=0x275+0x7 syms=[0x4+0x7a0+0x4+0x518] loading required module 'netstack' /boot/junos/boot/netstack/netstack.ko text=0x910a3c data=0x3ae2f+0x10dded syms=[0x4+0xf0570+0x4+0xdc394] loading required module 'crypto' [...Output truncated...] /var/pdb/profile_db initialized Profile database initialized realpath: /dev/dumpdev: No such file or directory /etc/rc: WARNING: Dump device does not exist. Savecore not run. Prefetching /usr/sbin/rpd ... Prefetching /usr/sbin/lacpd ... Prefetching /usr/sbin/chassisd ... mkdir: /packages/sets/active: Read-only file system Starting jlaunchhelperd. sysctl: unknown oid 'kern.rtc_retries' Starting cron. Fri Jun 22 01:25:20 PDT 2018 FreeBSD/arm (device-name) (ttyu0) login:
- Log in to the device and verify that the software is properly
[...Output truncated...] login: root --- JUNOS 18.1-20180125.0 built 2018-01-25 20:34:55 UTC root@:RE:0%