Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

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

Problem

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.

Solution

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.

Note

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 of the /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:

  1. Power on the switch. The loader script starts.
  2. After the message Loading /boot/defaults/loader.conf appears, 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.

    Note

    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.

  3. Enter the following command:
    loader> install [– –format] [– –external] source

    where:

    • 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, tftp://192.0.2.0/junos/jinstall-qfx-5e-flex-15.1X53-D30.5-domestic-signed.tgz

      • Junos OS package on a USB device (commonly stored in the root drive as the only file), for example, file:///jinstall-qfx-5e-flex-15.1X53-D30.5-domestic-signed.tgz).

    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:

  • dev/gpt/junos (/junos for short) volume that is used to run Junos OS and to store the configuration and log files

  • dev/gpt/oam (/oam for 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 of the /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 /oam volume 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.

Note

You need console access to perform the following procedure to recover Junos OS.

To recover Junos OS by using the recovery snapshot stored in the /oam volume:

  1. Power off the device, such as a router or a switch, by pressing the power button on the front panel.
  2. Connect and configure the management device, such as a PC or a laptop, as follows:
    1. Turn off the power to the management device.
    2. 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.
    3. Plug the RJ-45–to–DB-9 serial port adapter into the serial port on the management device.
    4. Connect the other end of the Ethernet rollover cable to the console port on the device.
    5. Turn on the power to the management device.
    6. 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).
    7. Configure the port settings as follows:
      • Bits per second: 9600

      • Data bits: 8

      • Parity: None

      • Stop bits: 1

      • Flow control: None

  3. Power on the device by pressing the power button on the front panel.

    Verify that the POWER LED on the front panel turns green.

    The terminal emulation screen on your management device displays the boot sequence of the device.

  4. 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 /junos volume. Press any key within the 3-second window to stop the automatic boot sequence and display the Junos Main Menu.

      Note

      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.

  5. At the Choice: prompt in Junos Main Menu, enter B or 4 to choose 4. [B]oot menu :
  6. 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.
  7. Log in to the device and verify that the software is properly restored.