com.apple.apfsd.wbc_drain
This task has now been running for a month now, when will it stop.
Just upgraded to MacOS 10.15.2 in hope that it would stop running. 😕
It prevents my iMac to go to sleep automatic.
iMac with Retina 5K display, macOS 10.15
This task has now been running for a month now, when will it stop.
Just upgraded to MacOS 10.15.2 in hope that it would stop running. 😕
It prevents my iMac to go to sleep automatic.
iMac with Retina 5K display, macOS 10.15
iMac (Retina 5K, 27 pouces, 2019) 10.15.4 - fusion drive (apple built-in)
I have reproduce it on a completely clean install. I added a volume and did install Catalina on it and boot from it.
I did not install anything, just created an account, and an issue is there.
So this is definitively a Catalina issue (I never see on Mojave).
It is related to fusion drive, this does not happen on my MBP that has a SSD, a task will appear after some time or after the 1st sleep/wake sequence.
This task is started by apfsd that starts a user agent that starts com.apple.apfsd/wbc_drain that will never stop and prevent the sleep.
I'm wondering if Apple take care of this as you can find many people having the issue.
I find a workaround, not very clean but this is the only way out, and it will not persist across boot.
The workaround consist in killing this background task by killing the UserEventAgent that supports it.
It turns that it need to be killed several times as it restart
in zsh you can copy past this. This will hide the issue until reboot or may be after sometimes the OS will restart this endless task.
until [ -z $(ps -ef | grep UserEventAgent | grep System | awk '{print $2}') ]
do
ps -ef | grep UserEventAgent | grep System | awk '{print $2}' | xargs sudo kill -9
done
iMac (Retina 5K, 27 pouces, 2019) 10.15.4 - fusion drive (apple built-in)
I have reproduce it on a completely clean install. I added a volume and did install Catalina on it and boot from it.
I did not install anything, just created an account, and an issue is there.
So this is definitively a Catalina issue (I never see on Mojave).
It is related to fusion drive, this does not happen on my MBP that has a SSD, a task will appear after some time or after the 1st sleep/wake sequence.
This task is started by apfsd that starts a user agent that starts com.apple.apfsd/wbc_drain that will never stop and prevent the sleep.
I'm wondering if Apple take care of this as you can find many people having the issue.
I find a workaround, not very clean but this is the only way out, and it will not persist across boot.
The workaround consist in killing this background task by killing the UserEventAgent that supports it.
It turns that it need to be killed several times as it restart
in zsh you can copy past this. This will hide the issue until reboot or may be after sometimes the OS will restart this endless task.
until [ -z $(ps -ef | grep UserEventAgent | grep System | awk '{print $2}') ]
do
ps -ef | grep UserEventAgent | grep System | awk '{print $2}' | xargs sudo kill -9
done
I found a trick in https://forums.macrumors.com/threads/no-sleep-after-catalina.2204818.
Killing twice the UserAgent task that runs the culprit wbc_drain solves the problem on my Mac mini.
Execute twice: ps -ef | grep UserEventAgent | grep -v grep | awk '{print $2}'| sudo xargs kill -9
If you reboot you need to execute again those commands.
I did it yesterday evening and my Mac entered sleep mode for the whole night.
Great!!!! It works!!!!
Killing twice the UserAgent task that runs the culprit wbc_drain solves the problem on my Mac mini.
Execute twice: ps -ef | grep UserEventAgent | grep -v grep | awk '{print $2}'| sudo xargs kill -9
My mac mini server 2012 has a fusion drive with an Intel SSD I put in it (non Apple SSD).
I figured out the kernel is writing, slowly but it is always writing on the disk. The total written size increases a lot among hours, up to several gigabytes. I don't know if this is expected or not?
I made a spindump and figured out there are some fusion_wbc_xxx functions called in a loop. As per the function name it seems linked to the fusion drive. I enabled the trim option a long time ago on High Sierra or even before with no problem before I migrated to Catalina. I will make a try by disabling trim to check if the wbc_drain disappears or not?
Do you have a fusion drive too? Is trim enabled?
Not that for this fix to work, the OS need to have already started wbc_drain background task.
This is not happening right after boot.
From my experience, it requires about 10 mns after boot or the Mac to to have gone one time in sleep.
one way is to check for the background task before executing the previous line to see if the background task is running
% pmset -g assertions | grep wbc_drain
if you have such result
pid 217(UserEventAgent): [0x000001c4000b838f] 00:04:36 BackgroundTask named: "com.apple.apfsd.wbc_drain"
then the task is running and you can executes the line.
so te previous suggestion can be improved
until [ $(pmset -g assertions | grep wbc_drain | wc -l) -gt 0 ]
do
done
until [ -z $(ps -ef | grep UserEventAgent | grep System | awk '{print $2}') ]
do
ps -ef | grep UserEventAgent | grep System | awk '{print $2}' | xargs sudo kill -9
done
Yes, same here and downgrading to Mojave has a working autosleep feature.
I guess it is the combo of IMac and OS causing this but I have not seen any announcement from Apple on this. Catalina is so bug ridden that I believe Apple treats this bug as a minor slip.
I have exactly the same problem on my Mac Mini 2012. It's never entering sleep mode anymore since I moved to Catalina. It was working very well before on Mojave. Too bad.... The update 10.15.2 did not change anything.
The command shell "pmset -g log" shows com.apple.apfsd.wbc_drain is the culprit running for hours, with an external media disk mounted, and preventing the system to sleep as follows:
2019-12-15 10:02:13 +0100 Assertions PID 172(powerd) Summary ExternalMedia "com.apple.powermanagement.externalmediamounted" 47:13:57 id:0x0x800008002 [System: BGTask kCPU]
2019-12-15 10:02:13 +0100 Assertions PID 160(UserEventAgent) Summary BackgroundTask "com.apple.apfsd.wbc_drain" 47:08:25 id:0x0xb0000819b [System: BGTask kCPU]
For everyone: This obviously needs Apple's attention but they will not see your report here. This is a user-to-user venue and Apple development personnel do not monitor it.
However, you can report the problem in a way Apple employees will see it by using this feedback link:
Indeed it looks like I have tested too fast the 10.5.4 supplemental update '10.15.4 (19E287)'
And I choose to use my decaffeinate command as on previous release.
Since 8 days I decide to more thorroughlly test it.
here are the results
$ uptime
10:55 up 8 days, 17 mins, 10 users, load averages: 1,81 1,63 1,50
$ pmset -g stats
Sleep Count:93
Dark Wake Count:84
User Wake Count:45
Sleep Count represents the real deep sleeps, I can confirm it from an end user prospective, the end-user caused wake-ups when the Mac is deep sleeping are noticeably longer than when it is not deep sleeping.
So it seems the problem is fixed.
Of course, my iMac deep sleeps less that when I use my decaffeinate command (that kills com.apple.apfsd.wbc_drain), however this task is there for something, I assume some maintenance routine related to fusion drive, will probably never know.
So I prefer having this task running now that my fusion drive equipped iMac is deep sleeping.
I also investigate the full log where we can see when this task prevented the idle as far as I can understand.
$ pmset -g log | grep wbc_drain | wc -l
637
$ pmset -g log | grep wbc_drain | grep PrevIdle | wc -l
70
So 11% of the time this task is running, it seems to prevent idleness.
Well, I am a bad explainer.
Place the python script in a directory of your choice, i.e. $HOME/bin. Go to http://launched.zerowidth.com/
There, create a plist file to execute the python script at boot time.
There will be instructions on how to install the plist file at the bottom of the page.
Do you have an Apple fusion drive (HDD + SSD Apple)? Or a fusion drive with a SSD you installed yourself?
I got other issues on Catalina which is too buggy for me. Finally I moved back to Mojave. I will wait for Apple to fix all the bugs or will stay on Mojave. No more wbc_drain :).
Catalina 10.15.4 is out!
Any volunteer to try an update from previous Catalina version to check if wbc_drain issue on fusion drive is fixed with this new release?
Thanks
It seems only to affect iMac's, I run a 2017 15" and and 2019 16" not having the problem. At the moment I rely on a tool to send my device to sleep, using the keyboard works as well. Just autosleep does not work.
Please: No "hints" to SMC reset, PRAM reset, etc, the basics are in place.
% pmset -g live
System-wide power settings:
Currently in use:
standby 1
Sleep On Power Button 1
womp 1
autorestart 1
hibernatefile /var/vm/sleepimage
powernap 0
networkoversleep 0
disksleep 10
standbydelayhigh 86400
sleep 1 (sleep prevented by UserEventAgent)
autopoweroffdelay 14400
hibernatemode 0
autopoweroff 1
ttyskeepawake 1
displaysleep 1
highstandbythreshold 50
standbydelaylow 86400
com.apple.apfsd.wbc_drain