The successful and widely used two-step process of producing the hybrid organic-inorganic perovskite CH3NH3PbI3, consists of converting a solution deposited PbI2 film by reacting it with CH3NH3I. Here, we investigate the solidification of PbI2 films from a DMF solution by performing in situ grazing incidence wide angle X-ray scattering (GIWAXS) measurements. The measurements reveal an elaborate sol–gel process involving three PbI2⋅DMF solvate complexes—including disordered and ordered ones—prior to PbI2 formation. The ordered solvates appear to be metastable as they transform into the PbI2 phase in air within minutes without annealing. Morphological analysis of air-dried and annealed films reveals that the air-dried PbI2 is substantially more porous when the coating process produces one of the intermediate solvates, making this more suitable for subsequent conversion into the perovskite phase. The observation of metastable solvates on the pathway to PbI2 formation open up new opportunities for influencing the two-step conversion of metal halides into efficient light harvesting or emitting perovskite semiconductors.