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

  1. Point your web browser to the Juniper vJunos-switch Downloads page.

  2. Click the qcow2 link for the 25.2R1 Release.

Download vJunos-switch qcow2 file
  1. Select I Agree and click the Proceed button.

  2. Click the CLICK HERE link to download the image on your localhost.

  3. Open your favorite terminal emulator, and change to the Downloads directory.

cd ~/Downloads
  1. Copy the vJunos-switch-25.2R1.9.qcow2 file 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
  1. Establish a connection with the lab server.
ssh arch
  1. Change to the images directory where the file is located.
cd ~/images
  1. 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
  1. Install the multipath-tools package.
sudo pacman -S multipath-tools
  1. 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
  1. Identify the loop0p2 partition.
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
  1. Add the partition devmapping.
sudo kpartx -va vJunos-switch-25.2R1.9.raw
  1. Create the directory for the mount target.
sudo mkdir -p /mnt/juniper
  1. Mount the filesystem.
sudo mount /dev/mapper/loop0p2 /mnt/juniper
  1. Verify the mount.
mount | grep juniper

output:

/dev/mapper/loop0p2 on /mnt/juniper type ext3 (rw,relatime)
  1. Change to the directory of interest.
cd /mnt/juniper/home/pfe/junos
  1. 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).

  1. Add the svm flag check for an AMD CPU.
sudo sed -i 's:grep -ci vmx):grep -ci "vmx\\|svm"):' start-junos.sh
  1. Verify the modification.
grep svm start-junos.sh

output:

CPU_FLAG=$(cat /proc/cpuinfo | grep -ci "vmx\|svm")
  1. Change back to the images directory.
cd ~/images
  1. Ensure all cached writes get synced to persistent storage.
sudo sync
  1. Unmount the filesystem.
sudo umount /mnt/juniper
  1. Delete the partition devmapping.
sudo kpartx -vd vJunos-switch-25.2R1.9.raw
  1. Create the amd-fix directory.
mkdir -p amd-fix
  1. 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
  1. Change to the src directory.
cd ~/src
  1. Clone the srl-labs/vrnetlab repo from GitHub.
git clone https://github.com/srl-labs/vrnetlab.git
  1. Change to the vjunosswitch directory.
cd vrnetlab/juniper/vjunosswitch
  1. Copy the updated vJunos-switch-25.2R1.9.qcow2 file to the local directory.
cp ~/images/amd-fix/vJunos-switch-25.2R1.9.qcow2 .
  1. Run make to build the image.
make
  1. Verify the Juniper vJunos-switch image is now listed.
docker image ls -f="reference=*/juniper*"
  1. 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
  1. Test with clab deploy.

Reference