An interesting thing that we see in Libya is the schism between the east and west of the country.
The uprising against Gaddafi in 2011 started in the eastern part of the country, historically known as Cyrenaica (in Arabic Barqah برقة). Gaddafi lost control over Cyrenaica quickly, but not over the western part of the country (historically Tripolitania).
After the fall of Gaddafi, a federal entity was declared in Cyrenaica in 2012 under the name of Region of Barqah إقليم برقة.
I have not been closely following the events in Libya, but the clear thing is that the country has been divided since the beginning of the uprising against Gaddafi. Right now there are two parliaments in Libya, one in the east and another in the west. Each parliament has its own government that claims sovereignty over all of Libya.
The UN has helped in forming a new government for Libya that is supposed to unify the country. That government is headed by Fayez al-Sarraj, who hails from Tripoli. The international community helped al-Sarraj to go to Tripoli and take control of that city. Now it seems that al-Sarraj has earned good support in western Libya, but surprisingly (or rather unsurprisingly) the eastern Libyans have refused to recognize his Tripoli-based government. They have recently threatened that they would break away from Libya.
The eastern Libyans say that Tripoli is under the control of Islamist militias affiliated with the Muslim Brotherhood, and that they will not recognize any government based in Tripoli as long as those militias remain in it. They demand that any Libyan government should be under the protection of the “Libyan Army” headed by Khalifa Haftar, who hails from eastern Libya. They say that the government must present itself in front of the legitimate parliament in Tubruq (the eastern parliament) in order to obtain the confidence of that parliament and become a legitimate government.
If we believe what they say, the conflict in Libya is between Islamists in the west and non-Islamists in the east, but I doubt that this is the reality of the conflict. It rather seems that this is a regional conflict between the east and the west.
Historically Cyrenaica was either dependent on Egypt or independent. It was only in the 16th century that this country was attached to Tripolitania by the Ottoman Turks. However, the authority of Tripoli over Cyrenaica was more nominal than real. In reality, this country was mainly inhabited by Bedouins (nomadic Arabs) who did not recognize the authority of any government over them.
When the Italians landed at Benghazi and Tripoli in 1911, they found [Cyrenaica], except for [the modest urban centres Benghazi and Derna], to be entirely a country of Bedouin, without a single village outside the oases. The population was made up entirely of semi-nomadic and nomadic herdsmen, living only in tents.
— “Barḳa” in “The Encyclopaedia of Islam” (1986)
The modern country called “Libya” was invented by the Italians in 1934. Before that, the word “Libya” was merely a geographic expression that was used vaguely in reference to a region located to the west of Egypt (in Classical Arabic sources it was written Lûbyâ لوبيا or Lûbyah لوبية).
From a historical point of view, there is no justification for putting Cyrenaica under the control of Tripolitania. Tripolitania never conquered Cyrenaica and never really ruled it. The authority of Tripolitania over Cyrenaica was just an arbitrary administrative arrangement by the Ottomans and next by the Italians.
I understand why the eastern Libyans hate to be controlled by the westerners. That control is illogical and has no real basis in history. Having said that, I think that Libya can be kept as a unified country if the capital of Libya is relocated from the west to somewhere in the middle of the country.
The city of Sirt seems to me an appropriate capital for Libya, because it is located in the middle between Tripoli and Benghazi. However, I bet that many Libyans will hate making that city their capital, because it is the hometown of Gaddafi.
Any city in the middle of the country can work as a capital. They can even build a new city. Building a new capital is easier than a civil war, or dividing the country.
In Syria there is a somewhat similar situation concerning Aleppo and Damascus. However, Aleppo historically was never under the authority of Damascus, not even nominally. Aleppo was always larger and more important than Damascus. The people of Aleppo never accepted the authority of Damascus over them. That recent authority has been maintained by force and coercion. As soon as Aleppo becomes liberated of Assad, it is probable that Aleppo will break away from Damascus. Again, that should not lead to the division of Syria. Syria can be greatly stabilized simply by relocating the capital from Damascus to another city in the middle of the country.