zfs icon indicating copy to clipboard operation
zfs copied to clipboard

MacOS hangs on shutdown with pool with vdev file still alive

Open captain-haddock17 opened this issue 4 years ago • 2 comments

Short Story

Condition: With a still active/present vdev file as pool

when asking to shutdown or reboot my system, MacOS hangs forver...

Have to push 10 sec. the power-button

clue

  • Shouldn't there be a LaunchAgent for shutdown ?
    • zpool export -a
  • maybe a race condition on the APFS main filesystem, while ZFS file is still in use ?
    • file /vdev/zTest.dat

Workaround

  • do a manual zpool export -a before shuting down/rebooting

Test case

  1. Create zpool mkdir /vdev dd bs=4096 count=131072 if=/dev/zero of=/vdev/zTest.dat zpool create zTest /vdev/zTest.dat
  2. shutdown (or reboot) MacOS through regular Apple menu

Config MacBook Air (2012) with SSD (APFS) - macOS 10.14.6 (18G4032)/ Darwin 18.7.0 sysctl {spl,zfs}.kext_version

spl.kext_version: 1.9.4-0 zfs.kext_version: 1.9.4-0

captain-haddock17 avatar Apr 09 '20 11:04 captain-haddock17

Some possible solutions i've read over the web:

  • Launchd script with trap trap myShutdown SIGTERM trap myShutdown SIGKILL
  • substute the /sbin/shutdown with a script (calling the real shutdown)
  • creating a C (or whatever) program that could register himself for an XPC event
    • called from a Launchd

Ref :

captain-haddock17 avatar Apr 09 '20 15:04 captain-haddock17

I've got the same problem as author has described, any suggestions?

sosise avatar Mar 18 '21 05:03 sosise