Liu Bobo was born in 381, when his father Liu Weichen was an important Xiongnu chief and a vassal of Former Qin.
It is not known whether his mother Lady Fu was Liu Weichen's wife or concubine.
He was one of Liu Weichen's younger sons.
After Former Qin collapsed in light of various rebellions after its emperor Fu Jiān's defeat at the Battle of Fei River in 383, Liu Weichen took control of what is now part of Inner Mongolia south of the Yellow River and extreme northern Shaanxi, and while he nominally submitted to both Later Qin and Western Yan as a vassal, he was actually a powerful independent ruler.
However, in 391, he sent his son Liu Zhilidi to attack Northern Wei's prince Tuoba Gui, and Tuoba Gui not only defeated Liu Zhilidi, but crossed the Yellow River to attack Liu Weichen's capital Yueba (in modern Ordos, Inner Mongolia), capturing it and forcing Liu Weichen and Liu Zhilidi to flee.
The next day, Liu Weichen was killed by his subordinates, and Liu Zhilidi was captured.
Tuoba Gui seized Liu Weichen's territory and people and slaughtered his clan.
However, Liu Bobo escaped and fled to the Xuegan tribe, whose chief Tai Xifu refused to turn him over despite Northern Wei demands.
Instead, Tai delivered Liu Bobo to the Xianbei tribal chief Mo Yigan, the Duke of Gaoping, a Later Qin vassal, and Mo Yigan not only gave Liu Bobo refuge but also married one of his daughters to Liu Bobo.
Liu Bobo, from that point on, became highly dependent on his father-in-law.
(Meanwhile, in 393, Tuoba Gui, because of Tai Xifu's refusal to deliver Liu Bobo to him, attacked Tai and slaughtered his people, although Tai himself escaped and fled to Later Qin.)
Little is known about Liu Bobo's life during the following years.
In 402, Tuoba Gui's brother Tuoba Zun, the Prince of Changshan, attacked Mo's home base of Gaoping (in modern Guyuan, Ningxia), and Mo was forced to flee to Later Qin, abandoning his own people, who were scattered about, although later Later Qin recaptured Gaoping and gave that city back to Mo.
Sometime before 407, Liu Bobo, who has become known for being handsome, ability to speak well, alertness, and intelligence, had come to the attention of Later Qin's emperor Yao Xing.
Yao Xing had been so impressed by Liu Bobo's abilities when he met Liu Bobo that he wanted to make him a major general to defend against Northern Wei.
Yao Xing's brother Yao Yong, however, spoke against it, believing Liu Bobo to be untrustworthy.
Yao Xing initially, at Yao Yong's counsel, did not give Liu Bobo a commission, but eventually was so seduced by his talent that he made him a general and the Duke of Wuyuan, giving him the responsibility of defending Shuofang (in modern Ordos as well).
In 407, after suffering a number of losses against Northern Wei, Yao Xing decides to make peace with Northern Wei.
Upon hearing this, Liu Bobo becomes angry, because his father had been killed by Northern Wei, and he plans rebellion.
He therefore forcibly seizes the horses that Yujiulü Shelun), the khan of Rouran, had recently offered to Yao Xing as a tribute, and then makes a surprise attack on his father-in-law Mo Yigan, capturing Gaoping and killing Mo, seizing his troops.
He then declares himself a descendant of Yu the Great, the founder of Xia Dynasty, and names his state Xia.
He claims the title "Heavenly Prince" (Tian Wang).
Despite Liu Bobo's stated hatred for Northern Wei, he concentrates his efforts on undermining Later Qin, continually harassing Later Qin's northern territories and draining Later Qin's resources.
He therefore does not settle in a capital city; rather, he roved about with his mobile cavalry, constantly looking for Later Qin cities to pillage.
Also in 407, Liu Bobo seeks marriage with a daughter of the Southern Liang prince Tufa Rutan, but Tufa Rutan refuses.
In anger, Liu Bobo launches a punitive raid against Southern Liang, then retreats.
Tufa Rutan gives chase and, believing that he greatly outpowers Liu Bobo, is careless in his military actions.
Liu Bobo leads him into a canyon and locks the exit with ice and wagons, then ambushes him.
The defeat is such that it was said that sixty to seventy percent of Southern Liang's famed officials and generals died in the battle.
Tufa Rutan barely escapes capture.