Unable to boot after installing nvidia-387, elementaryOS (Ubuntu 16.04), GTX 1050

My display came up as unclaimed when running

lshw -class display

So I installed nvidia-387 by addding the graphic-drivers ppa, and running

sudo apt install nvidia-387

I did this so I could get HDMI support for an external monitor, but no luck. The card no longer came up as unclaimed but the configuration said:

configuration: driver=nouveau latency=0

To fix this I blacklisted nouveau by following the steps explained in this Stack Exchange answer: HDMI completely broken in Loki? - elementary OS Stack Exchange

This resulted in a black screen at boot, I can Ctrl+F1 to a text terminal, and if I check the configuration, the nvidia driver correctly shows up.
If I run xrander, I get a “Can’t open display” message.

Attached is the nvidia-report-log

nvidia-bug-report.log.gz (104 KB)

Everything seems to be fine, yet the modesetting driver is not kicking in. Delete the file
and retry.

This solved it, thanks!