A vast amount of modern scientific and technological knowledge relies on the software that we have been collectively writing: deep knowledge from fields like mathematics, physics, chemistry, biology, medicine, finance and social sciences is now inextricably embodied into complex software systems, which model it at a level of detail that goes way beyond that of the usual scientific publications. Preserving this software is of paramount importance to preserve our knowledge. It is is a necessary prerequisite to allow the replication of experiments, which is the foundation of the scientific method, as well as to ensure our ability to modify and correct the software components that are constantly being incorporated into critical systems that need to stay in production for decades. In this talk, we will review the challenges and opportunities we are facing, and discuss the role of Open Source as a key enabler. The slides of the talk can be found {{seminaires:irif:sem_irif_20160916_di-cosmo.pdf | here}}.