memstechtips/Winhance · error · FileNotFoundException

UEFI boot file not found: {efisysPath}

Error message

UEFI boot file not found: {efisysPath}

What it means

FileNotFoundException thrown during bootable ISO creation when efi\microsoft\boot\efisys.bin is missing from the working directory. efisys.bin is the UEFI El Torito boot image (the EFI System Partition fat image) embedded via the `#pEF,e,b` oscdimg segment; without it the ISO cannot boot under UEFI firmware.

Source

Thrown at src/Winhance.Infrastructure/Features/AdvancedTools/Services/IsoService.cs:311

            var requiredSpace = workingDirSize + (2L * 1024 * 1024 * 1024);

            await _dismProcessRunner.CheckDiskSpaceAsync(outputPath, requiredSpace, "ISO creation").ConfigureAwait(false);

            progress?.Report(new TaskProgressDetail
            {
                StatusText = _localization.GetString("Progress_CreatingBootableIso"),
                TerminalOutput = $"Output: {outputPath}"
            });

            var efisysPath = _fileSystemService.CombinePath(workingDirectory, "efi", "microsoft", "boot", "efisys.bin");
            var etfsbootPath = _fileSystemService.CombinePath(workingDirectory, "boot", "etfsboot.com");

            if (!_fileSystemService.FileExists(etfsbootPath))
                throw new FileNotFoundException($"Boot file not found: {etfsbootPath}");

            if (!_fileSystemService.FileExists(efisysPath))
                throw new FileNotFoundException($"UEFI boot file not found: {efisysPath}");

            var outputDir = _fileSystemService.GetDirectoryName(outputPath);
            if (!string.IsNullOrEmpty(outputDir) && !_fileSystemService.DirectoryExists(outputDir))
                _fileSystemService.CreateDirectory(outputDir);

            if (_fileSystemService.FileExists(outputPath))
            {
                _fileSystemService.DeleteFile(outputPath);
                _logService.LogInformation("Removed existing ISO file");
            }

            var arguments = $"-m -o -u2 -udfver102 -bootdata:2#p0,e,b\"{etfsbootPath}\"#pEF,e,b\"{efisysPath}\" \"{workingDirectory}\" \"{outputPath}\"";

            progress?.Report(new TaskProgressDetail
            {
                TerminalOutput = "Running oscdimg.exe...\nThis may take several minutes..."
            });

View on GitHub (pinned to f23d554eb2)

Solutions

  1. Confirm the source media has \efi\microsoft\boot\efisys.bin and re-stage including the whole \efi tree.
  2. Copy efisys.bin from a matching-architecture Windows ISO into <workingDirectory>/efi/microsoft/boot/.
  3. If you only need legacy boot, switch to a single-boot oscdimg command (drop the #pEF segment) instead of failing.
  4. For ARM64 builds, locate the correct efisys file for that architecture and point the command at it.
  5. Check antivirus quarantine for efisys.bin.

Example fix

// before
if (!_fileSystemService.FileExists(efisysPath))
    throw new FileNotFoundException($"UEFI boot file not found: {efisysPath}");

// after: fall back to a legacy-only bootable ISO when UEFI file is absent
var useUefi = _fileSystemService.FileExists(efisysPath);
var bootData = useUefi
    ? $"2#p0,e,b\"{etfsbootPath}\"#pEF,e,b\"{efisysPath}\""
    : $"1#pEF,e,b\"{etfsbootPath}\"";
Defensive patterns

Strategy: validation

Validate before calling

bool HasUefiBoot(string workingDirectory)
{
    var efisys = _fileSystemService.CombinePath(workingDirectory, "efi", "microsoft", "boot", "efisys.bin");
    return _fileSystemService.FileExists(efisys);
}

Try / catch

catch (System.IO.FileNotFoundException ex) when (ex.Message.Contains("efisys.bin"))
{
    // Offer the user a legacy-only ISO (drop the #pEF oscdimg segment) or re-stage including the \\efi tree.
}

Prevention

When it happens

Trigger: CreateBootableIsoAsync runs after staging, but efi\microsoft\boot\efisys.bin was not copied. Source media is a legacy-BIOS-only install, the EFI folder was excluded during staging, or the architecture (e.g. ARM64) uses a different efisys filename.

Common situations: Source media predates UEFI or is a custom WIM that dropped the efi tree. Staging step copied only \sources and \boot, omitting \efi. User targeted an ARM64/ARM64X build where the file is named efisys_*.bin. Antivirus flagged efisys.bin.

Related errors


AI-assisted analysis of memstechtips/Winhance@f23d554eb2 (2026-08-13). Data as JSON: /api/errors/6ea6e35513242e4c. Report an issue: GitHub.