It is possible to excite rotations around the axes perpendicular to the bond of a linear molecule. However, rotation around the axis along the bond of the molecule would require huge energies, due to the much smaller moment of inertia which is inversely proportional to the energy. This is explained in more detail here: In counting degrees of freedom of a linear molecule, why is rotation about the axis not counted? 1
Therefore, out of three possible rotational degrees of freedom, only two are applicable to our linear molecule. The third rotation can't be accessed and is 'frozen out'. Thus a linear molecule is said to have two rotational degrees of freedom, as this third parameter would give us no extra information about the system.
Non-linear molecules have 3N degrees of freedom in total. We know 3 are translational, 3 are rotational (all are allowed for non-linear molecules) so the remaining 3N-6 are vibrational.
Linear molecules have 3 translational and only 2 rotational, and to keep a total of 3N degrees of freedom, they now need 3N-5 vibrational.
Why does the 'frozen' out rotational degree of freedom for linear molecules not count? As stated above, knowledge of it gives no extra information about the system, but at what point does a degree of freedom count as 'frozen out' and need to be compensated for by other (vibrational) degrees of freedom? And is there a deeper, physical argument beyond "everything needs to add up to 3N"? Why 3N, in this case?
In the general case, any molecule can be cooled down so that various degrees of freedom are gradually frozen out. Are these degrees of freedom replaced by others, and how does the system then know how to vibrate, say, in a different way?
I'm aware that I'm missing something here, possibly a fundamental flaw in how I currently understand the concept of degrees of freedom, and I greatly appreciate any help.