Thursday, September 27, 2012

Windows 8 - Fast-start and hybrid sleep

Windows 8 is around the corner... but already many people have been testing it and dual-booting with Ubuntu. One of the new features they've stumbled across is the new 'fast-start' and while it works okay with Wubi, it doesn't play well with a normal Ubuntu dual-boot. But hybrid sleep is a bit of a nasty piece for Wubi  (assuming the bug I'll describe here doesn't get fixed by Microsoft).

What is fast-start?
Microsoft figure that hibernation is awesome, making booting really fast. But for some reason, not all users are comfortable with it. I know, I've run into some users with hibernation-anxiety in the past: comments like "it will run down my battery", or "it fails to resume after a few times"... etc.
So Microsoft thought, what if we don't tell users that they're hibernating - then it will be quick to startup and they'll be none the wiser. Hey presto, welcome to 'fast-start' or what I like to call partial, hidden, hibernation. As described here:
"Now here’s the key difference for Windows 8: as in Windows 7, we close the user sessions, but instead of closing the kernel session, we hibernate it. Compared to a full hibernate, which includes a lot of memory pages in use by apps, session 0 hibernation data is much smaller, which takes substantially less time to write to disk. If you’re not familiar with hibernation, we’re effectively saving the system state and memory contents to a file on disk (hiberfil.sys) and then reading that back in on resume and restoring contents back to memory. Using this technique with boot gives us a significant advantage for boot times, since reading the hiberfile in and reinitializing drivers is much faster on most systems (30-70% faster on most systems we’ve tested)."

So what's the problem?
Anyone who dual boots knows that you can't mount your windows partitions read-write when they're hibernated. And now even when you don't think they're 'hibernated' they might be. So that's clearly a problem for a normal Ubuntu dual-boot. It's not a problem for Wubi because the Windows Boot Manager is smart enough to recognize that when you boot some 'other' OS (basically anything other than the default Windows 8 option) it removes the hibernated 'state' before proceeding. By the time Wubi gets to boot the partition is free to be mounted. That's different to a normal dual-boot where you have the Grub2 bootloader installed. Probably this will lead to bigger uptake of the easyBCD solution - where you can boot a normal Ubuntu dual-boot via the Windows Boot Manager.

When does the 'fast-start' occur?
Only when you Shutdown windows, not when you Restart the system. That's fine if you're rebooting into Ubuntu, but shutting down and booting up Ubuntu later won't work. Oh and trying to install Ubuntu when doing a cold boot on a USB thumb-drive will probably give you problems.

What about the hybrid-sleep?
This is a nasty little piece (for Ubuntu anyway). Basically, the idea is that it saves your session to disk and goes into an ultra-low power consumption mode. But it leaves some artifacts that make it appear as if you're hibernated. And the catch? It isn't cleaned up with Restart, only with Shutdown. So this is the opposite of the fast start, in that you have to shutdown after sleeping to clear the artifacts... and this does affect Wubi.

For Wubi what will you see?
If you have hybrid-sleep enabled and you try to boot, you may see a message saying that the partition cannot be mounted because it is hibernated. Then the fix is to boot back into Windows, and Shutdown. Or better, turn off hybrid-sleep. As far as I know, hybrid-sleep is not switched on by default, so avoid switching it on. In my own tests, it wasn't clear what was happening because the busybox prompt with the error message wasn't being displayed at all, just a purple screen. And booting in recovery mode mounts drives as read-only so the problem wouldn't be apparent either. I had to edit my grub boot options just to see the error. (This is probably specific to my graphics setup, but be prepared for this symptom). Note, in my opinion, this is a Windows bug - surely Microsoft don't intend to leave the computer in a 'mixed' hibernated state? But whether they intend to fix it before release is unclear.

For normal dual boot, what can you do?
You can boot Ubuntu using easyBCD as stated before... maybe this will be the golden era for easyBCD. Or you can simply turn off fast start and hybrid-sleep (this last link isn't specific to sleep but does show how to get to the advanced sleep settings)

No comments:

Post a Comment