macOS stuck on boot

Sometimes Apple insists of installing old Software updates which are no longer compatible with the 64-bit Sierra kernel.

The consists of rebooting the mac in recovery mode (command-R)

Then open the terminal utility.

List the disks connected to your system (The recovery boot will only mount the recovery volumes)

# diskutil list

This will list all volumes in your system.

Unlock the encrypted drive as follows:

# diskutil cs unlockVolume lvUUID

where lvUUID is the UUID of your boot volume.

This will decrypt and mount the volume.

Then change to the /Volumes/Macintosh HD/Library/Extensions directory and remove the kext directory corresponding to the kernel extension that makes the boot to fail.

rm -rf hp_io_enabler_compound.kext

Restart your system.

Unfortunately Apple will want to re-install the upgrade. So make sure to disable automatic updates.