May be that Ubuntu figures the battery won't last long enough to back up
your system properly and hibernates. My system shuts down when the
battery is about 10% charged or 90% discharged with out so much as a
warning. How long is won't last long, this is likely the problem. When
you mouse over the battery symbol how much time is figured to be left in
the battery?