Chosen Solution

This iMac will restart at the login screen or before it. First thing I tried was to reformat the hard drive and reinstall the OS with no luck. Basic SMC reset, etc.. have been completed as well. Started with Apple Service Diagnostic (ASD) tests Memory: Passed. Also took out each module individually and still restarted. Hard Drive: Passed short test (long test was not completed). However, unlikely a hard drive issue. Computer will restart when booting off an external drive as well. Also pulled the HD while booting from external just to rule it out for sure. CPU: passed tests GPU: passed tests Thermal sensors: Passed loop test (10 times). Fan test: Fans passed tests (at all speeds) Does not boot in safe mode Opened the Mac up and cleaned a significant amount of dust out with air canister. The iMac will stay on during testing without fans on full speed. Checked the shutdown logs: kernel[0]: |Previous Shutdown Cause: -128 This is an unknown hardware error. Ram was checked and replaced with another set. Problem persisted. UPDATE The iMac will power on perfectly fine (without me having to make the fans spin full speed) as long as I have an external monitor attached. As soon as I unplug the monitor, the Mac will shutdown. This external monitor “fix” allowed me to check the temperatures with iStat and everything is perfect. It is definitely not thermal related. I am starting to suspect that maybe the integrated graphics have failed? Discrete graphics (Radeon) is being used while the external monitor is plugged in.

Lets do a SMC & NVRAM reset does that make a difference? Update (01/16/2018) Your system has two graphics states low res (Intel Graphics 3000) & hi res (Radeon HD 6770M or Radeon HD 6970M). The switching logic between the two graphic services appear to be in trouble here. Basically your system uses the low res until an OS calls for the higher res. When you add in a second display Hi res is used either in mirror mode or extended desktop mode.

I have exactly the same issue with my 27 inch iMac 2011. I connect a Apple LED Cinema Display and the moment I remove the usb and mini DV port the iMac reboots then goes into a rebooting cycle. As soon as you reconnect the led monitor the iMac reboots correctly and runs perfectly. It’s really strange. Did you ever get to the bottom of your issue?