Saturday, 13 March 2010

Juniper Olive on Sun VirtualBox

In my previous post I told you how to prepare VirtualBox and FreeBSD to accept a Juniper Olive. Now we need to upload the JunOS software and install it.

In the good old days (JunOS 7.4) this was quite an easy task but since 8.4 things have got a bit more complicated, Juniper upgraded the version of FreeBSD and added a utility that verified the PICs meaning that the install would fail even if you tried to force it.

Disclaimers:

  • This isn’t supported, Juniper will die a little inside if you ring the JTAC up and demand to know why your Olive doesn’t work. Enough of this and they will stop olives working altogether so play nice.
  • I can’t supply JunOS to you, nor can I recommend anyone who can. If you don’t have access to it then you shouldn’t and you should go out for a nice pint or two instead.
  • I’m a network engineer and have a very basic knowledge of BSD, feel free to mock my tar/gzip/shell skills or better yet tell me an easier way.

Step-By-Step

I’m assuming that you’ve followed the previous post and are sitting at the root prompt of your FreeBSD VM.

First thing you need to do is get the jinstall tarball onto your VM, I have a FTP server running on my PC for this purpose but you may have one on the internet or a home server etc. If you don’t and you need a good FTP server I can recommend FileZilla just make sure that if you’re running Windows 7 or Vista you enable the server exe in your firewall.

Creating the Olive Installer

Use the FTP CLI within FreeBSD to get the jinstall into your home directory. I’ve used the following filename as an example; make sure you substitute it for your version:

jinstall-9.4R4.5-domestic-signed.tgz

Do the following:

>mkdir tmp
>mv jinstall-9.4R4.5-domestic-signed.tgz tmp
>cd tmp
>tar –xzf jinstall-9.4R4.5-domestic-signed.tgz
>mv jinstall-9.4R4.5-domestic.tgz ..
>rm –r *

Because this is a signed version of JunOS you need to extract the non-signed version out of the tarball, once done we move the non-signed version (jinstall-9.4R4.5-domestic.tgz) into our home directory and delete all the rest of the files.

Now we need to move the file back into the tmp directory and extract it:

>mv ../jinstall-9.4R4.5-domestic.tgz .
>tar –xzf jinstall-9.4R4.5-domestic.tgz
>rm jinstall-9.4R4.5-domestic.tgz

In this directory you will now see all the detail of the package, the file we are immediately interested in is the pkgtools.tgz file. Create a new tmp folder and extract this file into it.

>mkdir tmp
>cd tmp
>tar –xzf ../pkgtools.tgz
>rm ../pkgtools.tgz

Now we need to replace the checkpic binary with something that will give a more positive response when called:

>cp /usr/bin/true bin/checkpic

This means that every time the installer runs this to check the validity of the PICs it will be told that everything is a-ok. Now we need to package this back up, remove our temporary files then repackage the whole thing up into our modified jinstaller.

>tar –czf ../pkgtools.tgz *
>cd ..
>rm –r tmp
>tar –czf ../jinstall-olive.tgz *
>cd ..
>rm –r tmp

This can be a bit hard to follow but basically at the start you were in the /root/tmp/tmp directory where the pkgtools were stored and have tar and zipped all the files up. I’m sure this whole page can be done in a single line of shell but I don’t have the slightest clue how.

If everything has gone to plan you should be left in the root home directory with a file called “jinstall-olive.tgz”. If you want you can copy this over to your ftp server so if you want to use it again you don’t have to follow the above process a second time.

Installing the software from here is quite easy:

>pkg_add –f jinstall-olive.tgz

It will throw up a load of warnings (too late you used the –f force switch) and tell you that you need to reload. Issue the “shutdown –r now” command and hope for the best.

If all goes will the VM will reboot, get to the boot loader then then appear to stop. This just means that output is redirected to COM1 port, new versions of JunOS (not 8.4) now enable login on the console screen so you don’t need to play about with the COM1 port (if you remember we enabled it but ignored it in the last post).

After about 5 minutes it will reboot again and then after a further few minutes you should end up with a login prompt. Login is root with no password and you should be dumped to the new Olive shell. Enter “cli” and you are now running your own Juniper Olive.

image

Have fun!

20 comments:

chiel said...

Hi, thanks for this howto!

Could you explain why you need a VT CPU? I just installed Junos 9.4 on my Laptop that has a T5500 Intel (non VT) without any problem.

And how do you know which FreeBSD version must be used for which JUNOS version? I want to install JUNOS 10.3?

SleepyKitten said...

@chiel

I'm not entirely sure why I've not had any joy with non-VT architecture. The VM would just lock up half way though the book of JunOS. If it works for you that's good though, means there is hope - I'll investigate with a few other machines I've got laying about at work.

For 10.3 you should be just fine with FreeBSD 6.4 - I've built one from scratch at 10.3 recently and didn't have any major issues.

nwood said...

Your instructions have been invaluable to me. Other attempts/sites have been too vague or assumed a much higher level of Nix skills than I currently have. I really appreciate your taking the time to get this out for the common good.

Andrei said...

does not work mate ... what you've got so far here it's unusable for some protocol areas ...
multicast cannot be tested unless you put all interfaces in promiscuous.

nice try though :)

SleepyKitten said...

@ Andrei

That's fine - I never use Multicast anyhow so it's not a loss.

If you are desperate to do multicast in a VM environment I think there's a patched version of VMWare that sort of supports it although I've not investigated it very heavily on acount of the above.

SleepyKitten said...

I had a quick nose about, there are people claiming Multicast success by manually configuring the network and broadcast addresses rather than just the netmask and gateway.

Not sure if this would work, my multicast lab is deficient to the tune of a multicast lab.

CCIETRACK said...

Hi, first off, thank you for taking the time to right these instructions. I have followed all the way up to the point of the package add, but I keep getting an error that states
Waring: The boot device is less than 256M.
The jinstall never installs. Any ideas? Thanks

SleepyKitten said...

@CCIETRACK

Yeah I get that error too - the "-f" forces it to carry on even though it complains about 256mb. Is it failing even though you use "pkg_add -f"?

Артем said...

Hi there.
Thanks for the tutorial, it worked well for me till last two parts of your explanation.
I'm not quite sure what is supposed to happen after pkg_add command and reboot. It just stucks, no reboots afterwards.
"This just means that output is redirected to COM1 port, new versions of JunOS (not 8.4) now enable login on the console screen so you don’t need to play about with the COM1 port" - this part is totally unclear, how can I enable neccessary type of login here?

SleepyKitten said...

@Артем

It sounds like for some reason your Olive hasn't managed to install or boot. What version of JunOS did you use? Did you make sure your serial port is set to enabled but disconnected?

If you set up the serial port and connect to it then you should be able to see the boot in process and it may help you see what's going on. You can either redirect the serial to a physical serial port or to a pipe, in the past I've used a pipe as per the following:

http://www.reactos.org/wiki/VirtualBox

bbc said...

Can you please help here? I tried the same procedure and everything goes well and expected. But at the end when after adding the junos packege, and shut down, on console output , i see following

WARNING: want 327680 for /tmp rather than 47328
Using 327680 for /tmp
Setting ospackage=jboot-9.3R4.4.tgz, configpackage=configs-9.3R4.4.tgz
Setting packlist=jbundle-9.3R4.4-export.tgz
WARNING: The /tmp/preinstall filesystem is low on free space.
WARNING: This package requires 202800k free, but there
WARNING: is only 162132k available.

WARNING: This installation attempt will be aborted. You are now
WARNING: in a debug shell. Type ^D to reboot the system
You are now in a debugging subshell (you may not see a prompt)...

I tried different other versions and also allocated memory more than enough. But still has the same problem.

SleepyKitten said...

@bbc

Hmm do you delete all your temporary files? Try doubling up of the partition size for "/" - change it to 2gb and see what it does.

Cheers.

Cley said...

Hi,

I can confirmed it worked with VirtualBox 4.1.8 over a Win 7 64 bits host, FreeBSD 6.4 and Junos 11.4R1.14.
For serial port connection I use vmwaregateway (http://www.l4ka.org/91.php)

John Graham said...

Heavens to Betsy, it bloody worked first time! I'm naming my first child after you! :)

Bryant said...

Using virtualbox 3.14, 4, 4.12 with jinstall-10.1R1.8-domestic-olive.tgz, 10gb dynamic drive. 2gb each and once with a 2gb /tmp. And going into the /var/junos directory, ftp'ing jinstall-10.1R1.8-domestic-olive.tgz as BIN. I always get the message. I get the This package requires ####k free, but there is only 32872k (or something like that) memory.

I've ls -n the tmp directories, I've tried different versions of virtualbox. Someone just put the exact versions they're using that work so other can recreate it.

SleepyKitten said...

@Bryant
How much memory are you giving the OS? Try upping it by 512Mb and see if that fixes the issue.

Keren Levi.best said...

You can also use this online Juniper router
http://www.sharontools.com/online-lab/

Mustafa Darwish said...

Thank you for your post it was very helpful
the issue for me here. i cant use ftp server. when i install the freebsd i can't ping gateway nor loopback
i installed junos in another way.
but i can't access internet now gateway. any suggestions
for more information i checked the firewall and disabled the antivirus

Hman said...

Curious situation, I had 2 olives working with virtual box, then all of a sudden, they are no longer working. No errors in logs or anything. Even tried rebuilding my image, and still get same result...any one got any ideas?

Was running latest version of Virtual box in osx 10.8.4, and olive 8.5R1.14

sirop said...

Just installed 9.6R1.13.

Thanks.