This document provides a reference for all pvmlab CLI commands.
Installs dependencies, creates the artifacts directory, and generates an SSH key pair.
Usage:
pvmlab setup
Details: This command performs the following actions:
- Checks for required dependencies (
brew,mkisofs,socat,qemu-system-aarch64,docker,socket_vmnet). - Creates the
~/.pvmlabdirectory and its subdirectories (images,vms,pids,logs,monitors,ssh,configs). - Generates an RSA key pair for SSH access to the VMs and stores it in
~/.pvmlab/ssh/. - Downloads the Ubuntu cloud image if it's not already present.
- Checks the status of the
socket_vmnetservice.
Stops all VMs and services, and removes generated files.
Usage:
pvmlab clean [--purge]
Flags:
--purge: If set, removes the entire~/.pvmlabdirectory. Otherwise, only the contents of subdirectories are removed.
Manages the socket_vmnet background service. This service is required for VMs to have network access.
Starts the socket_vmnet service. Requires sudo.
Usage:
pvmlab socket_vmnet start
Stops the socket_vmnet service. Requires sudo.
Usage:
pvmlab socket_vmnet stop
Checks the status of the socket_vmnet service.
Usage:
pvmlab socket_vmnet status
Manages virtual machines.
Creates a new target VM.
Usage:
pvmlab vm create <name> [flags]
Arguments:
<name>: The name for the new VM.
Flags:
--mac: The MAC address for the VM's private network interface. If not provided, a random one is generated.--disk-size: The size of the VM's disk (e.g.,10G,20G). Defaults to15G.--arch: The architecture of the VM. Can beaarch64orx86_64. Defaults toaarch64.--pxeboot: If set, creates a VM that boots from the network for installation.--distro: The distribution for the VM (e.g.ubuntu-24.04). Required for--pxeboot.
Example:
# Create a target VM that boots from a local disk image
pvmlab vm create my-target
# Create a target VM that will be installed via PXE boot
pvmlab vm create my-pxe-target --pxeboot --distro ubuntu-24.04Creates the provisioner VM.
Usage:
pvmlab provisioner create <name> [flags]
Arguments:
<name>: The name for the new provisioner VM.
Flags:
--ip: (Required) The static IPv4 address for the VM's private network interface, in CIDR notation (e.g.,192.168.254.1/24).--ipv6: The static IPv6 address for the VM's private network interface, in CIDR notation (e.g.,fd00:cafe:babe::1/64).--mac: The MAC address for the VM's private network interface. If not provided, a random one is generated.--disk-size: The size of the VM's disk (e.g.,10G,20G). Defaults to15G.--arch: The architecture of the VM. Can beaarch64orx86_64. Defaults toaarch64.--docker-pxeboot-stack-tar: Path to a custompxeboot_stack.tarfile.--docker-pxeboot-stack-image: Docker image for the pxeboot stack to pull from a registry.--docker-images-path: Path to a directory of Docker images to share with the provisioner VM.--vms-path: Path to a directory of VMs to share with the provisioner VM.
Example:
# Create a provisioner VM
pvmlab provisioner create my-provisioner --ip 192.168.254.1/24Starts the specified VM.
Usage:
pvmlab vm start <name> [flags]
Flags:
-i,--interactive: Attach to the VM's serial console for interactive use.--wait: Wait for the VM's cloud-init process to complete before exiting.--boot: Override the default boot device. Can bediskorpxe.
Stops the specified VM.
Usage:
pvmlab vm stop <name>
Opens an SSH session to the specified VM.
Usage:
pvmlab vm shell <name>
Tails the console logs for the specified VM.
Usage:
pvmlab vm logs <name>
Lists all created VMs and their status.
Usage:
pvmlab vm list
Stops the VM and deletes its generated files (disk, ISO, logs, etc.).
Usage:
pvmlab vm clean <name>
Copies files to/from a VM using scp. One of the source or destination must be a remote path in the format vm-name:/path/to/file.
Usage:
pvmlab vm copy <source> <destination> [flags]
Arguments:
<source>: The source path.<destination>: The destination path.
Flags:
-r,--recursive: Recursively copy entire directories.
Example:
# Copy a local file to a VM
pvmlab vm copy ./local-file.txt my-vm:/home/user/
# Copy a file from a VM to the local machine
pvmlab vm copy my-vm:/home/user/remote-file.txt ./Manages distributions that can be used to provision VMs.
Lists available distributions and their status.
Usage:
pvmlab distro ls
Downloads and extracts a distribution for PXE booting.
Usage:
pvmlab distro pull [flags]
Flags:
--distro: The distribution to pull (e.g.,ubuntu-24.04). Defaults toubuntu-24.04.--arch: The architecture of the distribution (aarch64orx86_64). Defaults toaarch64.
Manages Docker containers inside a VM.
Starts a Docker container inside a VM from a given tarball.
Usage:
pvmlab provisioner docker start --docker-tar <tar> [flags]
Arguments:
<vm>: The name of the VM where the container will run.
Flags:
--docker-tar: (Required) Path to the Docker container tarball.--privileged: Run the container in privileged mode.--network-host: Use the host's network stack inside the container.
Stops a Docker container inside a VM.
Usage:
pvmlab provisioner docker stop <container>
Checks the status of Docker containers inside a VM.
Usage:
pvmlab provisioner docker status