Ask HN: How Is Developing on a Linux VM in Windows?

56 points by jb1991 ↗ HN
Compared to an actual Linux install.

I'm thinking of a MS Surface Pro and am curious how it would be to do my Linux work in a VM.

66 comments

[ 3.4 ms ] story [ 126 ms ] thread
One of my former bosses did that, already more than 5 years ago. He used to be full-time programmer but was more on the business side. Seemed to work out pretty well..
I spend pretty much all of the time on my work computer inside of a FreeBSD virtualbox VM, and very rarely do I ever notice that I'm not running on bare metal. If your machine has the horsepower then it should do just fine.
I do pretty much all of my development in a VM because it's easy to manage and control development environments. It works very well, but I'd make sure that you have a fairly powerful machine.
I did a project at work in a Linux VM due to the limitations of the Windows file system. It was great, especially taking advantage of being able to make snapshots of the system at times.
If you do it with Vagrant it's not painful at all because you can then make easy directory maps to access the files. I've done this for years.

Windows 10's WSL (Windows Subsystem for Linux) is pretty amazing though. If you're only doing command line stuff, you might be able to get almost everything you want done with that instead. I managed to configure mine to run my tmux and vim configurations, get Ruby running, and install the Ubuntu version of Vagrant to provision some DigitalOcean machines. It all worked relatively easy.

The only stumbling block I ran into is that the Bash shortcut doesn't drop you to a login shell, so my .profile wasn't executing. From Powershell, start bash with --login or append --login to the Bash shortcut, and everything works pretty darn well.

But if you're gonna go the VM route still, just make sure you have tons of RAM. My 4gb Surface doesn't do a horrible job, but after the summer Windows update, I feel the pinch more than I used to.

Hope that helps!

+1 for using Vagrant. This lets you bring instances up and down much more easily. Also, for most things you need (like say a Rails/nginx stack, or a LAMP stack) there's a prebuilt Vagrant box you can start from.

Also, some modern IDE's have Vagrant support natively, which allow you to work transparently in whatever Windows IDE you like, and operate your VM from there.

I have done this with Ubuntu on VirtualBox on a Thinkpad. It definitely spins up your CPU. VirtualBox has lots of configuration voodoo to make it "fast". I also never got file sharing to work perfectly between host and VM. It always had some sync or lock issue. I eventually gave up and used ssh plus vim. (At that point I should have just switched to a Digital Ocean VPS)

The experimental Ubuntu bash command prompt in Windows 10 is a great idea, but not quite ready for Rails development. Too many breaking bugs (check the GitHub repo for context)

I eventually gave up on that, and bought a MBP. I still wish I could use Windows for my Dev box, but I just can't recommend it (yet)

works ok for me with one exception. If you use Microsoft dev tools (like Visual Studio) to work on source trees contained in the vm file system, that gets nasty. Specifically, VS likes to poll files and directories for changes. That can push the envelope of the shared file system setup.

But that's an odd use case for most people.

I use Linux in a VM almost daily at work (embedded shop that ended up with some projects that had better/easier tooling on Linux than our usual Windows).

It works pretty well. In particular, and a reason I use VMs at home for my own stuff, being able to make snapshots or very specialized machines is wonderful. In order to facilitate quicker collaboration, we use a common baseline that's easily distributed to new project members, or used to recover a borked image. This also means we have a canonical image to use for building releases.

I can say, I've got a shitty laptop at work and it runs RHEL in VMWare without much difficulty. MS Surface Pro should give you a fine experience.

I know a long time open source C developer who uses Linux VMs from windows. His work has been utilized by millions of people worldwide. It seems to be a workflow that works for him. All the other engineers run Linux directly.
Working with Vagrant and VirtualBox on Windows was very buggy for me because of slow file sharing, until I enabled NFS. This requires a plugin for Winnfsd and typically some modification of your Vagrant configuration, but for me it was definitely worth setting up for the performance gains.
Terrific? I've worked this way for years.
I have done this for a few years and I am really happy with it. The portability to migrate to new host hardware is awesome. I periodically export VM images and back them up to the cloud using cloud sync software on the host machine (it takes a long time to upload, but gives me a viable backup). On my dual monitor setup, I typically run full screen on one monitor.
same here. When I was looking for a new laptop support for 32GB RAM was a key (no mac for me). I have 4 vms, windows with dev rig, linux with django/postgres, linux with oracle and osx. For vitalization I run VMWare Workstation patched with unlocker. The only pain comes from osx, no 3d acceleration and since upgrade to ElCaptain, there is no way to disable vsync, so it is ugly. The missing 3d support can be very annoying - you can not use "debug view hierarchy" in xcode. Saving VMs to external disk for backup. Snapshoting before any risky update/patch/whatever.
I do it. It helps to always have the VM on in the background, so logging into it is as easy as firing up cygwin and ssh'ing in. Also, you should set up samba, so you can edit files in your text editor of choice remotely.
Why not just work directly in the VM? I mainly use emacs on OSX now, so I would expect it to feel natural.
I only have an i5 and 6 GB of Ram, so running directly in the VM isn't that good on performance. I just run a linux server as a VM, not a full desktop. It works well for me.
I switched from a Macbook earlier this year. My workflow is based around vim.

I started out using virtualbox, which was actually pretty great for me, and I still fall back to it for some projects. I don't develop games or anything, but for the simple task of making and running web & shell software, it works flawlessly.

However, since a lot of my work is remote over ssh anyway, I've been really pleased with Bash on Ubuntu on Windows, and I use that more and more. I thought it sucked at first because of colors, then I realized I can run X server and xterm, and then my shared ssh config and key files work for me out of the box on windows without having to mess around with putty.

I have been doing it full time for a number of years and it's quite good.

I have a free screencast based guide on how to set everything up so you can run both operating systems together seamlessly complete with independent VM windows, clipboard sharing and drag/drop, etc..

Details can be found at: https://nickjanetakis.com/blog/create-an-awesome-linux-devel...

P.S., if you're wondering why I still do this and don't use the Windows Subsystem for Linux, I have another post on that too:

https://nickjanetakis.com/blog/i-almost-rage-bought-a-macboo...

I did this for a while, works fine. Be sure you install the stuff to share the clipboard and directories. I eventually switched to cygwin for what I was doing. It damned good nowdays but doesn't get any love.
I've been on a mbp for 4 years and just switched to windows. My biggest issue is the file sharing. I'm using vagrant/virtualbox with smb and a server process running off a shared filesystem is noticeably slow. I've resorted to having my files within the VM which is much much better. I'm used to using Emacs so its not a problem for me. PS: I'm running off 2 nvme ssds in raid 0 so I don't think disk is the issue.
I run Ubuntu 16.04 VM using VMWare Workstation Pro on Windows 10 and I love it. I rarely go to Windows. One great thing I love about running the VM is being able to make clones. If I screw up my dev environment, I don't need to set it up again, I just use a previously created clone which I store on another disk. This advantage alone gives me great peace of mind and I am willing to compromise a little bit on performance. The performance hit is barely noticeable as long as you have a modern processor and SSD. SSD is the absolutely important for good VM performance. I used to use VirtualBox a few years ago and it used to crash. I tried VMWware Workstation and the difference was night and day. I never touched Virtual Box again.
I'll second this notion that VMWare is better than VirtualBox. VirtualBox can get the job done, but you can tell where your money went when you purchase VMWare. It's significantly more polished and stable.
It's worlds better, but it screws up my mouse settings (with a Linux host). I have a fancy gaming mouse, so it's very annoying and noticeable, and I haven't found a solution yet.
Thanks, this is good to know. I've only had limited success with VirtualBox--my guests' performance takes a dive when I assign them more than 2 virtual CPUs (both Linux and Windows guests).

Looks like VMWare Workstation is on sale for $162 today. Might take the plunge.

I also use VMWare Workstation Pro. The other big difference is the file access times are significantly faster on VMWare compared to Vagrant.

So for me, as a PHP developer, my page loads time are 5x faster for VMWare compared to Vagrant

I've been using Vagrant/Homestead for a while. It's so nice setting up or tearing down a box with all the latest stuff pre-installed and working. Works the treat except for an issue I'm having upgrading firebase tools. I'm sure I'll get that sorted and go back to being a happy camper.
I went from using a virtual machine to running rxvt-unicode under WSL with XMinGW as my X server and SSHing into a real-Linux virtual machine. If you don't need Haskell (I do) you can probably get away without SSHing, most programs do work under WSL but Haskell's runtime requires a syscall that's unsupported.

As to why I don't use real Linux - at home, I do, but we have products in ASP.NET at work so that's not an option.

I've used to program using a vm in the past, I chose to use hyper-v because it's already available for installation in windows 10 so I thought it could give me a little more on performance side comparing to virtualbox. Although hyper-v is more difficult to setup, it works.
Is there much of a performance gain with hyper-v vs virtualbox?

I've just been trying it out. Weirdly hyper-v's NAT (which is hidden in from the UI) is super slow

Being honest I didn't notice any difference, I only expected to work better because its from Microsoft, so I assumed it would work without any problems.
Been doing it for a while now. I mostly use the terminal, vim and a lightweight window manager i3 in VirtualBox on a desktop machine. I never do file sharing. Tried Samba and others. Was problematic.

Another option if you use mostly the terminal is to ssh (PuTTy) into a VPS box for development using vim + tmux. That's my fallback when I'm not on my desktop or traveling.

It's great. I do it every day: Headless ubuntu image that I then use Cygwin's X server to SSH into and run xfce4-terminal.

Only disappointment has been my laptop's decreasing stability at the windows level... but I can't blame that on linux or running a VM :D

I've been using Linux VMs for about 4 years now and love it. The portability between my Mac and Windows host is seamless.

As I do mostly web dev now, I even install Cloud9 IDE on my VM and now actually edit in the browser. The command line windows in Cloud9 was extremely robust and the editor is very, very good. It will be hard for me to switch back to something else.

I even have Cloud9 on a Digital Ocean droplet for one project which means I don't even need to boot a VM and just log in where I happen to be.

I'm one of those guys that develop for a living (mainly from home) and play a lot. I love developping with linux, but need windows to play, so here's my story. I tried a lot of things, linux with Wine, linux with a virtualbox windows guest, windows with a linux virtualbox guest, same with vmware, same with hyperv, but all were suboptimal to me, and I didnt really like having two separate environments for work and hobbies (although I understand some people may be more comfortable that way)

Finally, I settled on a windows 10, a linux guest under vmware with no desktop environnement (an ubuntu server + the Xorg libraries I need), and I just use an X server running under windows (the one from MobaXTerm, but cygwin should be fine too) to display the linux windows apps in my normal MS-Windows environment.

I feel like I have the best of both world, I can use visual studio, unity3d, under windows, and play with my steam library, and for work that needs linux (mostly my server-side developments, but also a non-trivial QT application that I sell for windows and mac, but actually like developping under linux). Thanks to the X Server, the apps running in the linux vm are displayed in Windows as if they were standard windows app.

That sounds pretty cool! Im in the same boat but with mac instead of windows. Wonder if i could do the same thing. I mean, Xorg is available on mac too.
Very interesting I will give it a go, all I need is sublime text as a graphical editor and I am good to go
(comment deleted)
Have you ever tried a dualboot system (separate partitions for Linux and Windows, choose OS on startup)?

I do this on all my machines and it works quite well. There's no VM overhead and if you manage to bork one OS, you still have the other one for online research, creating recovery drives etc.

The problem can be driver support. And you have to become a sys admin for your machine.
I leave my machine always on. Zero boot time.
Not OP, but: I would do a dual boot if I could, but corporate IT will cut me off from the internet if they detect a non-compliant system (unsupported OS, no antivirus bullshit, etc). so I'm stuck in a Linux VM.
Agreed. I've used the cygwin X server, it works fine. I've used a virtualbox linux guest from Windows host (with the GUI running on the guest), and vice versa, it works fine. Similar, I've used an X server on my linux laptop to display apps from my raspberrypi.

Enough memory and cores on your host is necessary, otherwise it's frustrating. You don't need a beast, but a kitten with absolute minimal specs won't do.

Edit: be sure to set up shared folders between the guest and host, it makes things easier. scp isn't bad either, but it can be a little easier to just plop/copy files in a directory.

How do you have any graphical apps installed at all, without it grabbing any/all of the entire "*-desktop" group of packages as dependencies? What GUI apps do you use?

I'm very interested in replicating your setup here, so if you have this documented, do you care to share?

Consider this another "+1 in the hopes that you document this setup"
Just a note that as of Linux kernel 4.6, my Surface Pro 3 works practically flawlessly with Linux installed natively on it, so it may be something to consider, there's good deals on the SP3 on eBay and besides, the SP4 isn't much better.

Linux 4.10 will also support the improved Type Cover 4, (currently, support is there only up to Type Cover 3/SP3)