How to Fix Overnight Battery Drain During Background Indexing on iPhone 12 mini: Complete Diagnostic Manual
1. Issue Overview & Symptoms on iPhone 12 mini
The iPhone 12 mini (A14 Bionic, 5.4‑inch OLED, 2227 mAh Li‑ion) exhibits a characteristic overnight drain of 30 %–50 % when the device is left idle on a charger or in standby. Users report the following observable phenotype:
- Battery graph in Settings ▸ Battery shows a steep, near‑linear decline between 00:00 – 06:00 local time despite Low Power Mode being enabled.
- Background Activity list reveals
duetd(Duet Activity Scheduler) anddasd(Data Access Service Daemon) consuming > 15 % CPU each during the same window. - Console (via macOS
log show --predicate 'process == "duetd" || process == "dasd"' --style syslog) logs repeatedDuetHeuristic: scheduling background indexingandDAS: indexing volume /private/var/mobile/Containers/Data/Application/…entries at 2–5 minute intervals. - Thermal sensor
TC0D(PMIC die) reports 38 °C–42 °C while the device is otherwise cool to the touch, indicating sustained SoC activity. - No kernel panic, no
panic.logentries, andsysdiagnoseshowsPowerLog“BackgroundTask” withduration > 1800 s.
The root cause is a runaway indexing loop triggered by the Duet scheduler incorrectly classifying the Spotlight and CoreSpotlight databases as “stale” after each nightly com.apple.mobileassetd asset refresh. The dasd daemon then repeatedly opens APFS snapshot handles on the /var/mobile container, forcing the APFS transaction tree to replay journal entries, which keeps the PMIC power rail VDD_MAIN at 3.8 V and the CPU cluster at 1.8 GHz (performance core) for hours.
2. Subsystem Architecture & Failure Mechanics
The iPhone 12 mini power‑management hierarchy consists of the Apple PMIC (PMU‑A14) feeding three primary rails: VDD_MAIN (3.8 V), VDD_CPU (variable 0.6–1.2 V), and VDD_GPU. The Secure Enclave Processor (SEP) monitors PMIC_I2C registers for over‑current events, while the Apple Power Management Firmware (APMFW) running on the Always‑On Processor (AOP) enforces Idle‑State 0x3 (Deep Sleep) when the launchd job queue is empty.
During normal operation, duetd (PID ≈ 120) evaluates DuetHeuristic policies stored in /var/db/duet/heuristics.plist. When a com.apple.metadata.mds (Spotlight) index is flagged dirty, duetd posts a XPC message to dasd (PID ≈ 210) via the com.apple.dasd Mach service. dasd then opens an APFS snapshot (fs_snapshot_create) on the Data volume, iterates the B‑tree of the SpotlightV2 directory, and writes mds index files. Each iteration holds a transaction_id in the APFS journal, preventing the filesystem from entering trim or snapshot‑release paths.
On iOS 16‑18.2, a regression in DuetHeuristic (commit a1b2c3d) mis‑interprets the lastSuccessfulRun timestamp after a mobileassetd OTA asset download (e.g., com.apple.MobileAsset.SiriVoice). The heuristic believes the index is older than kDuetMaxStaleInterval = 86400 seconds and schedules a DuetActivity with repeating = true. Because dasd does not clear the dirty flag after each pass (the flag lives in /var/db/dasd/index_state.plist), the loop repeats indefinitely.
The sustained CPU activity forces the Performance‑Core Cluster (P‑Cluster) to remain at P‑State 0 (max 3.0 GHz) while the Efficiency‑Core Cluster (E‑Cluster) is parked. The PMIC therefore keeps VDD_CPU at 1.15 V, and the Thermal Management Unit (TMU) raises the TC0D set‑point to 45 °C, preventing the AOP from entering Deep Sleep. The net result is a 30‑50 % capacity loss over a 6‑hour window, which is disproportionate for a 2227 mAh cell.
3. Pre‑Flight Diagnostic Checklist
- Physical inspection – Verify no liquid‑contact indicator (LCI) tripped; confirm battery health > 80 % in
Settings ▸ Battery ▸ Battery Health & Charging. - iOS version – Record exact build (e.g.,
iOS 18.2 (22C152)). - Charging state – Test both wired (USB‑C PD 20 W) and MagSafe (15 W) to rule out charger‑induced wake‑ups.
- Background App Refresh – Disable globally (
Settings ▸ General ▸ Background App Refresh ▸ Off) and per‑app forSpotlightandFiles. - Low Power Mode – Enable and verify
Settings ▸ Battery ▸ Low Power Modeshows “On”. - Diagnostic logs – Capture a
sysdiagnose(press Volume Up + Volume Down + Side + hold 1 s) and export viaSettings ▸ Privacy & Security ▸ Analytics & Improvements ▸ Analytics Data. - Spotlight index size – In
Settings ▸ General ▸ iPhone Storage, note “System Data” > 5 GB indicates bloated index. - Developer mode – If enabled, ensure
Settings ▸ Privacy & Security ▸ Developer Modeis off (prevents extraduetdheuristics).
4. Terminal & Diagnostic Commands
Run the following on a macOS host with the iPhone 12 mini connected via USB‑C (trusted). Requires ideviceinfo, idevicesyslog, and log from libimobiledevice + Xcode Command Line Tools.
# 1. Pull the latest sysdiagnose archive (requires user approval on device)
idevicesyslog -u | tee ~/syslog_$(date +%F_%H%M).log
# 2. Filter Duet / DAS daemon activity for the last 12 h
log show --device --predicate 'process == "duetd" OR process == "dasd"' \
--start "$(date -v-12H +%Y-%m-%d\ %H:%M:%S)" \
--style json > ~/duet_das_12h.json
# 3. Extract APFS snapshot count (should be 0 in idle)
ssh mobile@ "sudo /usr/sbin/diskutil apfs listSnapshots /dev/disk1s1" 2>/dev/null
# 4. Dump Duet heuristic plist for inspection
scp mobile@:/var/db/duet/heuristics.plist ~/heuristics.plist
plutil -p ~/heuristics.plist | grep -A2 -B2 'kDuetMaxStaleInterval'
# 5. Check PMIC rail voltages via powermetrics (requires Apple Silicon Mac)
sudo powermetrics --samplers smc -i 1000 -n 5 | grep -E 'VDD_MAIN|VDD_CPU|TC0D'
# 6. Verify launchd job queue depth for background tasks
ssh mobile@ "launchctl print system/com.apple.duetd | grep -c 'active'"
5. Step‑by‑Step Remediation Protocols
Protocol A – Non‑Destructive Software Tweaks (≈ 5 min)
- Open Settings ▸ General ▸ Spotlight Search and toggle Siri Suggestions OFF for all categories.
- Navigate to Settings ▸ Privacy & Security ▸ Analytics & Improvements → disable Share iPhone Analytics and Share iCloud Analytics.
- Force‑reset the Duet heuristic cache:
ssh mobile@"sudo rm -f /var/db/duet/heuristics.plist && sudo launchctl kickstart -k system/com.apple.duetd" - Reboot the device (press Side + Volume Up → slide to power off, then hold Side until Apple logo).
- Observe overnight drain for one cycle; if < 5 % loss, stop here.
Protocol B – Targeted Index Rebuild (≈ 15 min, preserves user data)
- Disable Background App Refresh globally (see checklist).
- Enter Recovery Mode (connect to Mac, press Volume Up, Volume Down, hold Side until recovery screen).
- In macOS Terminal, mount the Data volume read‑write:
idevicepair pair ideviceimagemount /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport//DeveloperDiskImage.dmg # The Data volume appears as /Volumes/Data - Delete the Spotlight index and DAS state:
sudo rm -rf /Volumes/Data/.Spotlight-V100 sudo rm -rf /Volumes/Data/var/db/dasd/index_state.plist sudo rm -rf /Volumes/Data/var/db/duet/heuristics.plist - Unmount, exit Recovery Mode (hold Side until Apple logo), and let iOS rebuild indexes on first unlock (may take 10‑20 min).
- Re‑enable Background App Refresh only for essential apps.
Protocol C – Deep System Recovery (DFU Restore, data‑preserving via iCloud backup)
- Ensure a recent iCloud Backup (
Settings ▸ [Your Name] ▸ iCloud ▸ iCloud Backup ▸ Back Up Now). - Enter DFU Mode on iPhone 12 mini:
- Connect to Mac via USB‑C.
- Press Volume Up → release.
- Press Volume Down → release.
- Hold Side + Volume Down for 10 s.
- Release Side while continuing to hold Volume Down for another 5 s.
- Screen stays black; macOS Finder shows “iPhone in recovery mode”.
- In Finder (macOS 13+), select the device → Restore iPhone… → choose Install latest iOS (18.2).
- After restore, choose Restore from iCloud Backup during Setup Assistant.
- Post‑restore, immediately run Protocol A steps to prevent heuristic re‑corruption.
6. Hardware & Telemetry Parameter Matrix
| Parameter | Normal Idle (Deep Sleep) | Failure Threshold (Observed) | Unit | Measurement Point |
|---|---|---|---|---|
| VDD_MAIN (PMIC main rail) | 3.78 ± 0.02 | >= 3.85 | V | PMIC I2C register 0x1A |
| VDD_CPU (Performance‑core rail) | 0.60 – 0.70 (parked) | >= 1.10 | V | PMIC I2C register 0x2C |
| TC0D (PMIC die temp) | 28 – 32 | >= 42 | °C | Thermal sensor via SMC |
| CPU P‑Cluster Frequency | 0 MHz (all cores parked) | >= 1.8 GHz sustained | MHz | powermetrics / kperf |
| APFS Snapshot Count (Data volume) | 0 | >= 3 concurrent | count | diskutil apfs listSnapshots |
| Duetd CPU Time (per hour) | < 0.5 % (≈ 18 s) | >= 15 % (≈ 540 s) | % CPU | log show / Instruments |
| Dasd Disk Write Throughput | < 0.2 MB/s | >= 12 MB/s sustained | MB/s | fs_usage -f disk |
| Battery Current Draw (idle) | 15 – 25 mA | >= 120 mA | mA | Battery Fuel Gauge (BQ27541) via I2C |
7. Expert Q&A / Edge Cases
- Q1: Will Protocol B delete my Photos, Messages, or Keychain items?
- No. The removed paths (
.Spotlight-V100,index_state.plist,heuristics.plist) are pure metadata indexes. User‑generated content lives in
Share your OS version, device model, and exact error code in our independent peer Q&A rooms.