Fix stock recovery of HP Spectre x360 laptop

By | 27 May 2022

When I got my Spectre x360 back in 2016, I booted it into the Windows 10 it came with, played a bit around and then decided to put Linux on it. So I took a backup of all partitions, repartitioned the whole SSD and went on with Linux. Of course, I found a way to install BIOS updates which I regularly did.

Now came the time to sell the machine so I restored my backup to have to original state from back then. To give the buyer a better experience, I wanted to restore it to its factory state using the now restored recovery partition. The recovery process started up just fine and prepared the main partition and started doing things … until it failed with a strange error message. Trying it over and over again, it always failed at the same step after completely installing the Windows operating system, not very far into installing the OEM software.

When it fails, it gives three buttons: Save log, Details and Try again. Reading the log from the end backwards, it failed at a step trying to install \SW\P00LVM.B2G\SWSETUP\APP\Diagnostic\AMI\Pike1.xPr_LLVMB2\F.2E\install.cmd which turns out is a BIOS update.

However, during the time I’ve used the laptop, I’ve updated the BIOS several times and it was now at version F54 Rev. A dated January 2020. The version it tried to install from the stock recovery partition was F2 Rev. E from December 2015. This would be a massive downgrade, potentially even breaking the machine, and thus the updater denied flashing that ancient version. Which flagged up as an error and aborted the restore process for some reason.

There wasn’t an updated Recovery available from HP’s Cloud Recovery for my product ID K3D43EA#ABD. So I had to somehow get this to work on my own.

My first idea was to modify the recovery in itself. So I unpacked all the *.swm files found on the recovery partition (which I copied to a USB stick), changed the install.cmd to not do anything and tried to recompress the file structure back into SWM1Split Windows IMage files. After running the modified recovery again, it looks like it could work first, but then the unpacking/copying process stopped at 80% – before it even started the actual recovery process – because it didn’t like my modification. I looked like there was some kind of checksum verification or something like that which noticed that I modified that one file.

So the next logical step was to go back to the original files and apply my modification after the preparation but before the actual restoration process starts. Fortunately, there’s a step where it asks to reboot to continue the recovery process – and that step is just after copying all files to the system partition but before starting anything.

I used my trusty Ventoy USB which also contains the SysRescCD image and instead of letting the laptop boot into the prepared system partition, booted into SystemRescueCD.

From there, I was able to mount the local system partition (what Windows knows as C: or /dev/sda1 in Linux), cd into \SW\P00LVM.B2G\SWSETUP\APP\Diagnostic\AMI\Pike1.xPr_LLVMB2\F.2E and edit the install.cmd there.

I changed the line "0804FF2E.exe" /cpf – which is running the BIOS updater – to REM "0804FF2E.exe" /cpf to skip that line. I also changed the last 2 lines in that file from:

IF %ERRORLEVEL% EQU 0 ERASE /F /Q FAILURE.FLG
IF %ERRORLEVEL% EQU 3010 ERASE /F /Q FAILURE.FLG

to just

ERASE /F /Q FAILURE.FLG

to erase any error flag – just in case.

After saving the modified file, I rebooted and removed the Ventoy USB. The recovery process continued and finished without any errors this time. Success!

(I’ve also documented this process on Reddit.)

  • 1
    Split Windows IMage

Leave a Reply