dotnet/maui · error · Exception

Unsupported distro

Error message

Unsupported distro

What it means

main() raises a bare Exception('Unsupported distro') when --distro is neither 'ubuntu' nor 'debian' and no --mirror was supplied. The default-mirror selection logic only knows how to pick a mirror for those two distros; any other distro string without an explicit mirror cannot proceed.

Source

Thrown at eng/common/cross/install-debs.py:314

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Generate rootfs for .NET runtime on Debian-like OS")
    parser.add_argument("--distro", required=False, help="Distro name (e.g., debian, ubuntu, etc.)")
    parser.add_argument("--arch", required=True, help="Architecture (e.g., amd64, loong64, etc.)")
    parser.add_argument("--rootfsdir", required=True, help="Destination directory.")
    parser.add_argument('--suite', required=True, action='append', help='Specify one or more repository suites to collect index data.')
    parser.add_argument("--mirror", required=False, help="Mirror (e.g., http://ftp.debian.org/debian-ports etc.)")
    parser.add_argument("--artool", required=False, default="ar", help="ar tool to extract debs (e.g., ar, llvm-ar etc.)")
    parser.add_argument("packages", nargs="+", help="List of package names to be installed.")

    args = parser.parse_args()

    if args.mirror is None:
        if args.distro == "ubuntu":
            args.mirror = "http://archive.ubuntu.com/ubuntu" if args.arch in ["amd64", "i386"] else "http://ports.ubuntu.com/ubuntu-ports"
        elif args.distro == "debian":
            args.mirror = "http://ftp.debian.org/debian-ports"
        else:
            raise Exception("Unsupported distro")

    DESIRED_PACKAGES = args.packages + [ # base packages
        "dpkg",
        "busybox",
        "libc-bin",
        "base-files",
        "base-passwd",
        "debianutils"
    ]

    print(f"Creating rootfs. rootfsdir: {args.rootfsdir}, distro: {args.distro}, arch: {args.arch}, suites: {args.suite}, mirror: {args.mirror}")

    package_index_content = asyncio.run(download_package_index_parallel(args.mirror, args.arch, args.suite))

    packages_info, aliases = parse_package_index(package_index_content)

    with tempfile.TemporaryDirectory() as tmp_dir:
        install_packages(args.mirror, packages_info, aliases, tmp_dir, args.rootfsdir, args.artool, DESIRED_PACKAGES)

View on GitHub (pinned to f377ff1c5e)

Solutions

  1. Pass `--mirror http://your.mirror/path` explicitly when using a distro other than ubuntu/debian.
  2. Double-check the --distro spelling; only 'ubuntu' and 'debian' are recognized for auto-mirror.
  3. If you need a new distro, extend the conditional to map it to its default mirror.
  4. Ensure the script's package index URL layout matches your chosen mirror.

Example fix

# before
python install-debs.py --distro fedora --arch x86_64 --suite 39 <pkgs>

# after
python install-debs.py --distro fedora --arch x86_64 --suite 39 --mirror http://download.fedoraproject.org/pub/fedora/linux <pkgs>
Defensive patterns

Strategy: validation

Validate before calling

if args.distro not in ('ubuntu', 'debian') and args.mirror is None:
    raise Exception("Pass --mirror for unsupported distros")

Type guard

def needs_explicit_mirror(distro, mirror): return distro not in ('ubuntu','debian') and not mirror

Try / catch

try:
    main()
except Exception as e:
    if 'Unsupported distro' in str(e): print('Pass --mirror explicitly')

Prevention

When it happens

Trigger: Running install-debs.py with `--distro fedora` (or arch, alpine, etc.) and omitting --mirror. The conditional in main falls through to the else branch and aborts.

Common situations: Targeting a non-Debian-family distro, a typo in --distro, or testing a new distro without providing its mirror.

Related errors


AI-assisted analysis of dotnet/maui@f377ff1c5e (2026-08-13). Data as JSON: /api/errors/6424391c2a97e4f0. Report an issue: GitHub.