memstechtips/Winhance · error · FileNotFoundException
Boot file not found: {etfsbootPath}
Error message
Boot file not found: {etfsbootPath} What it means
FileNotFoundException thrown during bootable ISO creation when boot\etfsboot.com is absent from the staged working directory. etfsboot.com is the BIOS/legacy El Torito boot sector that oscdimg embeds via the `#p0,e,b` segment; without it the resulting ISO cannot boot in legacy/CSM mode.
Source
Thrown at src/Winhance.Infrastructure/Features/AdvancedTools/Services/IsoService.cs:308
var workingDirSize = _fileSystemService.GetFiles(workingDirectory, "*", SearchOption.AllDirectories)
.Sum(f => _fileSystemService.GetFileSize(f));
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
{
View on GitHub (pinned to f23d554eb2)
Solutions
- Verify the source media actually contains \boot\etfsboot.com before staging; if missing, obtain complete Windows install media.
- Re-run the file-staging step that populates the working directory and confirm it copies the entire \boot folder recursively.
- Add etfsboot.com from a known-good Windows ISO (same build) into <workingDirectory>/boot/ manually, then retry ISO creation.
- If the source only supports UEFI booting, use a single-boot oscdimg command line without the #p0 legacy segment instead of failing.
- Check antivirus quarantine/history and add the staging folder as an exclusion.
Example fix
// before: hard fail if legacy boot sector absent, even on UEFI-only targets
if (!_fileSystemService.FileExists(etfsbootPath))
throw new FileNotFoundException($"Boot file not found: {etfsbootPath}");
// after: report which boot files are present so the user can choose a boot mode
var haveLegacy = _fileSystemService.FileExists(etfsbootPath);
var haveUefi = _fileSystemService.FileExists(efisysPath);
if (!haveLegacy && !haveUefi)
throw new FileNotFoundException("No boot files found in working directory (missing both boot\\etfsboot.com and efi\\microsoft\\boot\\efisys.bin)."); Defensive patterns
Strategy: validation
Validate before calling
// Before calling CreateBootableIsoAsync, verify the staged tree has the legacy boot file.
bool HasLegacyBoot(string workingDirectory)
{
var etfsbootPath = _fileSystemService.CombinePath(workingDirectory, "boot", "etfsboot.com");
return _fileSystemService.FileExists(etfsbootPath);
} Try / catch
catch (System.IO.FileNotFoundException ex) when (ex.Message.Contains("etfsboot.com"))
{
// Prompt user: source media lacks BIOS boot sector; offer UEFI-only ISO or re-stage from complete media.
} Prevention
- Stage install media fully (entire \\boot tree) before ISO creation.
- Use complete, unmodified Windows ISOs as the source.
- Validate the staged tree contains \boot\etfsboot.com and \efi\microsoft\boot\efisys.bin before invoking oscdimg.
When it happens
Trigger: CreateBootableIsoAsync (or equivalent) is called after the source media was staged, but the staging step did not copy the \boot\etfsboot.com file. The source ISO/install was a non-standard edition, an ESD converted to WIM without preserving the boot folder, or the working directory was partially cleared before this run.
Common situations: Source install media is a modern ESD-based build where the legacy boot sector was stripped. A prior step that copies files into the working directory was interrupted or skipped the boot folder. The working directory path differs from the one populated upstream. An antivirus quarantined etfsboot.com as a suspicious boot file.
Related errors
- UEFI boot file not found: {efisysPath}
- Could not delete the existing working directory '{workingDir
- oscdimg.exe failed with exit code: {exitCode}
- DISM failed with exit code: {exitCode}
- Insufficient disk space on {driveName} for {operationName}.
AI-assisted analysis of memstechtips/Winhance@f23d554eb2 (2026-08-13).
Data as JSON: /api/errors/a97f14c9c1be7a60.
Report an issue: GitHub.