Early type galaxies (ETG) contain most of the stars present in the local Universe and, above a stellar mass of ~5e10 Msun, vastly outnumber spiral galaxies like the Milky Way. These massive spheroidal galaxies have, in the present day, very little gas or dust, and their stellar populations have been evolving passively for over 10 billion years. The physical mechanisms that led to the termination of star formation in these galaxies and depletion of their interstellar medium remain largely conjectural. In particular, there are currently no direct measurements of the amount of residual gas that might be still present in newly quiescent spheroids at high redshift. Here we show that quiescent ETGs at z~1.8, close to their epoch of quenching, contained 2-3 orders of magnitude more dust at fixed stellar mass than local ETGs. This implies the presence of substantial amounts of gas (5-10%), which was however consumed less efficiently than in more active galaxies, probably due to their spheroidal morphology, and consistently with our simulations. This lower star formation efficiency, and an extended hot gas halo possibly maintained by persistent feedback from an active galactic nucleus (AGN), combine to keep ETGs mostly passive throughout cosmic time.