After spending about four years in the service of the engineering department, in 1848 he was assigned to the 77th Tengin Infantry Regiment with the rank of second lieutenant and immediately took part in the Caucasus campaigns.
On June 23 1867 Golovachev was promoted to major general, with the appointment of the military governor of the Syr Darya region in Turkestan, and on September 21 he arrived in Tashkent, the place of his new service.
In April 1868, the Bukhara campaign began, the result of which was the conquest of almost the entire Miyankal valley and the capture of Samarkand, Golovachev himself directly commanded the troops in the battles on the Chapan-Ata heights and at Zerabulak.
On 17 September he set out with a retinue and an escort and crossed the Kyzylkum steppe to Min-Bulak and then, connecting with the speaker who spoke to him about the Kazalinsky detachment, he returned through Irki-Bai to Kazalinsk.
In the same year, on July 7, after the occupation of Khiva by Russian troops, he was instructed, with a part of the Turkestan detachment and with two Caucasian (Sunzhenskaya and Dagestan) mounted irregulars, to punish the Yomud Turkmens who refused to fulfill the demand of Governor-General von Kaufman regarding payment of indemnity.