How to make a Mac mini reboot after power outage and have Channels work without user login

Hi,

Thought this would be helpful to anyone using a Mac mini for Channels - perhaps it could be added to the knowledge base? When I first installed Channels, I was having problems with the server missing recordings due to a reboot or power outage. This was annoying, particularly when I as out of town or didn’t notice that recordings weren’t happening.

Anyway, I finally managed to get things set up in a more robust manner - with Channels recording after a reboot without logging in, and the system rebooting after a power outage on its own. This wasn't the easiest to figure out - I did so by trial and error and scouring the forum archives for fixes to the various issues. To get everything working, I ended up doing the following:

  1. Set the system to restart automatically after a power failure - by default, this system remains powered off, and can only be powered on by physically pressing the power button. To do this, go to Apple menu-System Preference-Energy Saver and check “Start up automatically after a power failure”.

If you set the system to auto login, step 1 is sufficient. However, this isn’t ideal from a security standpoint. It is possible to set up Channels DVR such that it works after reboot without auto login, though to do this the following extra steps are required:

  1. Install Channels DVR as a system service. By default, Channels DVR is installed as a user service, which will only become active after logging in as the user who installed Channels. To uninstall the user service and install as a system service, run the following commands in Terminal:

~/Library/Application\ Support/ChannelsDVR/uninstall.sh ~/Library/Application\ Support/ChannelsDVR/install.sh --system

You may also need to update the DVR to the latest version (possibly pre-release), as there was a bug running as a system service in previous versions.

  1. If using an external drive for recordings, you will need to do the following:

a. Set external drives to automount without user login with the following command:
sudo defaults write /Library/Preferences/SystemConfiguration/autodiskmount AutomountDisksWithoutUserLogin -bool true

b. Give the channels-dvr service full disk access. To do this, go to Apple Menu-System Preferences-Security & Privacy, click on Full Disk Access, click the lock to unlock the settings, and click the checkmark next to channels-dvr in the list.

While it is possible to give it permission for just removable volumes in Security & Privacy - Files & Folders, for some reason this is insufficient for the service to be able to write external drives when not logged in. Perhaps this is a bug somewhere?

8 Likes

Great info, thanks for sharing, and for explaining each step so well!

1 Like

This was a big help. Really appreciate the post.

Anyone know how to do this with Windows?

Is there a way to manually get channels-dvr to appear in the list in Full Disk Access? I've gone through these steps, and it isn't appearing there.

EDIT: I rebooted, and then channels-dvr appeared in the list in Full Disk Access.

Based on my recent experience with trying to get the DVR Server to run on an M3 iMac running Sonoma 14.1.1 and using an external disk for its data, there are 2 more factors that need to be considered.

If FileVault is turned on, the Server will not start until the user logs in. So, to get it to start before then at Mac restart, you have to turn off FileVault and depend on the inherent encryption of an Apple Silicon Mac.

Even with FileVault turned off, although the Server will then start at Mac restart, it cannot access the external disk until the user logs in if the external disk is encrypted.

So, for the Server to restart fully before the user logs in, FileVault must not be enabled and if it uses an external disk volume, that must not be encrypted.

1 Like

Big help - thanks!!

Interesting post. Having not seen much about running it as a system service I will probably keep it as a user and figure out how to do an AutoLogon, and hopefully there is a way to quickly lock the screen right after it so I has to be unlocked with a password the next time someone tries to get into it. -Bill

PS. I usually run things as a Service on Windows so I am very familiar with that, MAC's on the other hand have a very steep learning curve with this old Windows Geek.

I just set up Channels DVR as a service and moved the DVR server path to the MacHD (was previously on an external USB hard drive) and I still have FileVault enabled. I restarted the Mac and it stayed at the login screen and I was still able to access Channels DVR on the web/iOS app and schedule a recording. The recording went off just fine.

So it appears that you do not need to disable FileVault if you want to run as a service.

Very interesting, though not what I observed when I did my experiments.

During my test, MacOS was booted via power on at 09.20, the login screen displayed at 09.21.15 but I didn’t do anything. I was unable to connect to the DVR server from iPad at both 09.33 and 10.40, and then eventually logged in to MacOS at 10.41.This was the DVR Server log at 11.22.

2023/11/18 23:41:30.466363 [DVR] Commercial detection for Kin S01E02 2023-11-18-2245.mpg finished with 2 markers in 1m29.732886916s (6 threads).
2023/11/19 10:41:55.121357 [SYS] Starting Channels DVR v2023.11.13.2159 (darwin-arm64 pid:579) in /Users/John/Library/Application Support/ChannelsDVR/data
2023/11/19 10:41:55.318381 [SYS] Started HTTP Server on 8089
2023/11/19 10:41:57.342676 [DVR] Waiting 6h28m2.657329s until next job 1700413800-2 East Midlands Today
2023/11/19 10:41:58.266427 [DVR] Recording engine started in /Volumes/D3 - DVR/DVR
2023/11/19 10:41:58.332309 [ERR] Could not create backup: stat /Volumes/D3 - DVR/DVR: no such file or directory
2023/11/19 10:41:59.131655 [SYS] Bonjour service registered with Johns-iMac
2023/11/19 10:46:57.241181 [SYS] Created database snapshot: backup-20231119.104657
2023/11/19 10:46:57.241602 [SYS] Removing old backup backup-20231103.135613

Having subsequently disabled Filevault, it then started OK after boot and before login but still couldn't access the DVR volume before login until I also switched encryption off on that volume.

Is there a difference between restart and shutdown/power-on? Are you on Apple Silicon or Intel? Just wondering if there is something that makes a difference.

1 Like

Good point! I just tested shutting down and powering back on. Left it at the login screen and went on my other Mac and I can access the Channels DVR website just fine.

It is a Mac mini (M1, 2020) macOS 14.2.1. Let me know if I can provide any other details about my set up and why it seems to work fine for me and not for you.

Although, now that I look at your logs, is your DVR recording path on an external drive? So that would be the issue. The Mac does not mount external drives prior to login when FileVault is enabled. I experienced the same thing on mine and that is why I moved my DVR recording path to the MacHD. That way if my Mac mini restarts manually or automatically (or is restarted via the UPS), then at least recordings will still happen. I have a Hazel rule to move the DVR recordings over to my Media drive that is set up in Plex.

I did issue the command from this doc and my Time Machine backup drive that is connected to the Mac mini that I have backing up my other Mac over the network will mount just fine after restart or shutdown. However, all my other external drives do not mount including my CCC backup drives, Media drive and another m.2 drive. All my drives are encrypted with the passwords saved in keychain, but I understand that because FileVault is enabled, those won't automount, even with that command issued it seems. It's weird that the remote Mac Time Machine drive mounts though, haven't really figured that out yet. It would be nice to have my Media drive automount prior to login, but my workaround with recording to the MacHD seems like a good compromise for security.

Yes, the DVR library is on an external disk, and that would seem to be the difference.

In my previous testing, I switched off FileVault first and then had to switch off encryption on my external disk as well to get it to work properly. Just tested with FileVault on when the external disk was not encrypted, and that doesn’t work properly, as you have also proved.

So the key difference is whether one uses an external disk or not. If you do, you need to switch FileVault off to get it to work as desired after a power failure. I’m happy to accept the slightly lower level of security that results.

Yup. There is also the use-case difference between us as well since I only use Channels for the DVR functionality. So I'm able to push my recordings off of the internal MacHD recording location and to the external for Plex to watch.