解决JuniperEX系列产品系列内核丢失

The EX2300/EX3400 is not booting up and it is displaying the loader prompt after returning 'can't load kernel' error

Symptoms
EX2300/EX3400 is not booting up showing the following error:

DRAM: 2048MB
Number of U-Boot devices: 2
U-Boot env: loaderdev not set, will probe all devices.
Found U-Boot device: disk
Probing all disk devices...
Checking unit=0 slice=<auto> partition=<auto>... good.
-
can't load 'kernel'

Type '?' for a list of commands, 'help' for more detailed help.
loader>
Solution
Download the install media image https://support.juniper.net/support/downloads/ (make sure is .img package)

Make a bootable USB by either using the dd command in shell (or other Linux system), or you can also use various GUI software for cloning images.

Once the USB is ready, it can be plugged into the switch after which the switch needs to be rebooted:

USB0: USB EHCI 1.00
scanning bus 0 for devices... 3 USB Device(s) found
scanning usb for storage devices... 1 Storage Device(s) found
SF: Detected MX25L6405D with page size 256 Bytes, erase size 64 KiB, total 8 MiB, mapped at 00000088
## Starting application at 0x00000074 ...
Consoles: U-Boot console

FreeBSD/armv6 U-Boot loader, Revision 1.2
(fbsd-builder@svl-bsdx-05.juniper.net, Wed May 18 12:32:06 PDT 2016)

DRAM: 2048MB
Number of U-Boot devices: 2
U-Boot env: loaderdev not set, will probe all devices.
Found U-Boot device: disk
Probing all disk devices...
Checking unit=0 slice=<auto> partition=<auto>... good.
-
can't load 'kernel'

Type '?' for a list of commands, 'help' for more detailed help.
loader>
Once on loader prompt, select USB manually,

set currdev="disk1s1a"

Note :

If the above "disk1s1a" does not show , please use the next command to list all disks ,
Example

loader> lsdev
disk devices:
disk0 (USB)
disk0p1: FreeBSD UFS
disk0p2: FreeBSD UFS
disk1 (USB)
disk1s1: FreeBSD
disk1s1a: FreeBSD UFS
net devices:
net0:

If the disk1s1a does not show "disk1s1a" try to use another USB maybe a smaller 16gb or 4gb , and make it bootable and use disk1s1

Confirm 'loader.rc' is on the USB (to make sure the bootable USB was properly created):

loader> ls /boot
/boot
loader.conf
load-dtb.4th
platform-load-dtb.4th
platform-loader.4th
d dtb
loader.rc
support.4th
kernel
contents.iso
Manually boot from USB:

loader> include /boot/loader.rc
You will see the following after which the device will boot up with the new version:

/boot/kernel data=0xe48000 syms=[0x4+0x5cdb0+0x4+0x81971]
/boot/dtb/ex3400.dtb size=0x1f25
/boot/contents.iso size=0x171e800

Wed Aug 2 15:12:56 UTC 2017

FreeBSD/arm (Amnesiac) (ttyu0)

login: root
Modification History
08/03/23