Perpetual motion relies on 100% energy conservation, which isn't possible if there is any friction. As more and more energy becomes unavailable the motion will gradually slow down. In this case, some of the mechanical work is converted into thermal energy due to friction. In this process, available energy for mechanical work is lost (entropy increases), as it is impossible to convert thermal energy to mechanical work in a 1:1 ratio as described by the second law of thermodynamics.