Recently, I got a new SSD (Sandisk 256 GB in case you’re wondering) and as part of setting it up, I decided to clean install Windows 8 instead of moving my existing Windows 7 setup over. One of the things I wanted to try out was the integrated Hyper-V support in Windows 8 to host my Ubuntu VM instead of using VMWare Player. Windows 8 Pro has native Hyper-V but you’ll need to turn it on from Control Panel/Programs/Turn Windows features on or off. Please note that if you turn on Hyper-V you cannot install VMWare Player on the machine. You will need to turn off Hyper-V if you need to install VMWare Player – the two cannot co-exist as of now.
One of the first tasks I needed to accomplish was to migrate the existing VMWare Ubuntu VM hard-disk to Hyper-V. You can do this using 2Tware convert VHD (available here). Using this freeware, you can convert the VMWare disk into VHD format. Now all I needed to do was setup a new VM in Hyper-V and attach the VHD to this VM. Everything worked remarkably well – Microsoft has released Linux drivers for running Linux VMs under Hyper-V and Ubuntu LTS 12.04 has these drivers as part of the image. So my old VM worked flawlessly on Hyper-V (networking was fine, mouse and keyboard were mostly fine).
There was one hitch however – the maximum resolution of X in my VM was set to 1152×864. Turns out the current video support for Linux in Hyper-V only allows a maximum resolution of 1152×864 (basically you’re using the VESA framebuffer video driver as there’s no synthetic video driver for Hyper-V yet). The good news is that Microsoft has already added the synthetic video driver with resolution support for upto 1900×1200 to the Linux kernel. However, it is going to be a while before this shows up in a LTS Ubuntu distribution. In the meantime, a much better solution exists for working with your Linux VM from your Windows machine – note that this tip actually applies to both VMWare and Hyper-V and for the most part, I prefer this setup over running the VM full-screen.
The trick consists of the following steps:
- Run PuTTY to establish an SSH session with your VM. Enable tunneling of X over SSH in the PuTTY options
- Run an X server on your windows machine – xming is what I use. It works with no configuration hassle.
- Now you can launch any X program from your PuTTY session and it will show as a native window in your Windows machine.
With this setup, I interact with the VM much better (this is very similar to, but IMO better than VMWare’s Unity mode). Of course, if you really want a Linux Window Manager and a richer environment like KDE or Gnome or Unity you’ll need to configure xming so you run it in one window mode. For me, since I mostly work in the Linux terminal, gvim and xemacs, the multi-window mode is much more useful.
Update 8/16/2014
Finally updated one of my VMs to Ubuntu 14.04 – the resolution was still stuck at 1152×864. A quick check of loaded modules with lsmod showed that the hyper-v synthetic frame buffer driver hyperv_fb was loaded. A brief search helped me figure out that I needed to pass in a kernel option at boot. So to get the higher resolution, add this to /etc/default/grub:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video=hyperv_fb:1920x1080"
Then run sudo update-grub and reboot your VM and now you should be able to get your VM at 1920×1080 resolution.
1920×1200, not 1900×1200
Awesome, this worked great. I had several issues trying VNC and NoMachine NX. This is so much better.
I wonder if you can go more step by step how to get putty and x working with Ubuntu vm? I installed xming and putty on Linux but now don’t know what to do
Tim – you install PuTTY and xming on your Windows machine that is the host for the Linux VM. Start XMing on your Windows machine. After that use PuTTY to connect to your Linux VM over SSH after setting Connection/SSH/X11/Enable X11 forwarding option in the PuTTY configuration. Now when you launch X programs from the PuTTY session it will show up as a regular window in your Windows machine.
Hmm, didn’t get far as the instructions are too high level.
As with others, my problem is trying to get a Hyper-V VM running at a resolution greater than 1152×864.
I installed a fresh copy of Ubuntu 13.10 under Hyper-V (at 1152×864 resolution in the console). I then ran ‘sudo apt-get install openssh-server’, which installed SSH. I tested that it works OK.
I then downloaded/ran xming on my Windows host, and it seemed to start in the background. Not sure how that works.
I then ran PuTTY (instead of my usual GitBash) and enabled X11 forwarding as mentioned in one of the comments (and not the instructions). It asked for a display, which I left blank.
I then SSH’ed into the Ubuntu server and ran ‘sudo startx’ and nothing happened.
I think running startx is the problem – startx starts a local X server. This technique works only to start regular X client programs on your host machine. Try running say xterm instead of startx and see if that shows up in your host machine.
Awesome…Thank you boss!
Works, thanks!
Thank you so very much for the solution under your update. So much easier than I feared 🙂
Best Regards,
Works for me, Thanks
Yes, I changed the ‘/etc/default/grub’ file directly (running Ubuntu 19.04). The display is now 1920×1080.
Having a ‘heckuva’ time getting ssh to work (using PuTTY and Windows 10 ssh).
Will now embark on the ‘adventure’ to get ssh to work (Windows to Ubuntu).
Many thanks for the post!
Goes to show that even ‘old’ posts do indeed work!!