Skip to content

Instantly share code, notes, and snippets.

@arjo129
Created January 10, 2023 09:24
Show Gist options
  • Save arjo129/5a3c93fabd425bd78bf45d57ccd22619 to your computer and use it in GitHub Desktop.
Save arjo129/5a3c93fabd425bd78bf45d57ccd22619 to your computer and use it in GitHub Desktop.

Note: These instructions are set up for using Qemu/KVM. If you have virtualbox installed, you cannot have kvm installed at the same time. It's possible to run mininet via the

Step 1: Download QEMU/KVM

  sudo apt-get -y -qq install \
                   kvmtool cloud-utils genisoimage qemu-kvm qemu-utils \
                   moreutils mtools

Step 2: Download mininet image

  mkdir mn_ws
  cd mn_ws
  wget https://github.com/mininet/mininet/releases/download/2.3.0/mininet-2.3.0-210211-ubuntu-20.04.1-legacy-server-amd64-ovf.zip

Step 3: Unpack and convert to qemu format

  unzip mininet-2.3.0-210211-ubuntu-20.04.1-legacy-server-amd64-ovf.zip
  qemu-img convert -p -f vmdk mininet-vm-x86_64.vmdk -O qcow2 mininet.qcow2

Step 4 Resize image (ROS has lots of dependencies)

  qemu-img resize mininet.qcow2 +30G

Step 5 Expand file system

We will need to enable nbd

  sudo modprobe nbd max_part=8
  sudo qemu-nbd --connect=/dev/nbd0 mininet.qcow2

Install gparted. Use it to expand the partition.

  sudo apt install gparted
  sudo gparted /dev/nbd0

Resize /dev/nbd0p2 to fill the space. image

image

Then repeat and resize /dev/nbd0p5. Apply your changes.

Unmount the image.

sudo qemu-nbd --disconnect /dev/nbd0

We can now launch mininet.

Step 7 Attach local work space

It is assumed your local ros2 work space has the code checked out. To launch our vm we need only run the following (feel free to save to script).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment