Little Snitch Updating Boot Caches Forever

Little Snitch Updating Boot Caches Forever Average ratng: 6,6/10 6278 votes

Update on October 30, 2019: This issue is fixed in macOS 10.15.1.

  1. Little Snitch Updating Boot Caches Forever On Mac
  2. Little Snitch Updating Boot Caches Forever Free

In this article we’d like to outline some technical details about how the installation of a kernel extension works on macOS Catalina, about potential pitfalls in this process, what can go wrong, and what currently unfortunately does go wrong.

Macworld’s buying advice. Little Snitch 1.2.2 strikes a good balance between automatically blocking potential problems and letting users decide what connections to allow. This is a great tool for anyone who uses a wide variety of software, especially if you tend to download programs from a lot of new sources.

It’s for those of you with some technical background, who want to know how things work. It explains the intricate paths that the code in third party kernel extensions takes until it finally ends up in the kernel. Almost all of the information presented here was reverse-engineered.

When your Mac starts up, the very first thing to happen is the loading of the macOS kernel. Precision tune auto care alabaster al. To make this work, there are a couple of related technologies that must play nicely together:

  1. Kernel prelinking. The kernel is the first component of the operating system to start. It has no other tools available. In particular there is no way to check code signatures, and all file system access is very hard at this point. Apple therefore decided to prelink the bare kernel with all kernel extensions every time the kernel or one of the extensions is updated, and to start only that prelinked kernel at boot time.
  2. Read-only system volume. Apple decided to store the operating system on a read-only volume in order to prevent tampering by malware. The prelinked kernel is also stored on this read-only system volume.
  3. Updates of the prelinked kernel. Since the prelinked kernel is on a read-only volume, it cannot be updated directly. Apple had to conceive a new mechanism for updates.

Prelinked kernels are built by /usr/sbin/kextcache. This tool links the kernel at /System/Library/Kernels/kernel with kernel extensions from /System/Library/Extensions/ and /Library/Extensions/, checking code signatures and other prerequisites. The resulting prelinked kernel is written to /Library/Apple/System/Library/PrelinkedKernels/prelinkedkernel, a path which is on a writable volume and which is under System Integrity Protection (SIP) to prevent tampering.

Every time the directory /Library/Extensions/ is touched, the kextd daemon starts kextcache to build a new kernel.

However, the boot procedure does not use this new kernel. It uses the kernel at /System/Library/PrelinkedKernels/prelinkedkernel, which is on the read-only system volume. The kernel must be somehow copied to the read-only volume.

In addition to building the new prelinked kernel, kextcache installs a shell script in /var/install/shove_kernels. This script contains a call to /usr/sbin/kcditto, a tool which copies the kernel to its final destination at /System/Library/PrelinkedKernels/prelinkedkernel.

But the original problem still exists: The final destination is a read-only volume and SIP disallows remounting it in read/write mode. So when should the system run shove_kernels?

The best time is immediately before system shutdown. When you reboot or shut down your machine, launchd stops all processes. Then it remounts the system volume in read/write mode. This is possible because launchd has the entitlement com.apple.private.apfs.mount-root-writeable-at-shutdown. Then it runs /var/install/shove_kernels to copy the new kernel. All should be fine now.

The procedure outlined above fails on Catalina Beta 6 and newer, at least up to the public 10.15.0 release. In the last step, the kernel is not copied. It’s hard to debug the problem because the copying happens at a time when all system services have been shut down and log messages are no longer written to disk.

We have configured our test machine for verbose logging, and even then it’s very hard to check the logs. First, verbose logging does not work reliably. Sometimes it just does not switch to verbose mode or the screen turns black before log messages are written. And even if there is a verbose log, the font is tiny and a screen full of text appears for fractions of a second. We captured it with a camera and found the following messages:

We can see that remounting the system volume in read/write mode fails, in spite of the entitlement. The problem does not occur if SIP is disabled. This is an obvious bug, either in launchd or in the entitlements subsystem.

Not upgrade kernel extensions until Apple fixes the issue

Little Snitch Updating Boot Caches Forever On Mac

This is the easiest workaround. Just wait until Apple has fixed the issue and then upgrade. We have changed our software update feed for Little Snitch to hide updates for Catalina users until Apple has fixed the problem. All those who have already upgraded Little Snitch and the kernel extension version is out-of-sync, please downgrade to the same version as linked into the current kernel. See this FAQ article for details.

Update the kernel in macOS Recovery

Since SIP does not apply in macOS Recovery, you can boot into this mode and trigger a kernel update there:

  1. Restart your system in macOS Recovery. Learn more
  2. If you have enabled FileVault to encrypt the contents of your system volume, you first have to mount that volume: Open “Disk Utility”, select your system volume in the sidebar and click the “Mount” button in the toolbar. Please be patient – mounting FileVault volumes may take quite a while. Once the volume is mounted, quit the “Disk Utility” application.
  3. Open “Terminal” from the Utilities menu in the menu bar.
  4. Enter the following command:
    touch -c '/Volumes/Macintosh HD/System/Library/Extensions'
    Important Note: If your system volume has a different name than “Macintosh HD”, replace this name with the actual name of the volume on which macOS Catalina is installed.
  5. Wait about 10 seconds. Then choose “Restart” from the Apple menu in the menu bar to restart your computer. Shutting down can take up to a few minutes because the system is rebuilding the boot cache in the background. Note that during this time no progress indication is shown.

Disable SIP

Little Snitch Updating Boot Caches Forever Free

This is not recommended. But since the error occurs when launchd tries to remount the system volume in read/write mode and this limitation is a part of SIP, the update succeeds when SIP is disabled. There are no step-by-step instructions from Apple, but the Internet is full of instructions for how to disable SIP.