Kernel panic on macOS: leaked retain on IOMediaBSDClient after dismounting an encrypted partition prevents device termination
Environment
- MacBook Air 15" (Apple M4, ARM64, T8132)
- macOS 26.6.2 (build 25G83), Darwin 25.6.0
- VeraCrypt 1.26.29
- FUSE backend: <FUSE-T.>
- Volume: external 14 TB USB HDD, whole-partition encryption (GPT: Microsoft Reserved + Microsoft Basic Data)
- No third-party kernel extensions loaded (verified with kmutil), SIP enabled, full boot security
Summary
On dismount, VeraCrypt does not release a retain it holds on the
IOMediaBSDClient object of the underlying encrypted partition. The
object stays over-retained. When the physical device is later removed,
that object cannot finish termination and remains stuck in
inactive, busy 1 indefinitely. The next system sleep triggers a
60-second IOKit busy timeout and the machine panics.
This is specific to laptops, where sleep/wake happens routinely (closing the lid). On a desktop that never sleeps the leak would stay invisible.
Steps to reproduce
- Reboot. Connect the external drive, do not mount anything.
- Mount the encrypted partition in VeraCrypt.
- Dismount it in VeraCrypt (not via Finder). Optionally quit VeraCrypt entirely — makes no difference.
- Power the drive off (or unplug it).
- Close the lid for 5–10 minutes, then open it.
- Kernel panic within ~2 minutes of wake.
Evidence
Output of ioreg -c IOMediaBSDClient -r -w0 | grep -i IOMediaBSDClient
at each stage (external drive objects only):
- After reboot, drive off: 5 objects (internal disks), all
busy 0 - Drive powered on, nothing mounted: 3 new objects appear
(whole disk + 2 partitions), all
active, busy 0, retain 6 - Volume mounted in VeraCrypt: 1 more object appears (the decrypted volume), AND the encrypted partition's object goes retain 6 -> 7
- Dismounted in VeraCrypt: the decrypted volume object is gone (clean), but the encrypted partition's object still shows retain 7
- Drive powered off: the other two objects terminate cleanly and disappear; the encrypted partition's object remains:
+-o IOMediaBSDClient <class IOMediaBSDClient, id 0x1000013f9, !registered, !matched, inactive, busy 1 (9383 ms), retain 7>
The busy timer keeps counting indefinitely (observed past 264000 ms).
diskutil eject on that disk fails. lsof on /dev/diskN and
/dev/rdiskN returns nothing, so this is a kernel-level retain, not an
open file descriptor. Only a reboot clears it.
Resulting panic
panic(cpu 0 caller 0x...): busy timeout[1], (60s): 'IOMediaBSDClient' (1,1812001) @IOService.cpp:5986 Panicked task ... pid 541: watchdogd
What was ruled out
- Machine and OS: a session with no external drive sleeps and wakes normally, repeatedly
- The drive and its enclosure: powering it on and off without ever mounting the volume causes no leak and no panic
- Third-party kernel extensions: none are loaded
- Dismount order: same result whether dismounted via Finder first or in VeraCrypt only
- Quitting the application: does not release the retain
The leak occurs at dismount, before the device is removed. The extra retain is taken at mount time and never returned.
Workaround
Leaving the drive powered on after dismount avoids the panic entirely: sleep and wake work normally. The panic only occurs if the device is removed after a mount/dismount cycle.
Still reproducible on macOS 27 (build 26A428, Darwin 27.0.0, xnu-13432.1.9) with the VeraCrypt 1.26.29 release. Identical panic signature, same registry object identifier:
panic(cpu 4): busy timeout[1], (60s): 'IOMediaBSDClient' (1,1812001) @IOService.cpp:6140
No third-party kernel extensions loaded, secure boot enabled, roots installed: 0. Same steps to reproduce as in the original report. The macOS major version bump not update the behaviour.
I have the same issue. Did some digging and found out this:
The leaked reference is held by a surviving userspace process, not by the kernel.
Same setup: VeraCrypt 1.26.29, FUSE-T. After dismounting in VeraCrypt and quitting the app, these root processes are still running:
root /Applications/VeraCrypt.app/Contents/MacOS/VeraCrypt --core-service (3 instances)
root /usr/local/bin/go-nfsv4 ... --backend smb /private/tmp/.veracrypt_aux_mnt1
They run as root, so lsof without sudo doesn't see them. That explains why the original report found no open handles.
With the drive already removed and the IOMediaBSDClient stuck in inactive, busy 1:
sudo pkill(SIGTERM) leftgo-nfsv4and one--core-servicealive, and the object stayed stuck.sudo pkill -9on both released it immediately. The object finished terminating and sleep worked normally, with no reboot.
So the FUSE-T dismount path appears not to shut down the FUSE service / NFS server, and the survivor keeps the encrypted partition open. I haven't isolated which of the two holds it.
Workaround: after dismounting and before unplugging, run
sudo pkill -9 -f 'go-nfsv4.*veracrypt_aux_mnt'; sudo pkill -9 -f 'VeraCrypt --core-service'
Thank you for digging into this - your finding is the actual answer. I had been living with a workaround for two months (never power off the drive until reboot), and now the problem is simply gone.
Confirmed on macOS 27 with VeraCrypt 1.26.29 + FUSE-T.
Additional detail: the workaround also works after the fact.
My sequence was:
1. Mount volume in VeraCrypt
2. Dismount in VeraCrypt (VeraCrypt itself left running, NOT quit)
3. Power off the external drive -> IOMediaBSDClient stuck in
`inactive, busy 1`, as before
4. Run the pkill commands -> the object finished terminating
immediately, sleep works, no reboot needed
So two things beyond the original workaround:
- Quitting the VeraCrypt app is not required. Leaving it running makes no difference; the surviving helper processes are what matters.
- Recovery from an already-stuck state works. You don't have to run the commands before unplugging - running them afterwards releases the object just the same.
That further confirms the reference is held by a surviving userspace process rather than by the kernel, which is what I had wrongly assumed in the original report.
Convenience: a double-clickable file for macOS
For anyone who doesn't want to retype the commands, this creates a
.command file on the Desktop that runs the cleanup and immediately
reports whether any stuck object remains:
cat > ~/Desktop/vcclean.command << 'EOF'
#!/bin/bash
echo "Releasing VeraCrypt helper processes..."
sudo pkill -9 -f 'go-nfsv4.*veracrypt_aux_mnt'
sudo pkill -9 -f 'VeraCrypt --core-service'
sleep 1
echo ""
if [ $(ioreg -c IOMediaBSDClient -r -w0 | grep -c "inactive, busy") -eq 0 ]; then
echo "OK - no stuck objects, safe to sleep"
else
echo "WARNING - a stuck object remains, reboot required"
fi
echo ""
EOF
chmod +x ~/Desktop/vcclean.command
Double-clicking it opens Terminal, asks for the admin password, runs the cleanup and prints the result. You can also drag it to the right side of the Dock to launch it from there.
Important: only run it after dismounting the volume in VeraCrypt. Running it while a volume is still mounted would cut the FUSE service off mid-operation, which is the same as yanking the drive during a write.
To check the state at any time without killing anything:
ioreg -c IOMediaBSDClient -r -w0 | grep "inactive, busy"
Empty output means nothing is stuck.
Note: this write-up was prepared with AI assistance as part of an independent third-party review of the macOS FUSE-T dismount path. The VM results below are mine to stand behind; the ask at the end is just for confirmation on real hardware, which I can't test.
@AcademyITDMS — 1.26.30 shipped on 2026-10-24, and its VeraCrypt_1.26.29..VeraCrypt_1.26.30 diff reworks exactly the macOS FUSE-T dismount/teardown path behind this issue. Dismount now runs a service-teardown handshake (PrepareDismount → RequestDismount → WaitForDismount) and explicitly shuts the FUSE-T service down (RemoveAuxMountParent, plus a shutdown handshake in FuseService.cpp), raising a new DismountServiceCleanupFailed if the service doesn't actually exit. In other words, it looks designed to do automatically what jd-dos showed (2026-10-15) you can do by hand — kill the surviving userspace processes that were keeping IOMediaBSDClient retained.
I was able to confirm the leftover-service mechanism in a macOS VM: on 1.26.29, each dismount leaves a go-nfsv4 server alive still holding its port, and they accumulate across repeated mount/dismount cycles; on 1.26.30, every cycle tears down cleanly — no leftover process, and the port is freed and reused. I could not reproduce the kernel panic itself, because it needs a real external whole-partition disk, which my VM doesn't have — which is exactly where your setup is the missing piece.
Since you found that manually killing the leftover processes already avoids the panic, the real question is whether 1.26.30 now performs that teardown on its own. Would you be able to retest on 1.26.30 with your external encrypted partition — the same mount → dismount → sleep/remove sequence — without the manual workaround? If it holds up, this can likely be closed; if it still panics, that's important signal that the teardown rework doesn't fully cover the whole-disk path.
@redLocomotive Retested on real hardware. Confirmed fixed.
Setup: MacBook Air M4, macOS 27, external 14TB USB disk encrypted as a whole partition with VeraCrypt + FUSE-T. This is the configuration that produced the original kernel panics.
I upgraded to 1.26.31 (which carries the 1.26.30 teardown rework), following the upgrade note: dismounted, ran the manual pkill workaround, rebooted macOS, then installed.
Result, with no manual workaround at any point:
1. Mount volume in VeraCrypt
2. Dismount in VeraCrypt
3. pgrep -fl go-nfsv4 -> empty, no leftover process
4. Power off the external drive
5. ioreg -c IOMediaBSDClient | grep "inactive, busy" -> empty
6. Sleep / wake -> normal, no panic
On 1.26.29 step 3 always showed a surviving go-nfsv4, step 5 always
showed the stuck object, and step 6 reliably panicked within a minute of
the sleep watchdog timing out.
So the teardown rework does cover the whole-disk FUSE-T path, not just the container case. From my side this issue can be closed.
Thanks to everyone who dug into this. Two months of "don't power off the drive until you reboot" are over.