Olive (JunOS) and troubles of 'recovery' mode

From MyWiki

Jump to: navigation, search

NOTE: I did this using virtual serial port (see Olive (JunOS) and serial port in VMWare Fusion). I have no clue how to do the same on Windows. You have to figure it out yourself, but I'm pretty sure it's doable too.

I had this strange problem when I couldn't get JunOS password reset. This was a VMWare Olive image with JUNOS 9.6R2.11.

When I tried the usual recovery procedure it didn't work for me. Namely after stopping boot process and requesting 'boot -s' to get to single-user mode and the typing 'recovery', it simply booted normally and I faced the login prompt that I couldn't get through without password. Doh!

Then I tried to type '/usr/libexec/ui/recovery-mode' instead of 'recovery' and it gave me the following screen:

Enter full pathname of shell or 'recovery' for root password recovery or RETURN for /bin/sh: /usr/libexec/ui/recovery-mode
NOTE: to go to multi-user operation, exit the single-user shell (with ^D)
Apr 13 21:41:29 init: can't exec /junos/usr/libexec/ui/recovery-mode for single user: No such file or directory

To run the rest of rc manually (after the above):

	chroot /junos /bin/sh /etc/rc.chroot

and to run a shell with a normal view of the system:

	chroot /junos /bin/sh

Looking around revealed interesting view:

# ls
.snap		dev		kernel		packages	sbin
boot		etc		kernel.old	pkg		usr
cf		junos		opt		root		var

After some poking around and looking what have I got there and looking inside of /junos/etc/rc.chroot, I gave it a go:

# chroot /junos
# /bin/sh /etc/rc.chroot

After some lengthy output I ended up in a shell as root. Now I tried to run cli manually:

# cli
could not open user interface connection: management daemon not responding
Retry connection attempts ? [yes,no] (yes) no

Ok, let's get the daemon up by hand:

# mgd

One more try and I'm in:

# cli     
root@JSR-ES-01> configure 
Entering configuration mode

[edit]
root@JSR-ES-01# set system root-authentication plain-text-password 
New password:
Retype new password:

[edit]
root@JSR-ES-01# commit 
commit complete

[edit]
root@JSR-ES-01# exit 
Exiting configuration mode

root@JSR-ES-01> exit

Rebooted the system and I'm back in business :-). Phew!

Personal tools