Create disposable virtual machines for Debian releases

At Your Disposal

© Photo by Alfonso Navarro on Unsplash

© Photo by Alfonso Navarro on Unsplash

Article from Issue 274/2023
Author(s):

Debvm lets you quickly create a temporary virtual machine with a small memory footprint, ideal for testing scripts or mixing repositories.

Debian developers have a habit of writing utilities for maintaining distributions that are also useful for ordinary users. For example, diffoscope [1], which compares binary files, is useful for both version control and comparing – among others – PDF and LibreOffice files. In the past year or so, an equally useful utility called debvm has emerged. As the name suggests, debvm [2] is a tool for the quick and easy creation of virtual machines (VMs) running Debian releases and architectures [3]. While debvm gives developers the ability to test releases and architectures without changing hardware, it can be also be useful to any user as a sandbox for testing scripts or checking the results of mixing repositories. Where traditional virtualization methods such as VMware, VirtualBox, or Gnome Boxes create permanent VMs, often for the purpose of running another operating system, debvm is ideal for creating VMs for specific, limited purposes with a small memory footprint.

You will find the debvm 0.2.12 package in the repository of Debian 12 (Bookworm) and the 0.2.7 package in Ubuntu 23.04 repositories. Undoubtedly, other Debian derivatives will start to carry it as it gets closer to general release, although the current releases are stable enough to be worth exploring. The packages consists of three command-line tools: debvm-create, debvm-run, and debvm-waitssh. All three commands include intelligent defaults that make the bare command usable, as well as a handful of options each.

debvm-create

As a wrapper for mmdebstrap, debvm-create lets you create a chroot jail. Used without any options, debvm-create produces a VM with the host machine's format, files from the repository debvm is taken from, and one gigabyte of memory. No password is required. Instead of user accounts, users are automatically logged in as root. Repositories and apt are installed, as well as basic utilities. Note that if you use the package from Debian Unstable, which as its name implies is constantly changing, you may sometimes be unable to install everything. However, such problems do not always make the resulting VM completely unusable. The VM is a file called rootfs.ext4 in the current working directory.

[...]

Use Express-Checkout link below to read the full article (PDF).

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News