We present ab initio study of the electronic stopping power of protons and helium ions in an insulating material, HfO2. The calculations are carried out in channeling conditions with different impact parameters by employing Ehrenfest dynamics and real-time, time-dependent density functional theory. The satisfactory comparison with available experiments demonstrates that this approach provides an accurate description of electronic stopping power. The velocity-proportional stopping power is predicted for protons and helium ions in the low energy region, which conforms the linear response theory. Due to the existence of wide band gap, a threshold effect in extremely low velocity regime below excitation is expected. For protons, the threshold velocity is observable, while it does not appear in helium ions case. This indicates the existence of extra energy loss channels beyond the electron-hole pair excitation when helium ions are moving through the crystal. To analyze it, we checked the charge state of the moving projectiles and an explicit charge exchange behavior between the ions and host atoms is found. The missing threshold effect for helium ions is attributed to the charge transfer, which also contributes to energy loss of the ion.