Well, plants famously don't eat much more than sun light, water and carbon dioxide. Otherwise they just need phosphorus, nitrogen and some trace elements.
Moss has already adapted to barren environments. Its niche is growing where nothing else grows. Like, on top of rock. It's not having roots, not mingling with modern temptations in the soil. Most mosses actually aren't doing well in competitive, complex ecosystems full of nutrients and such.
While animals could never live by themselves, some autotrophic bacteria can.
A community of several different kinds of bacteria would have better chances than a single species, but for bacteria there is certainly no need for thousands of species.
Autotrophic bacteria would need only an environment providing less than 20 essential chemical elements (most of which belong to the most abundant elements, a notable exception being molybdenum) and either solar light for energy, neither too little nor too much, or a chemical source of energy, like dihydrogen + carbon dioxide, which can be provided by volcanic gases or by the reaction of water with volcanic rocks.
There would have been many places in the Solar System suitable for bacteria, except that where there is water, it is usually too cold, and where it is not too cold, there is no water.
For a photosynthesizer minerals water, sun and co2 should be enough I think? Maybe oxygen is needed too unless it's able to store oxygen for respiration. Now eventually it might start running out of some resource or building up toxic levels off something so you gotta hope that that happens slow enough that evolution is in time to fix those issues.
Think fewer cells. Like one.
you missed something, in that it is impossible to get perfectly sterile living animals or plants, and all* of them are carrying a large vaiety of bacteria, viruses, spores, and other animals eggs, etc.
everything is an inoculant
* I am aware of various experiments that did attempt to raise animals in perfectly sterile environments, where they died, but the only way to sterilise and maintain sterility, are extream, and largely impossible while keeping any single lifeform, alive.ie: it is far from the default