iMac shows frozen at bootup, but computer running normally in background
You can try to follow the steps described in HT1492:


Shut down your Mac if it is on.
Press the power button to start the computer.
Immediately press and hold Cmd-v for verbose mode.


This should give you some insight into where in the boot process the problem occurs. As you can still access the iMac via SSH it might be possible to fix it.

But as single-user boot seems to work without problems you might be better of with having a look at TS2570.