Probably cheaper and less hassle to just get it repaired. Might be just dirty inside. Find a good car audio shop that does a lot of high end stuff (not a chain store) and ask them what their 'bench fee' is (minimum fee to look at it) and if they will apply the bench fee to the repair, should you decide to do it.
As for codes, etc., the audio shop might know what's involved here. Sometimes you have to match the new/used deck to the car's computer, sometimes not, it's just plug and play. All cars are different in this respect. If the audio shop advises you to get a used deck, then yeah, eBay is probably the best bet.
Sure you could sell the car with a broken CD deck, as long as you tell them (do unto others, etc).