The "revolution" was done by the Tripoli (western) tribe, against the Cyrenaica (eastern) one - it was more a civil war starting than a popular uprising.
Gaddafi could have indeed crushed them, bring back order to the country, avoiding the current long lasting chaos, civil war, open slavery, migrant waves and so on.
It's hard to evaluate situations with a westerner mind, in countries that are structured around very different cultural norms, and with deep ethnic divisions. "Democracy" is not the silver bullet it those cases, and maybe we should acknowledge that.