If you test a new package, a configuration change, or an install script directly on a server or your workstation, it leaves changes behind. A command that works on your workstation can also depend on packages or settings that you changed earlier. The result also depends on the architecture and release of that system. Thus, run the change in a clean VM first, check what it changed, and then apply it. This post shows a general procedure for this verification in a Lima VM on a Mac, with an nginx install as the example.
For clones and x86_64 VMs, see Lima advanced: x86_64 VMs, nested virtualization, and clones. For Lima installation, see the Lima documentation.
Verification steps
| Step | Action | Check |
|---|---|---|
| 1. Select the architecture | Select a VM with the same architecture as the target system | dpkg --print-architecture |
| 2. Make a disposable VM | Clone the base VM with limactl clone | The base VM stays unchanged |
| 3. Record the baseline | Save the package and unit lists, and make a baseline file | /tmp/before.txt, /tmp/baseline |
| 4. Run and capture | Run the commands as a script and save the output to a file | set -x, tee |
| 5. Clean up and compare | Remove what you installed and compare with the baseline | diff, find -newer |
| 6. Delete the disposable VM | Delete it with limactl delete | limactl list |
Select the architecture
On an Apple Silicon Mac, the default Lima VM is arm64. If the target is an amd64 server or PC, and the result depends on the architecture (packages, drivers), verify in an x86_64 VM. For work that does not depend on the architecture, and for kernel builds, the arm64 VM is faster.
| What you verify | VM | Reason |
|---|---|---|
| Package installs, PPAs, drivers, installs and upgrades | x86_64 | Package names and archive URLs in the output must be for amd64 |
| x86-only features (system call table, CPU features) | x86_64 | arm64 does not have the same code |
| Shell, systemd, configuration files, kernel builds | arm64 | The result is the same, and it is much faster than TCG |
| Work for ARM servers and boards | arm64 | It is the target architecture |
Before you start, record the release and architecture of the VM. When you share the result, include these three lines as the test environment.
$ ssh lima-demo-test 'lsb_release -ds; uname -r; dpkg --print-architecture'
Ubuntu 26.04.1 LTS
7.0.0-38-generic
arm64
To connect with ssh lima-<name>, add Include ~/.lima/*/ssh.config to ~/.ssh/config. The advanced article has the details.
Make a disposable VM with clone
If you test in the base VM, the packages that you install stay for the next test. Stop the base VM, clone it with limactl clone, and test in the clone.
$ limactl stop demo
$ time limactl clone demo demo-test --tty=false
real 0m0.043s
user 0m0.034s
sys 0m0.014s
$ limactl start demo-test --tty=false
...
time="2026-12-05T23:13:19+09:00" level=info msg="READY. Run `limactl shell demo-test` to open the shell."
The clone of the 20GiB disk took 0.04 seconds. With the start, it took less than one minute.
Record the baseline
Before the test, save the package list and the list of enabled units. Also make a baseline file. You use it to find files that package scripts create.
dpkg --get-selections > /tmp/before.txt
systemctl list-unit-files --state=enabled --no-legend | sort > /tmp/units-before.txt
sudo touch /tmp/baseline$ ssh lima-demo-test 'wc -l /tmp/before.txt'
713 /tmp/before.txt
Run the commands and capture the output
Put the commands that you verify in a script file and run that file. With set -x, each command also shows in the output as a + line.
set -x
sudo apt-get install -y nginx > /dev/null
systemctl is-active nginx
curl -sI http://localhost | head -1Keep the script on the Mac and send it to the standard input of ssh ... 'bash -s'. tee saves the output to a file on the Mac.
$ ssh lima-demo-test 'bash -s' < steps.sh 2>&1 | tee nginx.log
+ sudo apt-get install -y nginx
debconf: unable to initialize frontend: Dialog
debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.)
debconf: falling back to frontend: Readline
...
debconf: falling back to frontend: Noninteractive
Running kernel seems to be up-to-date (ABI upgrades are not detected).
No services need to be restarted.
...
+ systemctl is-active nginx
active
+ curl -sI http://localhost
+ head -1
HTTP/1.1 200 OK
When apt-get runs without a terminal, debconf prints many warnings about its frontend. These warnings make the result hard to read. For the next runs, set DEBIAN_FRONTEND=noninteractive.
export DEBIAN_FRONTEND=noninteractive
sudo -E apt-get install -y nginxClean up and compare
First, compare the package list with the baseline to find the new packages.
$ ssh lima-demo-test 'dpkg --get-selections | diff /tmp/before.txt -'
496a497,498
> nginx install
> nginx-common install
Remove these packages with purge and compare again. The package list and the unit list are the same as the baseline.
$ ssh lima-demo-test 'sudo DEBIAN_FRONTEND=noninteractive apt-get purge -y -qq nginx nginx-common > /dev/null && sudo DEBIAN_FRONTEND=noninteractive apt-get autoremove --purge -y -qq > /dev/null; echo rc=$?'
rc=0
$ ssh lima-demo-test 'dpkg --get-selections | diff /tmp/before.txt - && echo packages: same'
packages: same
$ ssh lima-demo-test 'systemctl list-unit-files --state=enabled --no-legend | sort | diff /tmp/units-before.txt - && echo units: same'
units: same
Files can stay even when the lists are the same. The nginx install script creates the default page in /var/www/html, so dpkg does not track it.
$ ssh lima-demo-test 'ls -la /var/www/html; dpkg -S /var/www/html'
total 12
drwxr-xr-x 2 root root 4096 Dec 5 23:13 .
drwxr-xr-x 3 root root 4096 Dec 5 23:13 ..
-rw-r--r-- 1 root root 615 Dec 5 23:13 index.nginx-debian.html
dpkg-query: no path found matching pattern /var/www/html
To find such files, use find -newer with the baseline file. This result is from a new clone, after another install and purge.
$ ssh lima-demo-test 'sudo find /etc /var/www /var/lib/systemd /usr/local /opt /home -xdev -newer /tmp/baseline'
/etc
/etc/systemd/system/multi-user.target.wants
/etc/rc3.d
...
/etc/default
/etc/rc0.d
/var/www
/var/www/html
/var/www/html/index.nginx-debian.html
/var/lib/systemd/deb-systemd-helper-enabled
/var/lib/systemd/deb-systemd-helper-enabled/multi-user.target.wants
Directories show in the list because removing entries changes their modification time. To see only the remaining files, add -type f. In this result, index.nginx-debian.html is the remaining file.
Delete the disposable VM
After you check the cleanup, delete the clone. Use the base VM again for the next test.
$ limactl stop demo-test
$ limactl delete demo-test
...
time="2026-12-05T23:14:12+09:00" level=info msg="Deleted `demo-test` (`/Volumes/Data/lima/demo-test`)"
$ limactl list demo-test
time="2026-12-05T23:14:12+09:00" level=warning msg="No instance matching demo-test found."
When you delete the clone, you do not need the cleanup in steps 3 to 5. But do the cleanup and comparison anyway. The result confirms the undo steps before you apply the change to a real system.
Checks before you record or share the result
| Item | How to find it | Action |
|---|---|---|
| VM name | lima- host name, prompt | In the procedure, show only the commands for the target system, without ssh |
| Architecture | arm64, aarch64, ports.ubuntu.com | If the target is amd64, run the commands again in an x86_64 VM |
set -x lines | Lines that start with + | Remove them if the procedure shows the commands separately |
| Warnings and progress | debconf warnings, progress bars | Run again with DEBIAN_FRONTEND=noninteractive and -qq |
| Omissions | Long output | Mark removed lines with .... Do not change values |
Cautions
- Do not edit output by hand. If a value is wrong, run the command again and use the new output.
- Do not use
limactl snapshotto roll back a vz VM. In Lima 2.3.0, it fails withunimplementedon vz. Snapshots support QEMU VMs. For vz VMs, use clones. - Do not clone a running VM. Stop the base VM with
limactl stopfirst. - Do not rely only on the
dpkg --get-selectionscomparison. Files and directories from install scripts are not in that list. Also check withfind -newer. - Do not estimate run times on the real system from the x86_64 VM. On Apple Silicon, it uses QEMU TCG emulation and is much slower than a real PC.
Summary
Verify in this sequence: clone the base VM, record the baseline, run and capture, clean up and compare, then delete. A clone takes less than one second, so start each verification in a new VM. You can use the cleanup result in the apply and undo procedures for the real system.
This is a referral link. I may receive credit if you sign up, at no extra cost to you.
Try it on a cloud server — Deploy Ubuntu on VultrReferences
- Lima: limactl clone
- Lima: Snapshots
- Lima: Intel-on-ARM and ARM-on-Intel
- dpkg-query(1) manual page
- debconf(7) manual page