Remote into Mac Mini after a reboot

How can a Mac running El Capitan always be ready for a VNC connection even after a reboot?

I can vnc into the Mac with no problem but when I reboot the Mac remotely I can't vnc back in. Someone has to hook up a keyboard to the Mac and physically log in and log back out. Once the machine has been logged in locally I can once again log in remotely via Mac.

I'm using the Mac's built-in VNC as well as an installed RealVNC server. Neither will respond after a reboot.

I edited the RealVNC launch daemon to run at load but that didn't work.

UPDATE

The mac has filevault turned on. 'sudo fdesetup authrestart' will work with a manual reboot. It will not work however with a forced system reboot or a power outage. Someone would still need to manually login with a keyboard in those cases.

The options at this point seem to be to disable Filevault or accept the fact that a person will need to login occasionally.


Solution 1:

Apple supports this out of the box. Under the Sharing preference pane you need to enable either the Screen Sharing or the Remote Management and then use the Computer Settings dialog to enable VNC.

enter image description here

The service starts up automatically when incoming network traffic on the VNC ports is detected by the OS. Now, you do need to get past any FileVault pre-login screen where the full actual OS isn't running yet. To restart and skip FileVault one time, use:

fdesetup authrestart

You might need to watch for DHCP traffic and see if the Mac is rejoining the network and asking for an address from the router if you can't find the machine on reboot. For troubleshooting, you could assign a static IP address so that you're sure it's not a DHCP issue.

The problem also could be your choice of VNC client and it's not expecting to connect to OS X Lion or newer. Some older clients break when Apple allows a choice to connect to the logged in user or a new login window. The client needs to reconnect once the session drops to log you in.

  • Are the changes to Lion's screen sharing documented anywhere publicly?
  • RealVNC on Lion

One client I like on iOS and Mac OS X is http://edovia.com/screens/ Of course Apple's free Screen Sharing app (look for it in /System/Library/CoreServices/Applications ) and Apple Remote Desktop work well, too.

Solution 2:

VNC is tricky to use on a headless system. The way it works is that it queries the display server to get the settings so VNC can send those settings to the viewer. If nothing is connected, no parameters are sent and thus the viewer has no idea what to display. This is why I am not a fan of VNC or ARD and will only use it if I absolutely have to (95% of everything I do on headless systems is in Terminal, so this doesn't come up very often for me)

This is why you have to hook up a monitor to get screen sharing to work again. If you leave the monitor attached, VNC will work with no problems across reboots

Trick OS X into Thinking a Display is Still Attached

The easiest thing I have seen that solves this problem is getting a Dummy Display Emulator. It's clean, it's easy, and it works out the box. What it does is make OS X think a monitor is still plugged into the display so whatever settings you have configured for that "monitor" will be sent to the VNC viewer.

enter image description here

You can make your own but to me, this is not safe and very sloppy for a permanent installation. I included this option both for reference to see what is being done here (how easy it is) and to provide another option if you are in a pinch. Again, I am not a fan of this DIY hack because it's not clean and if you don't have the mDP to VGA adapter or the resistor you will have to purchase them anyway and you might only save a couple of bucks over the commercial product.

You could read the linked blog on how to do this, but the picture below alone should tell you what to do, what Apple display adapter you need, and what resistor to buy based on its color codes.

enter image description here