How To Install Olive 12.1R1.9 With Qemu

Posted by Ahsan Tasneem | 3:37 AM | , , , , , | 1 comments »

The article describes installation of Junos 12.1R1.9 on emulated x86 hardware. Hardware is emulated by Qemu and Junos installed on it is known as Olive.
As Olive does not have Packet Forwarding Engine PFE attached, packet forwarding is exclusively depending on performance of the host CPU. In addition, they are also configurations known as not working on Olive. Considering these limits, Olive can never substitute real Juniper hardware.
In spite all of that Olive is an excellent tool for testing configurations that can be later deployed on real Juniper hardware. Thanks to GNS3 project that offers lightweight GUI for Qemu, complex labs can be easily deployed without real need of knowing Qemu commands.
My goal was to rewrite these articles for actual Junos 12.1R1.9 version and create a guide that helps you to install Junos. Please use links above if you feel that you need to clarify details or further explanation.


a host system – any Linux installed on x86 with at least 2GB RAM and 5 GB HDD space dedicated for Qemu disk. Have in mind that you need to dedicate 512MB RAM for each Olive instance.
Qemu emulator installed on Linux

FreeBSD 4.11 installation CD – 4.11-RELEASE-i386-miniinst.iso
a copy of the jinstall 12.1R1.9 package (M/T series install package) – jinstall-12.1R1.9-domestic-signed.tgz

a host system is your Linux distro, mine is Fedora Linux
a guest system is FreeBSD distribution
an installation archive is a package jinstall-12.1R1.9-domestic-signed.tgz
Qemu disk or Qemu virtual machine is a file olive-base.img

Installation Steps
1. Create Qemu Disk
2. Install FreeBSD
3. Install Junos
4. Install jweb GUI

Create Qemu Disk
/usr/local/bin/qemu-img create -f qcow2 olive-base.img 16G

Install FreeBSD
/usr/local/bin/qemu-system-i386 -m 512 -hda olive-base.img -cdrom ./4.11-RELEASE-i386-miniinst.iso -enable-kvm

The command starts Qemu disk olive-base.img with 512MB RAM with attached FreeBSD image. Omit a parameter -enable-kvm if your hardware does not support hardware virtualization.

a) Select – Standard Installation
b) Create Disks Partitions

Press a – Use entire disk, q to confirm.
Select install a standard MBR and when you see the FreeBSD Disklabel editor, press c to create the following partitions:

ad0s1a / 4096M
ad0s1b swap 4096M
ad0s1e /config 256M
ad0s1f /var rest
Press q to finish. Choose Minimal distribution type and install from a FreeBSD CD/DVD.

Once files are copied, the installer program will ask you many questions. Just answer No for each of them. Set password for root account and exit. When FreeBSD start to reboot itself, close the Qemu window.
Install Junos

We need to extract an installation archive and edit files inside archive in order to install Junos successfully. Due to the huge amount of time it would take on the guest, I suggest you to extract archive inside the host system. It is much faster than to do the same in FreeBSD. Then we can pack archive back and copy it to the guest.

Here are the steps:
a) Copy true utility from FreeBSD to the host

Checkpic is binary that is stored in the installation archive. We have to replace this binary with utility /usr/bin/true located in FreeBSD. Start qemu disk and copy utility to the host.
Here is the command we will use:
/usr/local/bin/qemu-system-i386 -m 512 -boot c -net nic,macaddr=00:aa:00:60:01:01,model=e1000 -hda olive-base.img -enable-kvm -net user

The command tells Qemu to start Qemu disk with single network e1000 interface. After boot, configure network settings as following:
dhclient em0

The command assigns an IP address to the interface em0 and create a static route to the default gateway Do not panic if you are not familiar with those strange network settings – in fact, there is NAT connection between the guest and host system. You should be able to transfer file without any difficulties.
Use scp command for secure transfer. Copy true utility to your home directory. Let’s say that mine is /home/brezular/.

scp -rv /usr/bin/true brezular@
b) Resolve checkpic binary and hardware check

This part consists of steps that extract archive file and modify files located inside it. After changes, archive will be repacked. Now, let’s say that a file jinstall-12.1R1.9 is stored in the host system in a directory /home/brezular/.
cd /home/brezular/

mkdir ./jinst-signed
cd jinst-signed
tar zxvf ../jinstall-12.1R1.9-domestic-signed.tgz
Once archive is changed, checksum is not valid. Delete following files:

rm *.sig *.sha1 *.md5
During installation, will be checked. As it is not such a option supported in FreeBSD, we have to prevent to check this parameter. To avoid it, modify the file +INSTALL file and find function check_arch_compatibility(). Comment line starting with word re_name and assign a dummy value to re_name as it is shown below.

#re_name=”`/sbin/sysctl -n 2>/dev/null`
if [ -z "$re_name" ]; then
Error “ sysctl not supported.”

mkdir ./jinst
cd jinst
tar zxvf ../jinstall-12.1R1.9-domestic.tgz

Once again, modify +INSTALL file and assign a dummy value to re_name.

#re_name=”`/sbin/sysctl -n 2>/dev/null`
if [ -z "$re_name" ]; then
Error “ sysctl not supported.”
Now modify +REQUIRE file and assign a dummy value to re_name.

#re_name=”`/sbin/sysctl -n 2>/dev/null`
if [ -z "$re_name" ]; then
Error “ sysctl not supported.”

mkdir ./pkgtools
cd pkgtools
tar zxvf ../pkgtools.tgz
cd ./bin
cp /home/brezular/true ./checkpic
cd ..
tar zcvf ../pkgtools.tgz *
cd ..
rm -rf pkgtools

tar zcfv /home/brezular/jinstall-12.1R1.9-domestic-olive.tgz *
At this point we have an installation file – jinstall-12.1R1.9-domestic-olive.tgz ready for installation in a home directory.

c) Copy installation file and GUI file to the guest
In case you would like to manage Olive with GUI, copy an installation package jweb-12.1R1.9-signed.tgz to /home/brezular/. Then go back to the guest. Use following commands to copy an installation file and GUI file to the guest.

scp -rv brezular@ /var/tmp/
scp -rv brezular@ /var/tmp/

d) Install Junos package
pkg_add -f /var/tmp/jinstall-12.1R1.9-domestic-olive.tgz

Once package is installed, halt FreeBSD and close the Qemu window.

Start Qemu and continue in installation with following command.
/usr/local/bin/qemu-system-i386 -m 1024M -boot c -net nic,macaddr=00:aa:00:60:01:01,model=e1000 -hda olive-base.img -enable-kvm -net user
-serial telnet:,server

During Junos installation, a temporary partition /tmp is allocated in RAM. If we only start Olive with 512MB RAM, installation hangs up. For this reason increasing RAM is required.
Also notice that like any other router, Juniper does not have VGA output and redirects output to the serial port. Thus we must tell Qemu to redirect a serial port to the telnet port.
Telnet to localhost and check an installation process.

telnet localhost 3000
When installation is finished, Olive automatically reboots. After boot we will be sitting in login prompt. Login as root without password.

Install Jweb GUI
To get to Junos cli, type command cli. Package can be installed with following command.

request system software add /var/tmp/jweb-12.1R1.9-signed.tgz
if you want to reduce size of Olive, remove installation files in directory /var/tmp/.

rm /var/tmp/jinstall-12.1R1.9-domestic-olive.tgz
rm /var/tmp/jweb-12.1R1.9-signed.tgz

Articles Sources:


  1. Sandy Shaw // October 10, 2012 at 7:20 AM  

    Nice Article! Thanks for sharing with us.
    IP Routing

Related Posts Plugin for WordPress, Blogger...