Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

header-navigation
keyboard_arrow_up
close
keyboard_arrow_left
list Table of Contents
file_download PDF
{ "lLangCode": "en", "lName": "English", "lCountryCode": "us", "transcode": "en_US" }
English
keyboard_arrow_right

Recovery Using an Emergency Boot Device (Junos OS)

date_range 11-Dec-24

If Junos OS software is damaged on your device, the emergency boot device helps you to recover the software.

Creating an Emergency Boot Device for Routers

If the device’s Junos OS software is damaged in some way that prevents Junos OS software from loading completely, you can use the emergency boot device to revive the device. The emergency boot device repartitions the primary disk and reloads a fresh installation of Junos OS software.

Certain hardware platforms run an upgraded FreeBSD kernel (FreeBSD 10.x or later) instead of FreeBSD 6.1. To determine if your system uses Junos OS with upgraded FreeBSD, see: Junos kernel upgrade to FreeBSD 10+.

The procedures outlined in this section discuss how to create an emergency boot device for any ACX Series or MX Series router.

To create an emergency boot device:

  1. Use FTP to copy the installation media into the router’s /var/tmp directory.
  2. Insert the PC Card into the external PC Card slot or USB storage device into the USB port.
  3. In the UNIX shell, navigate to the /var/tmp directory:
    content_copy zoom_out_map
    start shell
    cd /var/tmp
  4. Log in as su:
    content_copy zoom_out_map
    su [enter]
    password: [enter SU password]
  5. For Junos OS with upgraded FreeBSD only, expand the image, for example:
    content_copy zoom_out_map
    gzip -d installMedia.img.gz

    where installMedia refers to the installation media downloaded into the /var/tmp directory. For example, for Junos OS with upgraded FreeBSD, the filename might be junos-install-media-usb-mx-x86-64-16.1R2.11.img.gz. (To determine if your system uses Junos OS with upgraded FreeBSD, see: Junos kernel upgrade to FreeBSD 10+.)

  6. Issue the following commands:
    • For Junos OS with upgraded FreeBSD:

      content_copy zoom_out_map
      dd if=/dev/zero of=/dev/externalDrive count=20
      dd if=installMedia.img of=/dev/externalDrive bs=256k 
    • For Junos OS:

      content_copy zoom_out_map
      dd if=/dev/zero of=/dev/externalDrive count=20
      dd if=installMedia of=/dev/externalDrive bs=64k

    where:

  7. Log out as su:
    content_copy zoom_out_map
    exit

Creating an Emergency Boot Device for QFX Series Switches

Before you begin, you need to download the installation media image for your device and Junos OS release from https://www.juniper.net/customers/support/ .

If Junos OS on the device is damaged in some way that prevents the software from loading properly, you can use an emergency boot device to repartition the primary disk and load a fresh installation of Junos OS. Use the following procedure to create an emergency boot device.

Note:

You can create the emergency boot device on another Juniper Networks device, or any laptop or desktop PC that supports Linux. The steps you take to create the emergency boot device vary, depending on the device.

To create an emergency boot device:

  1. Use FTP to copy the installation media image into the /var/tmp directory on the device.
  2. Insert a USB storage device into the USB port.
  3. From the CLI, start the shell:
    content_copy zoom_out_map
    user@device> start shell
    % 
  4. Use the gunzip command to unzip the image file.
  5. Switch to the root account using the su command:
    content_copy zoom_out_map
    % su
    Password: password
    Note:

    The password is the root password for the device. If you logged in to the device as the root user, you do not need to perform this step.

  6. Enter the following command on the device:
    content_copy zoom_out_map
    root@device% dd if=/var/tmp/filename of=/dev/da0 bs=1m

    The device writes the installation media image to the USB storage device:

    content_copy zoom_out_map
    root@device% dd if=install-media-qfx-5e-15.1X53-D30.5-domestic.img of=/dev/da0 bs=1m
    1399+0 records in
    1399+0 records out
    1466957824 bytes transferred in 394.081902 secs (3722469 bytes/sec)
    
  7. Log out of the shell:
    content_copy zoom_out_map
    root@device% exit
    % exit
    user@device>

Recovering the Installation Using an Emergency Boot Device on QFX Series Switches

If Junos OS on your device is damaged in some way that prevents the software from loading correctly, you may need to perform a recovery installation using an emergency boot device (for example, a USB flash drive) to restore the default factory installation. Once you have recovered the software, you need to restore the device configuration. You can either create a new configuration as you did when the device was shipped from the factory, or if you saved the previous configuration, you can simply restore that file to the device.

If at all possible, you should try to perform the following steps before you perform the recovery installation:

  1. Ensure that you have an emergency boot device to use during the installation. See Creating an Emergency Boot Device for QFX Series Switches for information on how to create an emergency boot device.

  2. Copy the existing configuration in the file /config/juniper.conf.gz from the device to a remote system, such as a server, or to an emergency boot device. For extra safety, you can also copy the backup configurations (the files named /config/juniper.conf.n, where n is a number from 0 through 9) to a remote system or to an emergency boot device.

    You can use the system snapshot feature to complete this step. The system snapshot feature takes a “snapshot” of the files currently used to run the QFX Series switch—the complete contents of the /config and /var directories, which include the running Junos OS, the active configuration, and the rescue configuration—and copies all of these files into a memory source. See Creating a Snapshot and Using It to Boot a QFX Series Switch.

    Note:

    System snapshot is not supported on QFX10000 and QFX5200 switches.

    CAUTION:

    The recovery installation process completely overwrites the entire contents of the internal flash storage.

  3. Copy any other stored files to a remote system as desired.

To reinstall Junos OS:

  1. Connect to the device's console port (either directly or through a console server).

  2. Insert the emergency boot device into the QFX Series switch.

  3. Reboot or power cycle the device.

  4. As soon as the device reboots, keep pressing Esc until the boot options menu opens.

    content_copy zoom_out_map
    Press Esc for boot options
    ...
    Intel(R) Xeon(R) CPU  @ 2.50GHz                                       2.50 GHz
    V0018.8                                                           16384 MB RAM
     Continue
     Boot Manager
     Device Manager
     Boot From File
     Setup Utility  
    Note:

    You might have to reboot or power cycle the device more than once if you miss hitting Esc to open the boot options menu.

  5. In the boot options menu, select Boot Manager.

  6. In the Boot Manager menu, select the emergency boot device. In this example, the emergency boot device is the USB device.

    Note:

    In later releases, the Boot Manager menu might display two different entries for the same USB recovery device. Select the EFI USB Device entry.

    content_copy zoom_out_map
    ┌──────────────────────────────────────────────────────────────────────────────┐
    │                                Boot Manager                                  │
    └──────────────────────────────────────────────────────────────────────────────┘
    Boot Option Menu          
    
     SSD0 : ATP M.2 2242                
     IBA GE Slot 0101 v1350             
     IBA GE Slot 0102 v1350             
     USB : General Udisk                
     SSD1 : ATP M.2 2242                
     IBA GE Slot 0103 v1350             
     EFI HDD Device (ATP M.2 2242)      
     Internal EFI Shell                 
    

    The Juniper Linux Installer or GNU GRUB menu opens. The menu and options may differ slightly depending on the platform and release.

  7. If you have Junos OS software from the factory installed on the emergency boot device, the software prompts you with the following options:

    content_copy zoom_out_map
    Juniper Linux Installer - (c) Juniper Networks 2014
                Reboot                                                    
                Install Juniper Linux Platform                           
                Boot to host shell [debug]

    Select Install Juniper Linux Platform to install the Junos OS software from the emergency boot device.

    Note:

    Depending on the platform and release, you may see different entries such as Install Juniper Linux, Install Juniper Linux Platform, or Install Juniper Linux with secure boot support.

  8. The device copies the software from the emergency boot device, occasionally displaying status messages. Copying the software can take up to 12 minutes.

  9. After the software is copied to the device, the device reboots from the internal flash storage on which the software was just installed.

    Note:

    If the Boot Manager menu includes both SSD drive and EFI HDD Device entries, manually select the EFI HDD Device option.

    When the reboot is complete, the device displays the Junos OS login prompt:

    content_copy zoom_out_map
    root@switch#
  10. Create a new configuration as you did when the device was shipped from the factory, or restore the previously saved configuration file to the device.

  11. Remove the emergency boot device.

Performing a Recovery Installation

If the device’s software is corrupted or otherwise damaged, you may need to perform a recovery installation, using the emergency boot device to restore the default factory installation. Once you have recovered the software, you will need to restore the router or switch’s configuration. You can either create a new configuration as you did when the device was shipped from the factory, or if you saved the device’s previous configuration, you can simply restore that file to the system.

Depending on the situation, you should try to perform the following steps before you perform the recovery installation:

  1. Ensure you have an emergency recovery disk to use during the installation. When the device is first shipped, an emergency recovery disk is provided with it. For instructions on creating an emergency boot device, see Creating an Emergency Boot Device for Routers

  2. Copy the existing configuration in the file /config/juniper.conf.gz from the device to a remote system. For extra safety, you can also copy the backup configurations (the files named /config/juniper.conf.n, where n is a number from 0 through 9).

    CAUTION:

    The recovery installation process completely overwrites the entire contents of the fixed storage media.

  3. Copy any other stored files to a remote system as desired.

To reinstall Junos OS:

  1. Insert the removable media emergency boot device into the device.

    Note:

    You can store a configuration on installation media such as a PC Card or USB stick.

  2. Reboot the device.

    If the CLI is still active, issue the request system reboot command from command mode to reboot the device.

    If the CLI is not working, manually power off the device using the main power switch, wait 10 seconds, and then power the device back on.

  3. When the software prompts you with the following question, type y:

    Note:

    Junos OS with upgraded FreeBSD does not display the following warning. To determine if your system uses Junos OS with upgraded FreeBSD, see: Junos kernel upgrade to FreeBSD 10+.

    content_copy zoom_out_map
    WARNING: The installation will erase the contents of your disk. Do you wish to continue (y/n)? y

    The device copies the software from the removable media emergency boot device onto your system, occasionally displaying status messages. Copying the software can take up to 45 minutes, depending on the device. When the process is complete, the system boots into Amnesiac state and the login prompt is displayed.

  4. Remove the removable media emergency boot device.

    Note:

    For SRX300, SRX320, SRX340, SRX345, and SRX380 firewalls: When one of these firewalls is already booted with a recovery image, you cannot recover the firewall using a junos-install-media-usb* image from an already-inserted bootable USB device. If you unplug the bootable USB device and plug the device back in, then you can install the recovery image from the USB device. This behavior is designed to avoid the scenario where someone installs a recovery image and issues a reboot command for some other purpose, but the device copies and installs the second image from the USB device instead of using the original recovery image.

  5. Log in as root on the device’s console port and issue the request system reboot command from command mode to reboot the device.

    The device reboots from the boot device on which the software was just installed. When the reboot is complete, the device displays the login prompt.

  6. Create a new configuration as you did when the device was shipped from the factory, or restore a previously saved configuration file to the system. For more information, see Configuring Junos OS for the First Time on a Device with a Single Routing Engine, Configuring Junos OS for the First Time on a Device with Dual Routing Engines, and Restoring a Saved Configuration.

footer-navigation