11

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.

  • What version of mac mini is it? – Mark Apr 5 '16 at 13:32
  • el capitan. Its a new mac mini. – coder Apr 5 '16 at 13:33
  • You can set up the Mac to automatically login to a user account at startup. Would this be a OK solution? – David Anderson Apr 5 '16 at 13:42
  • Let me try and see if that works – coder Apr 5 '16 at 13:45
  • 1
    After looking into setting up auto login I noticed filevault was turned on. The solution seems to be to reboot with sudo fdesetup authrestart. superuser.com/questions/1024687/… – coder Apr 5 '16 at 15:05
9

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.

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.

  • Thanks @Édouard - I've added two Apple options as well as the edovia third party program – bmike Apr 5 '16 at 17:00
6

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 it makes 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 and, what Apple display adapter you need, and what resistor to buy based on its color codes.

enter image description here

  • 3
    I love the resistor image. Well done +1 and some more good karma. Also, Apple officially supports headless mode on Mac Mini - so you can file bug reports if you find a case where you can't manage a headless mini without needing a dongle or adapter. I've never needed those unless you want a different initial screen resolution based on "detecting" a connected screen. – bmike Apr 5 '16 at 15:11
  • You don't need the VGA cable though. Just plug the resistor between pins C2 and C5 in the DVI directly. apple.stackexchange.com/a/352101/40801 – Prof. Falken Feb 22 at 7:51
2

The solution to the problem ended up being three-fold.

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.

  1. .bash_profile a command alias to 'sudo fdesetup authrestart'. I used 'reboot'. Now from the terminal I can type 'reboot' to property restart the system.
  2. Use a UPS for power outages

UPS

  1. If VNC becomes unresponsive ssh into the box and reboot via 'sudo fdesetup authrestart'
2

Disable file vault on your startup disk, move sensitive data to another volume, and encrypt it with FileVault or some other means. I think in that case MacOS does not require a password before the OS loads.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .