As of the date of this post, additional steps are required to successfully boot the latest Juniper vJunos-switch version on a system with an AMD CPU for Containerlab . I use Arch as my Linux distribution, but most of the content applies to any distribution. Modify where needed (e.g., package management for tools).
Prerequisite
Steps
-
Point your web browser to the Juniper vJunos-switch Downloads page.
-
Click the qcow2 link for the 25.2R1 Release.
-
Select I Agree and click the Proceed button.
-
Click the CLICK HERE link to download the image on your localhost.
-
Open your favorite terminal emulator, and change to the
Downloadsdirectory.
cd ~/Downloads
- Copy the
vJunos-switch-25.2R1.9.qcow2file to the lab server.
For my example, I need to copy the file from my local Mac to the images directory on my remote lab server.
rsync -ah --progress vJunos-switch-25.2R1.9.qcow2 arch:images
- Establish a connection with the lab server.
ssh arch
- Change to the
imagesdirectory where the file is located.
cd ~/images
- Identify which Arch Linux package contains the kpartx tool.
sudo pacman -Fy kpartx
output:
:: Synchronizing package databases...
core is up to date
extra is up to date
extra/multipath-tools 0.13.0-1
usr/bin/kpartx- Install the
multipath-toolspackage.
sudo pacman -S multipath-tools
- Create a raw
disk image file from
vJunos-switch-25.2R1.9.qcow2.
qemu-img convert -pf qcow2 vJunos-switch-25.2R1.9.qcow2 -O raw vJunos-switch-25.2R1.9.raw
- Identify the
loop0p2partition.
sudo kpartx -vl vJunos-switch-25.2R1.9.raw
output:
loop0p1 : 0 32768 /dev/loop0 2048
loop0p2 : 0 66560000 /dev/loop0 34816
loop deleted : /dev/loop0- Add the partition devmapping.
sudo kpartx -va vJunos-switch-25.2R1.9.raw
- Create the directory for the mount target.
sudo mkdir -p /mnt/juniper
- Mount the filesystem.
sudo mount /dev/mapper/loop0p2 /mnt/juniper
- Verify the mount.
mount | grep juniper
output:
/dev/mapper/loop0p2 on /mnt/juniper type ext3 (rw,relatime)
- Change to the directory of interest.
cd /mnt/juniper/home/pfe/junos
- Output the current CPU flag check.
grep 'grep -ci vmx' start-junos.sh
output:
CPU_FLAG=$(cat /proc/cpuinfo | grep -ci vmx)
Note it’s only checking for the Intel CPU virtualization extension (
vmx).
- Add the
svmflag check for an AMD CPU.
sudo sed -i 's:grep -ci vmx):grep -ci "vmx\\|svm"):' start-junos.sh
- Verify the modification.
grep svm start-junos.sh
output:
CPU_FLAG=$(cat /proc/cpuinfo | grep -ci "vmx\|svm")
- Change back to the
imagesdirectory.
cd ~/images
- Ensure all cached writes get synced to persistent storage.
sudo sync
- Unmount the filesystem.
sudo umount /mnt/juniper
- Delete the partition devmapping.
sudo kpartx -vd vJunos-switch-25.2R1.9.raw
- Create the
amd-fixdirectory.
mkdir -p amd-fix
- Convert the raw disk image back to the QEMU image format.
qemu-img convert -pf raw vJunos-switch-25.2R1.9.raw -O qcow2 amd-fix/vJunos-switch-25.2R1.9.qcow2
- Change to the
srcdirectory.
cd ~/src
- Clone the
srl-labs/vrnetlabrepo from GitHub.
git clone https://github.com/srl-labs/vrnetlab.git
- Change to the
vjunosswitchdirectory.
cd vrnetlab/juniper/vjunosswitch
- Copy the updated
vJunos-switch-25.2R1.9.qcow2file to the local directory.
cp ~/images/amd-fix/vJunos-switch-25.2R1.9.qcow2 .
- Run
maketo build the image.
make
- Verify the Juniper vJunos-switch image is now listed.
docker image ls -f="reference=*/juniper*"
- Create a simple Containerlab topology definition file.
name: vjs-amd
topology:
kinds:
juniper_vjunosswitch:
image: vrnetlab/juniper_vjunos-switch:25.2R1.9
nodes:
sw01:
kind: juniper_vjunosswitch- Test with
clab deploy.