8 ms·
Ask HN: How Is Developing on a Linux VM in Windows?
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.
- martin-adams 10y agoI'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.
- blablabla123 10y agoOne 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..
- jokr004 10y agoI 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.
- tuckerwales 10y agoI 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.
- thenipper 10y agoI 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.
- bphogan 10y agoIf 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 10y ago+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.
- tarr11 10y agoI 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)
- OliverJones 10y agoworks 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.
- Jtsummers 10y agoI 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.
- ruffrey 10y agoI 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.
- joe5150 10y agoWorking 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.
- Apreche 10y agoTerrific? I've worked this way for years.
- teddyc 10y agoI 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.
- awruko 10y agosame 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.
- _RPM 10y agoI 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 10y agoWhy not just work directly in the VM? I mainly use emacs on OSX now, so I would expect it to feel natural.
- _RPM 10y agoI 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.
- menacingly 10y agoI 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.
- nickjj 10y agoI 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-development-environment-in-windows-with-vmware 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-macbook-pro https://nickjanetakis.com/blog/i-almost-rage-bought-a-macboo...
- marktangotango 10y agoI 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.
- larryweya 10y agoI'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.
- monster_group 10y agoI 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 10y agoI'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.
- larrik 10y agoIt'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.
- markdoubleyou 10y agoThanks, 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.
- laurencei 10y agoI 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
- bungie4 10y agoI'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.
- nonsince 10y agoI 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 10y agoIt'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)
- loop0 10y agoI'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 10y agoIs 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 10y agoBeing 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.
- mmgutz 10y agoBeen 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.
- magaudet 10y agoIt'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
- invaliduser 10y agoI'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.
- ranza 10y agoThat 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.
- tejinderss 10y agoVery interesting I will give it a go, all I need is sublime text as a graphical editor and I am good to go
- deleted 10y ago[deleted]
- blauditore 10y agoHave 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.
- AsyncAwait 10y agoJust 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)
- stemc43 10y agoeverything about windows upsets me.
- laumars 10y agoI 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 10y agoI'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 10y agoWindows 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.
- daveloyall 10y agoI 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.
- ssully 10y agoI'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.
- cweagans 10y agoNot 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 10y agoAccording 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.
- gtrak 10y agoThere 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.
- dmschulman 10y agoI've been looking into this setup as well, having dual booted all my machines previously. Though rebooting takes only a few seconds it feels like more work than it actually is, complicate that with having to enter encryption passwords, reopen all your software and load up files, etc, I think keeping everything under one OS and running a VM and then being able to boot into that VM natively when necessary seems like the best modern solution for my needs
- Qwertystop 10y agoCan 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 10y agoThe 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-same-partition-on-y-493223329 http://lifehacker.com/how-to-dual-boot-and-virtualize-the-sa...
- nrclark 10y agoworks 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.
- hawski 10y agoI 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.
- misiogames 10y agothe 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.
- neves 10y agoGreat 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.
- bitcrazed 10y agoPM 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 10y agoTL;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....."
- Kepler-125c 10y agoJust buy a system76 and be done with it.