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)

Friday, September 14, 2012

12.04.1 wubi.exe released... Wrong version error

With the 12.04.1 release, Wubi.exe was also bumped to 12.04.1. For those that don't know, Wubi.exe is very particular about which version it will install: it first checks the ISO and rejects it if it doesn't match.

DEBUG Distro: wrong version: 12.04 != 12.04.1
So, why is this a problem? Simply that not all flavours of Ubuntu e.g. Lubuntu/Xubuntu/Mythbuntu get a 12.04.1 ISO released. And Wubi.exe is clever enough to know that - it still has the address for the 12.04 ISOs for these flavours and will happily download the entire thing... and then stupidly reject it.

So that all seems rather pointless and frustrating to the users. Especially since the same thing happened with 10.04.1 - someone might've figured out the pattern by now. But in their defence, it's taken me 10 minutes to write up this post, so you can see why it'd be so difficult to fix.

Actually a look at the code indicates that Wubi.exe for 12.04 will happily install a 12.04.1 ISO, just not the other way round. So if they had just left it at 12.04 and updated the link to the 12.04.1 ISOs then... no breakage.

Workaround
An easy workaround is to use the 12.04 Wubi.exe for your favourite flavour (anything other than Ubuntu... except Kubuntu which has been broken for Wubi installs since 12.04 was released). So you can install Xubuntu, Lubuntu, Mythbuntu, Edubuntu in this manner. Here is a link to it: http://people.canonical.com/~evand/wubi/precise/wubi-r266-signed.exe

Update
Probably to repay me for doing just 10 minutes of research, I've found out that Xubuntu, Mythbuntu, Edubuntu and Kubuntu all have a 12.04.1 release. So in fact, it's Wubi 12.04.1 that is at fault here for not updating the metalinks. It's only Lubuntu that's stuck on 12.04. Either way, none of these work without some manual workaround.

Workaround part 2
If you want Kubuntu, Mythbuntu, Edubuntu or Xubuntu, download the ISO first, save it in the same folder as the 12.04.1 Wubi.exe and run wubi from there (disconnect from the Internet prior to running).