
Ask HN: How Is Developing on a Linux VM in Windows? - hellofunk
Compared to an actual Linux install.<p>I&#x27;m thinking of a MS Surface Pro and am curious how it would be to do my Linux work in a VM.
======
invaliduser
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.

~~~
blauditore
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.

~~~
majewsky
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.

------
nickjj
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...](https://nickjanetakis.com/blog/create-an-awesome-linux-
development-environment-in-windows-with-vmware)

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...](https://nickjanetakis.com/blog/i-almost-rage-bought-a-macbook-pro)

------
bphogan
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!

~~~
techtalsky
+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.

------
bitcrazed
PM for Windows Console & Bash on Windows here:

For what it's worth, you might also consider running "Bash on Windows" atop
the new "Windows Subsystem for Linux" (WSL):

[https://msdn.microsoft.com/en-
us/commandline/wsl/about](https://msdn.microsoft.com/en-
us/commandline/wsl/about)

While a full Linux VM gives you the full Linux experience, VM's can be
resource hungry and there's a significant barrier between your host OS and the
OS in the VM (Linux in this case). Sometimes this is desired, sometimes, it
can be a real productivity hindrance.

We created Bash/WSL for developers who want/need to run Linux
apps/tools/binaries alongside their favorite Windows tools, sharing access to
the same filesystem and network, etc.

Bash opens in ~ 1s and requires very little RAM overhead to run. It runs
unmodified Linux ELF64 binaries that ship within the standard Ubuntu server
distro, or that you download using curl/wget and install locally, or that you
download & install via apt/apt-get.

Note, Bash/WSL is still pretty new, and if you want the best experience, be
sure to join Windows Insiders & install the fast-ring builds - we're cranking
like crazy right now and have fixed many reported issues resulting in Bash/WSL
now being able to run a very large number of common tools that dev's
want/need/love. More fixes are also on the way so things will continue to
improve in the coming weeks as we drive towards Windows 10 Creator Update due
in spring 2017.

HTH.

~~~
fencepost
TL;DR: If you're running a third party AV+firewall like Kaspersky or
Bitdefender, you may find that the shell has no Internet access.

Until today I've had problems with doing apt-get update / apt-get upgrade, but
I finally took the time to track down some fixes.

First, apt-get was attempting to use IPv6 and having issues. Fixing problem 2
might have also resolved this, but I didn't go back to check it. The fix for
this is to force it to IPv4, probably with a file
"/etc/apt/apt.conf.d/99force-ipv4" containing the text:

    
    
        Acquire::ForceIPv4 "true";
    

You can also specify that as a one-time thing on the apt-get command line with
-o

The second issue was lack of Internet connectivity from within the shell. The
most notable thing initially with this was inability to run apt-get update,
but even after a workaround let me do updates this remains an issue so you may
be able to edit local documents but not do anything requiring a connection.
Apparently there are known issues with some firewalls - not clear if it's only
third-party ones, but I've seen Kaspersky mentioned and I had problems with
Bitdefender. The workaround is to disable the firewall (on a trusted network
obviously) but that's only good for updating and doesn't resolve the issue. I
saw a development post from early November, 2016 about changes to how some
things are changing to allow better compatibility, but I'm not sure how long
those changes will take to propagate or whether they're a fix or just
something to let firewall makers do their own better fixes.

Hopefully this info will help some folks - even if not now, just by
remembering later "there was something about firewalls....."

~~~
fencepost
An update after I dug into this a bit - turns out this has been resolved by
many of the AV vendors, so updating from Bitdefender 2016 to Bitdefender 2017
(should be free if your Bitdefender install is connected to "Bitdefender
Central" \- just sign in, click the Install button at the top right to
download the newer installer, then install to do the upgrade).

Multiple other third-party AVs have also updated to either recognize directly
or to have a checkbox option to allow WSL programs access. The github issue
for this is
[https://github.com/Microsoft/BashOnWindows/issues/475](https://github.com/Microsoft/BashOnWindows/issues/475)

------
monster_group
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.

~~~
marpstar
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.

~~~
markdoubleyou
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.

------
nonsince
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.

~~~
Volundr
It's not published yet, but they have implemented the required syscalls in the
WSL repo now
([https://github.com/Microsoft/BashOnWindows/issues/307](https://github.com/Microsoft/BashOnWindows/issues/307))

------
laumars
I did it for a while (not on a Surface Pro) but the longer I ran that set up
the more I grew to hate it since all of the work I wanted to do was in Linux
and thus Windows quickly became a bloated and unnecessary distraction. So in
the end I wiped Windows and installed Arch.

Maybe with Windows 10 and the Linux subsystem I might find myself happier with
a Linux VM, but honestly I feel more at home running Linux bare metal anyway,

~~~
facorreia
I've used Windows since version 3.0. For several years I experimented with
different solutions for running Linux on Windows, but I didn't stick with any.

I've been running Linux natively for several years, and I appreciate how fast
it feels when compared to Windows. I've come to have very little patience for
Windows' quirks, like how long it takes now to open the Start menu, the amount
of annoying and somewhat condescending dialog boxes that you have to disable,
its tendency to start downloading or running stuff on its own, that you have
to hunt down and disable, its terrible default "terminal" app (even the
PowerShell one is subpar), and so on. I just have very little patience for all
of that.

I also like to play on my PC, so I have a Windows partition for that, with
dual-boot (which takes 10 times as long to get ready for use than Linux does
when I boot it up). I appreciate the clean separation from "work" and "play"
environments.

~~~
laumars
Windows 1 for me. For what it's worth, Windows 2000 was the only release of
Windows I've ever liked. Around then Mac OS was struggling, BeOS was awesome
but sadly on it's way out. Back around the year 2000 Windows 2000 was a strong
platform and Microsoft did a lot to subtly refine the OS over NT 4 and 98
(lets ignore ME lol). Little things like short cut keys in Notepad were a real
improvement for power users. Sadly every version of Windows before then and
since have, in my opinion, been eclipsed by other OS. In fact had it not been
for Microsoft's monopoly on IBM-compatible PCs and the dominance of that
hardware platform then I really couldn't have seen Windows ever becoming
successful as Windows 1 and 2 were complete garbage with 3.x being a marked
improvement but half the time users still spent more time in DOS than Windows.
When you compare that to the likes of GEM, AmigaOS and Mac OS then Windows of
that same era really looks and feels like a homework project.

I do often wonder what life might have been like if Microsoft hadn't been so
dominant on IBM PC's. If OS/2 was pushed by IBM or if Digital Research hadn't
failed to reach a deal with IBM to ship CP/M. But _c 'est la vie_. I've been
perfectly happy on Linux for the last 10 or 15 years now and I can't see that
changing any time soon either.

------
gtrak
There is an alternative that I have found quite useful.

Create a Dualboot situation for normal linux work but set up a VM in your
windows host that points to your bootloader and linux partition.

Now you have the best of both worlds, more memory and speed when you want it
with native boot, but access to the dev environment from windows.

This was most effective in the case where a client required proprietary
windows-only VPN software, but I wanted my dev environment. Configuring a
vpn'd bridge adapter between Virtualbox+linux-guest and Windows host was a
piece of cake.

~~~
Qwertystop
Can you provide any guidance on how to do this? Can it be done when the Linux
partition is on a non-NTFS filesystem? It sounds extremely convenient,
especially as I've already got a dual-boot setup.

~~~
gtrak
The easy and dangerous way is to mount your entire hard drive inside
virtualbox. Follow instructions here:
[https://www.virtualbox.org/manual/ch09.html#rawdisk](https://www.virtualbox.org/manual/ch09.html#rawdisk)

The issue occurs when you for example accidentally boot windows within
windows, you can possibly get file corruption.

The workaround is to configure a virtual disk with only the partition you need
plus a bootloader that can load it up. I haven't gotten that far.

EDIT: It seems there is an article about how to do this:
[http://lifehacker.com/how-to-dual-boot-and-virtualize-the-
sa...](http://lifehacker.com/how-to-dual-boot-and-virtualize-the-same-
partition-on-y-493223329)

------
menacingly
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.

------
AsyncAwait
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)

------
hawski
I worked on such a setup in previous job and current.

Personally I'm on new desktop computer / Windows 10 / VirtualBox / Ubuntu.

Good things:

\- Games and GPU drivers!

General annoyances:

\- you can't bring another VirtualBox VM inside your VM so I use QEMU (but
without KVM, because it does not work in VB) - this is big for me as I, as
mentioned below, work on my own Linux distribution

\- using tiling WM on VM and juggling between VM and host is not enjoyable

\- Primary Selection on Windows does not work, so many I select something and
can't paste it with middle click if it involves Windows app

\- serving something for whole LAN involves playing around with network
configuration

Windows annoyances:

\- updates are still not smooth enough - I'm spoiled by ChromeOS though

\- it's not easy or obvious how to pause the download of updates - I wrote a
firewall rule for it once when my Internet pipe got very narrow because of my
ISP

\- some time ago Windows started to bug me to sing up to OneDrive or something

\- applications thinking they are so important that have to start with the
system - I know about mscfg or whatever, but it should Just Work

\- sticky keys and other unhelpful shortcuts to hell are on by default

\- VirtualBox by default will resume computer from sleep, even if you will
stop VM

\- putting computer to sleep disables audio through HDMI - then I have to
restart

\- can't figure out where can I _safely_ get driver to old SPAC based webcam

\- can't figure out which package manager I can use that would update
everything automatically (or at least semi-) - Chocolatey is not doing it by
default and maybe it can't

VirtualBox annoyances:

\- window resizing causes VM to resize correctly and then it shows scrollbars
that obscure window contents

\- VirtualBox bugs me with updates

I now think about dual-boot setup, but that's never a joy. As comments here
suggest I need to try VMware. I also can't wait when one will be able to just
develop on Android as in Robert Landley's vision. Meanwhile I do some personal
R&D to create a Linux Distribution with as smooth updates as on ChromeOS.

------
joe5150
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.

------
tarr11
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)

------
Jtsummers
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.

------
jokr004
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.

------
daveloyall
I use VirtualBox on Windows in a corporate (domain, forest, wtf?) environment.
Sometimes I wonder if some other virtualization product might be better.

So windows is called the host. My guests are Debian Sid (unstable), mostly.

At first, I ran an X server on windows and ran the VMs headless. Performance
and convenience turned out to actually be better using Vbox's default mode: an
application window which draws the contents of your virtual graphics
card/monitor.

With the virtualbox-guest-utils package installed[1], plus xrandr, my Xwindows
desktop resizes automatically when I resize the VM application window. _It 's
kinda cool._

Backing up your host is not an excuse to not backup your guests. I have
experienced total loss of a VM due to a corrupted "virtual disk" file. (The
cause was a hardware problem, a read or write error on the host.) I expect
that if the exact same hardware problem had happened to straight GNU/Linux
instead of a GNU/Linux with a virtual disk, I would have lost a file or two,
not the whole fsking system.

Losing a VM after four years of use is like losing a machine after four years
of use, except it's less clear how to perform forensic recovery!

I agree with what others have said about Vbox file sharing being lame. I had
to create ~/src (VBOX share) and ~/src-e2 (ext4) because the vbox filesystem
is objectively broken by POSIX standards. It reports some capabilities exist,
like changing permissions and making symlinks, but when you try to utilize
them (as random applications are wont to do), they either fail with a
nonsensical error (DISK FULL), or report success but don't make the change. So
I created the ~/src-e2 to build projects that depend on features x, y, and z.
My ext4 filesystems are also 5-10x faster for ordinary reads and writes.

Of course I also have cygwin, Anaconda, three different windows-native git
builds, emacs, etc on the host.

Side note: if M$ really wants to embrace free software, they'd build Outlook
for GNU. If not for that killer app, I'd just run Debian on this (16GB, 8-core
monster) machine.

1: This wasn't so easy in 2012, it might be better now. Something about DKMS.

------
blablabla123
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..

------
larryweya
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.

------
mmgutz
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.

------
cweagans
Not sure what kind of work you do, but you might consider using WSL instead of
a VM. For many day-to-day things, it seems like it should work okay. Note that
you can install Linux on a Surface Pro as well.
[https://www.reddit.com/r/SurfaceLinux/](https://www.reddit.com/r/SurfaceLinux/)

~~~
mirkules
According to some posts in that sub, touchscreen support is very unreliable.
If you're in a VM instead, I assume you would still get touchscreen support of
the native OS (win10), right?

I just bought a Dell XPS 13 switching from Mac, and so far am pretty
impressed, especially the seemless integration between traditional input and
touch input.

------
OliverJones
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.

------
bungie4
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.

------
loop0
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.

~~~
greenbullet
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

~~~
loop0
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.

------
magaudet
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

------
_RPM
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.

~~~
hellofunk
Why not just work directly in the VM? I mainly use emacs on OSX now, so I
would expect it to feel natural.

~~~
_RPM
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.

------
ruffrey
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.

------
marktangotango
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.

------
tuckerwales
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.

------
ssully
I've been doing it for a few years now. I write most of my software using
PyCharm on the windows. I usually have an Ubuntu or CentOS VM running at all
times for various testing reasons.

------
thenipper
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.

------
martin-adams
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.

------
neves
Great tips in other comments. Will give some more.

Don't use Windows 10 Bash Shell. I thought it would be a holy grail for
development, but if you write in you linux filesystem from a Windows app, you
will mess everything. Maybe even have to reinstall.

Use Vagrant to create your Linux environment. If you match Ansible with it,
you will have a marvelous reproductible dev environ that you can use
everywhere. Put your Vagrant and Ansible scripts in a Bitbucket repository.

Configure a folder to be shared files between your machines.

------
nrclark
works great! That's what I've been doing for the past few years. IT is happy
because my workstation is still Windows, and I'm happy because I can be
autonomous.

I'd definitely recommend VMWare over Virtualbox - it's waaay higher-
performance, and it's worth every penny IMO.

------
misiogames
the easiest option for me was to install fedora in an old mini itx desktop I
had laying around, on my windows box I run Xming.

------
Apreche
Terrific? I've worked this way for years.

~~~
teddyc
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.

------
Kepler-125c
Just buy a system76 and be done with it.

------
stemc43
everything about windows upsets me.

