 Li Keyong went to Zhenwu as well to serve under his father.As of 878, Li Keyong was serving as the deputy commander of the Shatuo troops at Datong Circuit (大同, headquartered in modern Datong, Shanxi) and stationed at Yu Prefecture (蔚州, in modern Zhangjiakou, Hebei).At that time, the commander of the Shatuo troops at Datong was Li Jinzhong (李盡忠), who, along with his officers Kang Junli, Xue Zhicheng (薛志誠), Cheng Huaixin (程懷信), and Li Cunzhang considered the Tang realm to be in such disarray due to agrarian rebellions (the chief of which was Huang Chao's rebellion), and Li Jinzhong wrote Li Keyong, encouraging him to overthrow the defender of Datong, Duan Wenchu (段文楚), who had drawn the ire of the soldiers by deducting their clothing and food stipends and being harsh in his enforcement of laws.