You are (probably) more likely to observe the barrel rolling backwards just before stopping when it rolls on a hard surface such as concrete, steel or marble. This happens because the centre of mass (CM) might not be exactly at the geometrical centre (centroid) of the barrel.
If the CM is behind the point of contact with the concrete when the barrel stops, the torque on the barrel could be big enough to turn it backwards. It might again overshoot and then rock forwards and backwards until its energy is dissipated by friction and the CM lies vertically above the point of contact.
This is much less likely to happen on grass because the rolling resistance to motion is higher. There is more deformation of the ground compared with a hard surface like concrete, so the torque due to rolling resistance is more likely to be higher than that due to the asymmetric CM, unless the CM is very far from the centroid.
The textbook is probably alluding to rolling resistance, a backward force which results from deformation of the barrel and the ground. This deformation is partially elastic and stores energy. While the barrel is rolling, the surface ahead is more deformed than the surface behind, so there is a backward force on the barrel. When the barrel stops, the surface ahead is still more deformed, causing the barrel to roll backward until these deformations are equal.