Many previous researchers have reported the formation of carbonaceous tribofilms from organic lubricants on rubbing metallic surfaces. This paper shows that a very important factor in the formation of such tribofilms is the presence or absence of molecular oxygen. When steel surfaces are rubbed in saturated hydrocarbon lubricants in the absence of oxygen, for example in nitrogen or hydrogen gas, carbonaceous films form very readily, resulting in low friction and wear. However, when a significant amount of oxygen is present, as is the case in air, carbonaceous tribofilms are not generally formed, so friction and wear are very high, with values comparable to those seen when no lubricant is present. In situ Raman analysis combined with gas-switching experiments show that the carbonaceous films formed during rubbing when no oxygen is present are rapidly removed during rubbing in air, while tests in which lubricant is removed during a test in N2 indicate that the films are quite weak. This suggests that these carbonaceous films are being continually removed and replenished during rubbing in oxygen-free conditions. It is proposed that these carbonaceous films are formed from hydrocarbyl free radicals that are generated mechanochemically from hydrocarbon molecules during rubbing. In the absence of oxygen, these free radicals then react together to form a carbonaceous film. However, when oxygen is present, the hydrocarbyl free radicals react extremely rapidly with oxygen molecules to produce hydroperoxyl free radicals and so are no longer available to generate a carbonaceous tribofilm.Graphical abstract