To help others here is exactly the problem how we resolved and what to look out for with the Azure VMSnaptop. There is also on GitHub Azure which reports this same problem. This would be used to get out of the stuck situation. As noted, this problem prevents the "run command" from working with PowerShell scripts.
OBSERVED
- VMSnapshotLinux 1.0.9225.0 fails on Debian 13 (Python 3.13.5): missing distutils/imp;
- Extension stuck "Transitioning", Run Command blocked
Environment
- Azure Linux VM, Debian 13 (trixie), Python 3.13.5, South Central US
- WALinuxAgent 2.12.0.2 (Debian package), self-updated to goal-state agent 2.16.0.2
- Extension: Microsoft.Azure.RecoveryServices.VMSnapshotLinux 1.0.9225.0 (config sequence 18)
- No Recovery Services vault protected the VM, and az vm extension list showed no extensions
Symptoms
Extension status stuck at Transitioning. The portal and CLI showed no ARM-visible extensions, and the Backup page only offered "Enable backup."
waagent logged every 30 minutes: no status file was reported by extension Microsoft.Azure.RecoveryServices.VMSnapshotLinux ... status/18.status does not exist.
The handler was re-run on each new goal state or agent restart and failed each time, exit code 1, with ModuleNotFoundError: No module named 'distutils', then No module named 'imp' (from WAAgentUtil.py, HandlerUtil.py, DiskUtil.py).
- Run Command (Invoke-AzVMRunCommand) failed while the extension state was pending.
Cause
- Python 3.12 removed distutils and imp from the standard library, and 3.13 removed crypt. The 1.0.9225.0 handler imports them, so its enable step crashes before it can write a status file.
Fix
- No backup enabled, nothing under /var/lib/waagent edited)
sudo apt install python3-setuptools python3-zombie-imp python3-crypt-r
python3 -c "import distutils, imp, crypt; print('ok')"
sudo systemctl restart walinuxagent
After the restart the agent logged Extension status: VMSnapshotLinux 'success' and All extensions in the goal state have reached a terminal state. Get-AzVM -Status showed the handler as Ready / Plugin enabled, and Run Command worked again.
Versions / Notes
Failed: 1.0.9225.0 on Python 3.13.5. Others report 1.0.9231.0 failing on the same imports on Ubuntu 26.04 with Python 3.14.
Newer build: on a fresh install, Azure Backup installed 1.0.9232.0. Its source wraps crypt, distutils and imp in try/except ImportError with fallbacks (a legacycrypt alternative, a built-in LooseVersion shim, and importlib for imp). It installed and enabled cleanly on Debian 13 / Python 3.13.5, and the Take Snapshot step completed.
Caveat: the shim packages were installed on that machine before the backup, so I could not confirm whether 1.0.9232.0 works without them. Result of the full backup job: [fill in: completed / failed].
Workaround for others: on Debian 13 or any Python 3.12+ system, install the three packages above before enabling Azure Backup.