Subtle is the Lord by Abraham Pais (1982) chapter 4 "Entropy and Probability" mentions well how Boltzmann first thought that the second law was an actual base physical law of the universe while he was calculating numerical stuff for it, including as late as 1872.
But then he saw an argument by Johann Joseph Loschmidt that given the time reversibility of classical mechanics, and because they were thinking of atoms as classical balls as in the kinetic theory of gases, then there always exist a valid physical state where entropy decreases, by just reversing the direction of time and all particle speeds.
So from this he understood that the second law can only be probabilistic, and not a fundamental law of physics, which he published clearly in 1877.