While the PlayStation 4 (PS4) is a good gaming console, it isn't perfect. Sometimes you'll find yourself in a situation when you need to reinstall the system software. You need to reinstall the software if you plan to replace a hard drive, or if you're facing issues with games and menus slowing down, or if your console was on during a power outage. This is different from the usual system update procedure.
This how-to has two parts to it, the first is finding the right software update and the second needs the PS4 to boot in safe mode.
To do this to your PS4, you'll need a USB hard drive or a thumb drive (with around 1GB of free space) and a computer with Internet access.
Obtain the correct update
Download the PS4 firmware from this page on your PC, the link you're looking for is labelled as Download Now. This is not your usual system update that is around 300MB, rather, this is the entire software. To tell if you're downloading the right file, it's around 800MB. Even if you are on a fast connection, downloading it may take some time due to Sony's servers. The file name should be PS4UPDATE.PUP.
Plug the hard drive into your PC's USB port. Open it and create a new folder. Name it PS4. In PS4, create another folder. Name it UPDATE. Use exactly that name, in capital letters only, so it can be recognised by the PS4.
Copy the file to the UPDATE folder on your USB flash drive.
Put your PS4 in safe mode
Connect the USB to your PS4.
If your PS4 is on, switch it off. If the power indicator is lit up in orange (rest mode), hold the power button until you hear the system beep for a second time.
Your PS4 now boots up in safe mode. Select Initialize PS4 (Reinstall System Software).
Just follow the screens to complete the update, there are no further settings to choose.