What happens when the bacteria in the petri dish lack nutrients for long time?
They will die, eventually.

The requirement for energy is a thermodynamic constraint; maintaining cellular structures, repairing molecules that spontaneously damage etc takes some energy, and E. coli is not able to reach a level of quiescence sufficient to survive for years. However some cells might survive longer than expected if they enter low-metabolic activity states; that would not be enough to survive years in a petri dish, though.

Note that other species may be able to survive, through special stress-induced processes such as sporulation or cryptobiosis.