I just spent the whole weekend trying to get the Windows 8 Release Preview and Visual Studio 2012 Release Preview running in a VM on my personal laptop. I think I may have it working now, though I’ve been burned by enough false starts that I’m not willing to call it yet. But I’ve certainly learned enough to be worth sharing.
If you’re more interested in the destination than the journey, skip ahead to the tl;dr.
Reasons for a VM
I didn’t want to install Windows 8 as the primary OS on my laptop, for two main reasons:
- I’m not impressed with its stability. The week I was at TechEd with the company laptop, the video driver crashed an average of twice a day. Sometimes it recovered, but sometimes (usually when waking from sleep) the machine bluescreened. (Granted, that’s just the video driver; but the Windows 7 video driver never had any problems.)
- My laptop came with some software called Beats Audio that seriously improves the sound quality. Because it was shovelware, I don’t have a separate installer for it, so I would have no way to install it on Windows 8, and watching Netflix would suck a lot without the good audio.
The second reason was really the biggie. What can I say? I bought this laptop for audio first, development second.
So my choices were between a VM and dual-boot. And a VM would make it a whole lot easier to switch back to Windows 7 to watch Netflix, so I was leaning strongly toward a VM if I could make it work.
Requirement: Run fullscreen
My laptop’s screen is 1366×768. Windows 8 disables some features, like Snap, if your screen is any smaller than 1366×768. Since I want to develop Metro apps, and test them with things like snapped mode, I have to be able to run my VM fullscreen. I assumed this wouldn’t be a big deal.
What a fool I was…
First failure: VirtualBox
I started with a c|net article called Install Windows 8 virtually with free software. It covered both VirtualBox and VMWare Player. I’ve used VMWare before (Workstation though, not Player), so I figured I’d try something new, and try VirtualBox first.
The version of VirtualBox I tested is 4.1.18. The UI is pretty clean and usable. I created the virtual machine, installed Windows 8, installed the Guest Additions, switched to fullscreen mode, and…
…it didn’t go fullscreen.
My laptop’s screen is 1366×768. VirtualBox, in fullscreen mode, only ran the guest at 1360x768. So there was a three-pixel black bar at the left and right sides of the screen.
I tried using Snap just on the off-chance that Microsoft had left a few pixels leeway on that 1366×768 requirement. They had not.
Six pixels. So close, and yet so far.
I did some research, and found that VirtualBox used to have a bug where it would round the width down to the nearest multiple of 8. (Which doesn’t make the slightest bit of sense. It’s not like it’s a memory-alignment issue; each individual pixel is already 32 bits, so everything is already 32-bit aligned.)
But they claimed to have fixed this bug 19 months ago. So either they broke it again, or they lied about having fixed it.
I found a StackExchange question from someone else with the same problem, and they claimed to have fixed it by going into the VirtualBox settings and bumping up the guest’s video memory to 128MB. But my guest was already set to 128MB of video memory; that had been the default. I tried increasing it to 256MB, but no good: the screen was still that fatal 6 pixels too narrow.
It was about this time that I decided to post a question on SuperUser and then try plan B. Alas, the question didn’t get an answer until I knew enough to go back and answer it myself. But that’s later.
Second failure: VMWare Player
I soon lost count of how many hoops I had to jump through just to download VMWare Player. I had to register, but I couldn’t register because they already had a registration under my e-mail address, but they wouldn’t accept my best guess at a password, so I had to do the “Forgot Password” and reset my password. Then I went back to the download page, and they prompted me to log in again. (Earth to VMWare: I just entered my new password when I reset it!) So I logged in again, and then they forgot what it was I had wanted to download. I used Google to find the download page again, and then they’d let me select the software to download, but they asked me to accept the license agreement first, and when I did, they promptly forgot what I was downloading again.
Downloading VMWare Player was almost as maddening as it had been trying to get VirtualBox to work.
But I finally did manage to get it downloaded. The version of VMWare Player I used is 4.0.4. I can’t say I care for the puffy blue window, but it seemed functional enough. Followed the instructions to get Windows 8 installed (apparently VMWare is pretty touchy about Windows 8 unless you perform all the right song and dance), and got it up and running. Great!
I installed the VMWare Tools in the guest, installed the Visual Studio 2012 release preview, created a new Metro grid application, ran it, and…
…FAIL. The app started up fine, the first screen animated in — and the instant the animation stopped, all the images disappeared.
The “Grid application” project template comes with some sample images that it displays on the grid tiles. They’re all various shades of solid gray, but they’re still images. And apparently the video driver in VMWare Tools has a problem with the way Metro apps display images. So as soon as the screen is done animating in, all the tiles vanish, and all that’s left is the text.
Older versions of Windows had someplace in Display Options where you could ratchet down the video acceleration if things weren’t displaying properly, but either Windows 8 doesn’t have those options anymore, or they were disabled for the virtual video driver inside VMWare. I looked inside the VMWare Tools options, but there was nothing about graphics acceleration. And unlike VirtualBox, VMWare doesn’t seem to have video acceleration options in the host app. Nowhere could I find even a single knob to try to fix this problem.
And there’s no way in hell I can develop a Metro app in a VM that can’t show half the app’s UI.
I spent a while longer trying to make this work. I tried a refresh of Windows, in case it was some Windows setting that had gotten out of whack. Then reinstalled VS2012, re-created my project, re-ran it. And the images re-disappeared.
There’s not even anywhere to go from here. Dead-end on VMWare Player.
Third failure: Forcing Snap
During the course of my research, I had run across some articles that said there was a Registry setting that would force Windows 8 to always enable Snap, even if the screen resolution was too low.
I figured I could give that a go; as long as I planned carefully, the six-pixel error might not throw off my testing too much. So I went into my six-pixels-too-small VirtualBox VM, created the Registry setting, and tried snapping some apps. But the “snap” gutter never appeared: it just wanted to task switch, not snap.
Well, maybe I need to restart Windows in the VM before the setting will take effect. Tried it. Still no good.
It looks like the “force Snap” Registry hack no longer works in the Release Preview.
Eventual, roundabout, partial success: Remoting into VirtualBox
VirtualBox has a feature where it can run an RDP server, so you can remote into your virtual machine. So I figured, hey, maybe I can minimize the VirtualBox window and Remote Desktop into the VM. Remote Desktop doesn’t have any stupid multiple-of-8 restrictions, so it might work.
So I went into VirtualBox and enabled “Remote Display” (their name for their RDP server), and then tried to connect to it.
Here’s a little tip for UI designers: if a particular feature will only work if the user has installed an add-on product, then don’t show the UI options for configuring that feature unless the user has actually downloaded and installed the necessary add-on. I burned quite a bit of time trying to figure out why all my settings were accomplishing nothing. Turns out you have to download and install the VirtualBox Extension Pack before VirtualBox will actually support all the RDP options you’ve spent the last hour fruitlessly trying to configure.
If you want to try to use VirtualBox’s RDP support, don’t expect it to work in any kind of reasonable way; just save yourself time and read the manual. I finally got it set it up, and managed to get the headless server started from the command line.
And Remote Desktop connected! And gave me a black screen.
So I minimized Remote Desktop and looked in the server’s console window, to see if it had reported any errors. It had not, but now I noticed a mysterious new window on my host machine, and it looked like it was showing the VM screen that was supposed to be getting sent over Remote Desktop. This mystery window’s title bar said “Chromium Render SPU”, so off to Google I went.
Turns out the problem here is VirtualBox’s 3D acceleration. If you have 3D acceleration enabled, then the host renders to the mystery window instead of to RDP. Very screwed up. But the message-board thread said all you have to do is disable 3D acceleration, and Remote Desktop will start working.
So I shut down my VM (trying to click in about the right place in Remote Desktop to hit the “power” icon, then minimizing everything so I could look at the mystery window and see if I’d clicked in the right place; rinse, repeat), then went into my VM’s settings and turned off 3D acceleration, connected Remote Desktop again, and ha, I got a login screen!
I maximized the Remote Desktop window, and it went fullscreen, but the remote desktop was only 1024×768, centered on my 1366×768 screen. So I went into “Screen resolution” on the remote machine, and lo and behold, for the first time in VirtualBox, 1366×768 was an option in the list! I selected it, and…
…it worked. My VM was running fullscreen at 1366×768.
Then, on some crazy whim, I shut down the VM, opened it the normal way through VirtualBox Manager, and it was still 1366×768. Something I had done while trying to enable Remote Desktop had actually fixed the original problem!
Coming down from the euphoria, and a conclusion
So somehow, in this long crazy string of events, I had done something that had finally kicked VirtualBox over the hump and into proper fullscreen support. I was a little nervous about touching anything at this point, lest it revert to its original broken state. But at the same time, I like to clean up after myself. I don’t really want an unauthenticated RDP server running on my laptop anytime I’m running Windows 8.
So I started backing out my changes. I turned off the RDP server. And as long as I’m running locally, I might as well turn 3D acceleration back on. Restart the VM…
And at this point I had an inkling of a suspicion. (And it was this suspicion alone that kept me from descending into madness.) I shut down the VM, turned 3D acceleration back off, and started the VM.
Worked like a charm. Fullscreen goodness.
What a letdown. I had burned an entire freaking weekend on what boiled down to a single buggy setting.
(What’s worse, I can’t even report the bug without giving Oracle three forms of ID and a note from my mother. Who the hell made the Marketing department the gatekeepers for the bug tracker?)
Anyway, the VM seems to be working so far. No blank screens, no mystery windows. It actually does run fullscreen, no black bars, the full 1366×768. I can snap apps like a champ. I installed VS2012 in the VM, created a new grid app, and ran it, and not a single image disappeared. It all seems fine, though of course only time will tell.
One freaking setting.
To run Windows 8 in a VM: Don’t bother with VMWare Player. Use VirtualBox and disable its 3D acceleration.