Opensource was not Suns problem
Sun never recovered from the dotcom burst of 2001 and instead of trying to remain competitive against IBM, HP, Compaq, and others, they were churning out all the same stuff as before. They then cut their support staff and the problems with their hardware started to take its toll. It was Fujitsu that really did them in however. They beat Sun at its own game. They made a more reliable Sparc machine with better after sale support. Sure Fujitsu servers cost more, but customers were willing to pay the difference once they realized just what it was that set the two companies apart.