{"record":{"id":"6ea6e35513242e4c","repo":"memstechtips/Winhance","slug":"uefi-boot-file-not-found-efisyspath","errorCode":null,"errorMessage":"UEFI boot file not found: {efisysPath}","messagePattern":"UEFI boot file not found: (.+?)","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"src/Winhance.Infrastructure/Features/AdvancedTools/Services/IsoService.cs","lineNumber":311,"sourceCode":"\r\n            var requiredSpace = workingDirSize + (2L * 1024 * 1024 * 1024);\r\n\r\n            await _dismProcessRunner.CheckDiskSpaceAsync(outputPath, requiredSpace, \"ISO creation\").ConfigureAwait(false);\r\n\r\n            progress?.Report(new TaskProgressDetail\r\n            {\r\n                StatusText = _localization.GetString(\"Progress_CreatingBootableIso\"),\r\n                TerminalOutput = $\"Output: {outputPath}\"\r\n            });\r\n\r\n            var efisysPath = _fileSystemService.CombinePath(workingDirectory, \"efi\", \"microsoft\", \"boot\", \"efisys.bin\");\r\n            var etfsbootPath = _fileSystemService.CombinePath(workingDirectory, \"boot\", \"etfsboot.com\");\r\n\r\n            if (!_fileSystemService.FileExists(etfsbootPath))\r\n                throw new FileNotFoundException($\"Boot file not found: {etfsbootPath}\");\r\n\r\n            if (!_fileSystemService.FileExists(efisysPath))\r\n                throw new FileNotFoundException($\"UEFI boot file not found: {efisysPath}\");\r\n\r\n            var outputDir = _fileSystemService.GetDirectoryName(outputPath);\r\n            if (!string.IsNullOrEmpty(outputDir) && !_fileSystemService.DirectoryExists(outputDir))\r\n                _fileSystemService.CreateDirectory(outputDir);\r\n\r\n            if (_fileSystemService.FileExists(outputPath))\r\n            {\r\n                _fileSystemService.DeleteFile(outputPath);\r\n                _logService.LogInformation(\"Removed existing ISO file\");\r\n            }\r\n\r\n            var arguments = $\"-m -o -u2 -udfver102 -bootdata:2#p0,e,b\\\"{etfsbootPath}\\\"#pEF,e,b\\\"{efisysPath}\\\" \\\"{workingDirectory}\\\" \\\"{outputPath}\\\"\";\r\n\r\n            progress?.Report(new TaskProgressDetail\r\n            {\r\n                TerminalOutput = \"Running oscdimg.exe...\\nThis may take several minutes...\"\r\n            });\r\n\r","sourceCodeStart":293,"sourceCodeEnd":329,"githubUrl":"https://github.com/memstechtips/Winhance/blob/f23d554eb2d6400b1827bcc46b91294ffa53fbc9/src/Winhance.Infrastructure/Features/AdvancedTools/Services/IsoService.cs#L293-L329","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Confirm the source media has \\efi\\microsoft\\boot\\efisys.bin and re-stage including the whole \\efi tree.","Copy efisys.bin from a matching-architecture Windows ISO into <workingDirectory>/efi/microsoft/boot/.","If you only need legacy boot, switch to a single-boot oscdimg command (drop the #pEF segment) instead of failing.","For ARM64 builds, locate the correct efisys file for that architecture and point the command at it.","Check antivirus quarantine for efisys.bin."],"exampleFix":"// before\nif (!_fileSystemService.FileExists(efisysPath))\n    throw new FileNotFoundException($\"UEFI boot file not found: {efisysPath}\");\n\n// after: fall back to a legacy-only bootable ISO when UEFI file is absent\nvar useUefi = _fileSystemService.FileExists(efisysPath);\nvar bootData = useUefi\n    ? $\"2#p0,e,b\\\"{etfsbootPath}\\\"#pEF,e,b\\\"{efisysPath}\\\"\"\n    : $\"1#pEF,e,b\\\"{etfsbootPath}\\\"\";","handlingStrategy":"validation","validationCode":"bool HasUefiBoot(string workingDirectory)\n{\n    var efisys = _fileSystemService.CombinePath(workingDirectory, \"efi\", \"microsoft\", \"boot\", \"efisys.bin\");\n    return _fileSystemService.FileExists(efisys);\n}","typeGuard":null,"tryCatchPattern":"catch (System.IO.FileNotFoundException ex) when (ex.Message.Contains(\"efisys.bin\"))\n{\n    // Offer the user a legacy-only ISO (drop the #pEF oscdimg segment) or re-stage including the \\\\efi tree.\n}","preventionTips":["Copy the entire source \\efi tree into the working directory during staging.","For ARM64 builds, locate the architecture-appropriate efisys file rather than assuming efisys.bin.","Add the staging folder to antivirus exclusions so efisys.bin is not quarantined."],"tags":["filesystem","iso","boot","uefi","windows","media"],"backgroundTag":null,"analyzedSha":"f23d554eb2d6400b1827bcc46b91294ffa53fbc9","analyzedAt":"2026-08-13T17:55:20.922Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}