Unfreeze a frozen osx UI using ssh without shutting down all applications?

19

11

My mac freezes occasionally, and most often I simply restart it by holding down the power button for 5+ seconds.

Today however, I had been running a huge file scan for 14 hours when the UI froze completely, and I’d rather not wait another 14 hours!

Symptoms of the frozen UI: Nothing happens when using the keyboard (except for the caps lock light turning on/off). Naturally, force quit does not come up. Moving the mouse moves the cursor on the screen but clicking does nothing.

Using another Mac on the network, I can access the mac by SSH. I saw that the RAM was almost full, but CPU activity was modest. Things I tried to unfreeze the mac:

  1. Shut down / kill Chrome, iMovie, Photoshop and other applications that I didn't care about shutting down. Did help the RAM usage down, but did not help in unfreezing the mac.

  2. Shut down the Finder and Dock processes. No help.

  3. Activated Screen Sharing from the command line and tried connecting remotely. The password dialog comes up (indicating that screen sharing indeed is activated) but after supplying password, the progress indicator just spins for eternity and nothing happens.

  4. Tried suspending the user session from the command line:

/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend

This command just hangs in the SSH session and nothing happens. Needs to be aborted using ctrl+c. Using sudo makes the command return immediately without any effect.

Not even killing WindowServer (sudo killall -HUP WindowServer) helped, and running a graceful restart (sudo shutdown -r now) only made the computer freeze completely (no more cursor movements nor ssh access). Only the power button force shut-off worked.

Had to wait another 14 hours for the file scan to run again. Is there any other way to unfreeze a mac in this state? Would be good to know for future reference…

Motin

Posted 2013-08-18T14:02:25.747

Reputation: 975

Would anything weird show up in sudo dmesg ? For me, I was seeing **** [IOBluetoothHCIController][SearchForTransportEventTimeOutHandler] -- Missing Bluetooth Controller Transport! and then I messed with a few things, it started working again, and I'd see: **** [IOBluetoothHCIController][protectedBluetoothHCIControllerTransportShowsUp] -- Connected to the transport successfully -- 0xe7c0 -- 0xd000 -- 0xc000 ****. Relationship unconfirmed. – Joseph Lennox – 2014-11-10T20:24:18.173

@JosephLennox This question and related thread are about 1 year old. If you need help, please start your own question providing your specific details and perhaps link to this question as something similar you faced. – JakeGould – 2014-11-26T05:05:49.533

Had the exact experience on Sierra 10.12. The only thing I'd add to your list to check less /var/log/system.log to see if you can spot the issue there. I saw com.apple.DumpGPURestart, but there was nothing I could do about it except hold down the power button for 5+ seconds. – wisbucky – 2019-07-17T22:08:55.943

1I've had the exact same problem right now, with the exact same outcome for all the things you've tried. Thank you for the detailed reporting. I would love to have suggestions on what to do in these situations. – rahmu – 2014-06-11T21:48:08.593

Answers

3

I used to deal with this type of situation occasionally, and when it's a general UI freeze, not one particular window being unresponsive, then there's nothing I've found (no process you can kill) that can deal with the problem, other than killing WindowServer. That should cause the session to be logged out.

However, in this particular case, since killing WindowServer didn't return the system to a usable state, I suspect it was doomed anyway.

With regard to the best possible recovery, one thing to note is that it may be possible to cleanly shut down individual applications from SSH:

osascript -e 'tell application "TextEdit" to quit'

Normal GUI applications will not save their files etc. when killed, but will when given this quit event. Of course, if the application pops up a dialog when you tell it to quit, this doesn't help. And if osascript itself hangs, then the Apple Event dispatch system is hung...

Kevin Reid

Posted 2013-08-18T14:02:25.747

Reputation: 2 854

0

I have this problem on a regular basis. Seems to be related to my ATI Radeon 4850 not being OK. I disabled the graphics acceleration by moving the drivers out of the way, but still have this problem intermittently. Sometimes killing the Loginwindow via ssh works. Sometimes this takes minutes or even more and then suddenly works. I also had times when the system responds normally after the screen saver kicked in. Moved my mouse, screen saver stops and system works normally after that. For this I decreased the time for the screensaver to start.

Bjinse

Posted 2013-08-18T14:02:25.747

Reputation: 101

-1

Ok, I had a similar sounding problem (keyboard commands worked, mouse moved, couldn't click anything on the UI) and found a solution.

My Bluetooth SmartMouse was in my backpack squeezed in amongst other things. I took it out of the bag and all is now working!

Apparently having a mouse down click blocked all other mouse clicks. Doh!

Mouse Click Guy 1432432

Posted 2013-08-18T14:02:25.747

Reputation: 1