Any Idea what's happening with our peeling roof painting?

I'm not sure why this is happening or the best way to fix it - it's a mid-90s developer house, so obviously everything was done as cheaply as possible. I'm looking at repainting the house with some better quality paint, but not sure the best way to address the ceiling.

Any ideas / tips?