Lxd-imagebuilder repack a custom windows image

Ubuntu Support Template

Ubuntu Version:
22.04.4 LTS

Desktop Environment (if applicable):
na

Problem Description:
After calling lxd-imagebuilder on my custom Windows image I get error:
Error: Failed to generate ISO: exit status 255

I have a Windows 2025 Server image that I have captured using Windows ADK and WinPE. I can install this image using Hyper-V and VMWare. I would like to use LXD hosted on Ubuntu.

When I try to repack my custom iso with command:
sudo lxd-imagebuilder repack-windows my_custom.iso my_custom_packed.iso --windows-arch=amd64 --windows-version=2k22

I get error:
Error: Failed to generate ISO: exit status 255
(full output below)

Relevant System Information:
lxd-imagebuilder version 3.0

Screenshots or Error Messages:
thisisme@thisisme-VMware20-1:~$ sudo lxd-imagebuilder repack-windows my_custom.iso my_custom_packed.iso --windows-arch=amd64 --windows-version=2k22
INFO [2026-03-30T11:18:54+11:00] Mounting Windows ISO to dir: “/var/cache/lxd-imagebuilder.1452375362/source”
INFO [2026-03-30T11:18:54+11:00] Mounting driver ISO to dir “/var/cache/lxd-imagebuilder.1452375362/drivers”
INFO [2026-03-30T11:18:55+11:00] Mounting idx=“1:Microsoft Windows PE (amd64)” wim=boot.wim
INFO [2026-03-30T11:18:55+11:00] Modifying idx=“1:Microsoft Windows PE (amd64)” wim=boot.wim
INFO [2026-03-30T11:18:55+11:00] Unmounting idx=“1:Microsoft Windows PE (amd64)” wim=boot.wim
Committing changes to /var/cache/lxd-imagebuilder.1452375362/overlay/sources/boot.wim (image 1)
Using LZX compression with 16 threads
Archiving file data: 19 MiB of 19 MiB (100%) done
INFO [2026-03-30T11:19:00+11:00] Mounting idx=“1:My Custom Install” wim=install.wim
INFO [2026-03-30T11:19:00+11:00] Modifying idx=“1:My Custom Install” wim=install.wim
INFO [2026-03-30T11:19:02+11:00] Unmounting idx=“1:My Custom Install” wim=install.wim
Committing changes to /var/cache/lxd-imagebuilder.1452375362/overlay/sources/install.wim (image 1)
Using LZX compression with 16 threads
Archiving file data: 119 MiB of 119 MiB (100%) done
Calculating integrity table for WIM: 17 GiB of 17 GiB (100%) done
INFO [2026-03-30T11:21:01+11:00] Generating new ISO
INFO [2026-03-30T11:21:01+11:00] Umount dir “/var/cache/lxd-imagebuilder.1452375362/drivers” dir=/var/cache/lxd-imagebuilder.1452375362/drivers
INFO [2026-03-30T11:21:01+11:00] Umount dir “/var/cache/lxd-imagebuilder.1452375362/source” dir=/var/cache/lxd-imagebuilder.1452375362/source
Error: Failed to generate ISO: exit status 255
ERROR [2026-03-30T11:21:02+11:00] Failed running imagebuilder err=“Failed to generate ISO: exit status 255”
INFO [2026-03-30T11:21:02+11:00] Removing cache directory

What I’ve Tried:
I have tried injecting the drivers directly into my install.wim and boot.wim from virtio without success
Dism /Image:$winPEMount /Add-Driver /Driver:"$virtioPath” /Recurse /ForceUnsigned

Before Posting:
By the look of things no one has had this issue before

2 Likes

I have also tried using a custom Windows 2022 image with the same error

Looking at your log, the error happens at the “Generating new ISO” stage. Your install.wim is 17 GiB, which is huge for a standard ISO task.

Two things you should check:

Disk Space: lxd-imagebuilder creates a temporary cache in /var/cache. With a 17 GiB WIM, you need at least 40-50 GB of free space on that partition to handle the extracted files + the new ISO creation. If /var is full, it will crash with exit 255.

Fix: Use a different partition for cache: --cache-dir /path/to/large/disk

Large File Support: Standard ISO9660 has a 4GB file limit. Ensure you have xorriso installed so the tool can correctly use UDF for that 17 GiB file.

sudo apt update && sudo apt install xorriso

Try running with --debug at the end. It will show the exact xorriso command that’s failing, which usually confirms if it’s a “disk full” or “file too large” issue.

One more thing: Since you’re using Windows Server 2025 with a 2k22 profile, it should work, but the 17 GiB size is the most likely culprit for that specific exit code.

If this is a custom ISO (e.g. built from ADK), it might also be worth checking the layout, since lxd-imagebuilder can be picky about standard Windows installer structure.