I thought I'd post this in the hope it helps some poor soul like me who manages few sites and so upgrades infrequently. I was upgrading from 3.0.2 to 3.0.4 and got the Dang.. message. After a fair bit of headscratching, looking through error logs for clues, cussing, and threatening to visit the server with a sledgehammer for some percussive maintenance I finally discovered the answer to the problem.
When originally installing I had used two machines, my normal one and friends (I was at his house and he was picking the template for his site). He didn't have a nice ftp client installed so I had to make do. All went well and the site worked fine at this point.
Come upgrading time I sat at home and went through the process of copying var , modules, theme, etc to the new build, but I failed to notice something, all the theme files had the directories set to read only by the original upload. When I copied them over, the new top level directories were created; but as they were given the same permissions as the originals when it subsequently tried to transfer over the files it failed since the directories couldn't be written to. I didn't notice this, only noticing the new top level directories had been created.
My own silly fault of course, but it took ages to figure out what the simple problem was. It couldn't display the gallery as the template files to tell it how to create the gallery were missing!
So if you have problems upgrading try checking that all the files for those add-on templates, modules, etc. that you installed really copied across OK.