The processes allowing the escape of ionizing photons from galaxies into the intergalactic medium are poorly known. To understand how Lyman continuum (LyC) photons escape galaxies, we constrain the HI covering fractions and column densities using ultraviolet HI and metal absorption lines of 18 star-forming galaxies which have Lyman series observations. Nine of these galaxies are confirmed LyC emitters. We fit the stellar continuum, dust attenuation, metal, and HI properties to consistently determine the UV attenuation, as well as the column densities and covering factors of neutral hydrogen and metals. We use synthetic interstellar absorption lines to explore the systematics of our measurements. Then we apply our method to the observed UV spectra of low-redshift and z-2 galaxies. The observed HI lines are found to be saturated in all galaxies. An indirect approach using OI column densities and the observed O/H abundances yields HI column densities of 18.6 to 20 cm-2. These columns are too high to allow the escape of ionizing photons. We find that the known LyC leakers have HI covering fractions less than unity. Ionizing photons escape through optically thin holes/channels in a clumpy interstellar medium. Our simulations confirm that the HI covering fractions are accurately recovered. The SiII and HI covering fractions scale linearly, in agreement with observations from stacked Lyman break galaxy spectra at z-3. Thus, with an empirical correction, the SiII absorption lines can also be used to determine the HI coverage. Finally, we show that a consistent fitting of dust attenuation, continuum and absorption lines is required to properly infer the covering fraction of neutral gas and subsequently to infer the escape fraction of ionizing radiation. These measurements can estimate the LyC escape fraction, as we demonstrate in a companion paper.