sodcalculator

10 Tech How-To

Fix Windows Installation Failed in Safe OS Phase

Guide 10-20712 · Updated · Step by step

If Windows setup stops with an error during the Safe OS phase, the cause is almost always a driver, a corrupted installation file, or a hardware incompatibility that appears only while the system is applying the final boot configuration. The fix is to boot from the installation media, open Command Prompt from the repair options, and run a disk check, then either remove the problematic driver or perform a clean install after clearing the drive. Below are the exact steps and the context you need to resolve it without losing data if possible.

What the Safe OS Phase Actually Does

The Safe OS phase is the final stage of Windows setup, after files are copied and features are installed but before the first logon. During this phase, Windows applies the boot configuration, installs critical drivers, and prepares the system for the Out-of-Box Experience (OOBE). Errors here typically appear as a blue screen with a stop code, a dialog saying “Windows could not complete installation,” or a reboot loop that returns to the setup screen.

The phase is called “Safe OS” because the system is running in a minimal environment with only essential drivers loaded. That means a driver that works fine during earlier phases can fail here because the environment is stricter. Common stop codes at this stage include SYSTEM_THREAD_EXCEPTION_NOT_HANDLED, KERNEL_DATA_INPAGE_ERROR, and CRITICAL_PROCESS_DIED, but the exact code varies by hardware.

Step-by-Step Fix: Repair the Existing Installation

These steps assume you have a Windows installation USB or DVD and can boot from it. If you do not have one, create it on another PC using Microsoft’s Media Creation Tool. The goal is to fix the boot environment without erasing your files.

  1. Boot from the installation media. When the Windows Setup screen appears, click Next, then click Repair your computer in the bottom-left corner.
  2. Choose Troubleshoot > Advanced options > Command Prompt.
  3. Run diskpart, then type list volume to identify the drive letter of your Windows partition. It may not be C: in this environment. Note the letter (e.g., D:).
  4. Exit diskpart by typing exit.
  5. Run sfc /scannow /offbootdir=D:\ /offwindir=D:\Windows (replace D: with your actual drive letter). This checks system files for corruption.
  6. Run chkdsk D: /f /r. This scans the disk for bad sectors and file system errors. It may take a long time on large drives.
  7. Reboot and try the installation again. If the error persists, continue to the driver removal steps below.

If the repair commands report errors they cannot fix, the installation files themselves may be corrupted. In that case, skip to the clean install section.

Removing the Problematic Driver

When the Safe OS phase fails right after loading a specific driver, you can often identify it from the stop code or the file name on the blue screen. Common culprits are storage drivers (NVMe, RAID), graphics drivers, and network drivers. To remove a driver from the repair environment:

  1. Open Command Prompt as described above.
  2. Run dism /image:D:\ /get-drivers to list all drivers in the offline Windows image. Look for the driver that matches the file name from the error, or the most recently added third-party driver.
  3. Note the Published Name (e.g., oem0.inf).
  4. Run dism /image:D:\ /remove-driver /driver:oem0.inf to remove it.
  5. Reboot and attempt the installation again.

If you cannot identify the driver, remove all third-party drivers (oem*.inf) that are not from Microsoft. This is safe because Windows will reinstall generic drivers during the first boot. To remove all at once, you can use a loop in Command Prompt, but it is easier to remove them one by one if the list is short.

When to Do a Clean Install

If the repair and driver removal do not work, the installation media or the disk itself is likely the problem. A clean install erases everything on the drive, so back up any important files first. If you cannot boot into Windows to back up, you can use a Linux live USB to copy files to an external drive.

  1. Boot from the installation media and start the setup normally.
  2. When you reach the screen asking “Which type of installation do you want?”, choose Custom: Install Windows only (advanced).
  3. Select each partition on the drive that contains the old Windows installation and click Delete. This removes all partitions. If the drive has multiple partitions (EFI, MSR, Recovery), delete them all.
  4. Select the unallocated space and click Next. Windows will create the necessary partitions automatically.

If the clean install also fails at the Safe OS phase, the problem is almost certainly hardware-related: a failing hard drive, incompatible RAM, or a motherboard BIOS setting. Test your RAM with Windows Memory Diagnostic (run mdsched.exe from a working PC) and check the drive’s SMART status with a tool like CrystalDiskInfo.

Common Causes and How to Avoid Them

  • Corrupted installation media: A USB drive that was unplugged during creation or has bad sectors. Recreate the media with the Media Creation Tool and use a different USB port (preferably USB 2.0).
  • Outdated BIOS/UEFI: Some older BIOS versions have bugs that affect Windows setup. Check your motherboard manufacturer’s website for a BIOS update, but only apply it if your system is stable enough to do so.
  • Incompatible drivers: If you slipstreamed drivers into the installation media (e.g., with NTLite), remove them and try with stock Windows.
  • Insufficient disk space: Windows needs at least 20 GB for 64-bit, but the Safe OS phase can require extra temporary space. Ensure you have at least 30 GB free.
  • Overclocking: An unstable CPU or RAM overclock can cause random failures during installation. Reset BIOS to default settings before installing.

What to Do If You See “Windows Cannot Install Required Files”

This message often appears during the Safe OS phase and means the setup cannot copy or verify a file. It is usually due to a bad USB drive or a failing hard drive. First, try a different USB port, then recreate the installation media. If the error persists, run chkdsk on the target drive and check its SMART status. If the drive is failing, replace it before attempting installation again.

Frequently Asked Questions

Will I lose my files if I use the repair option?

No. The repair option (Startup Repair or Command Prompt commands) does not touch your personal files. It only fixes system files and boot configuration. However, if you proceed to a clean install, everything on the drive is erased. Always back up before any major repair.

Can I skip the Safe OS phase?

No. It is an integral part of Windows setup. There is no supported way to skip it. If it fails, you must fix the underlying cause.

Why does the error happen only on a new SSD?

New SSDs, especially NVMe models, may require a driver that Windows setup does not have. Download the manufacturer’s NVMe driver, put it on a USB drive, and load it during setup by clicking “Load driver” when selecting the disk. Also, ensure your BIOS is set to AHCI mode, not RAID, unless you actually have a RAID array.

Is it safe to delete all partitions during a clean install?

Yes, but only if you are certain you do not need any data on the drive. Deleting partitions removes all data, including recovery partitions. If you have a laptop with a recovery partition, you may lose the ability to restore the original factory state. Back up any data you need before deleting.

What does the stop code “INACCESSIBLE_BOOT_DEVICE” mean?

It means Windows cannot access the drive that contains the boot files. This is common after a failed Safe OS phase. It usually indicates a storage driver issue or a faulty drive. Boot from installation media, open Command Prompt, and run bootrec /fixmbr, bootrec /fixboot, and bootrec /rebuildbcd. If that does not work, check the drive’s connection and try a different SATA port or M.2 slot.

Should I use a 32-bit or 64-bit installation?

If your PC has more than 4 GB of RAM, use 64-bit. Most modern PCs are 64-bit. Using 32-bit on a 64-bit system is possible but limits RAM and driver support. The Safe OS phase is identical for both, but 64-bit is the standard for new installations.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →