iMac randomly shutting down and will not restart unless unplugged from mains
I have a 2017 27" iMac (3.8GHz Intel Core i5) that randomly turns itself off.
The screen goes blank and the machine is dead. It will not restart unless I unplug it from the mains, leave it for 30seconds or longer and then plug it in again.
The problem started a couple of months ago and does not appear to follow any pattern. Sometimes it will run for several days without shutting down but sometimes it can happen 2 or 3 times an hour.
I have searched the web and there are numerous accounts of a similar problem but no one seems to have come up with a cause or remedy apart from replacing the internals.
Has anyone here had the same issue and managed to resolve it?
iMac 27″ 5K, macOS 11.1