When Ibn Sina was 22 years old, he lost his father. The Samanid dynasty came to its end in December 1004. Ibn Sina seems to have declined the offers of Mahmud of Ghazni, and proceeded westwards to Urgench in modern Turkmenistan, where the vizier, regarded as a friend of scholars, gave him a small monthly stipend. The pay was small, however, so Ibn Sina wandered from place to place through the districts of Nishapur and Merv to the borders of Khorasan, seeking an opening for his talents. Qabus, the generous ruler of Tabaristan, himself a poet and a scholar, with whom Ibn Sina had expected to find asylum, was on about that date (1012) starved to death by his troops who had revolted. Ibn Sina himself was at this time stricken by a severe illness. Finally, at Gorgan, near the Caspian Sea, Ibn Sina met with a friend, who bought a dwelling near his own house in which Ibn Sina lectured on logic and astronomy. Several of Ibn Sina's treatises were written for this patron; and the commencement of his Canon of Medicine also dates from his stay in Hyrcania.

At what age did Avicenna lose his father?