Ask HN: How Is Developing on a Linux VM in Windows?
I'm thinking of a MS Surface Pro and am curious how it would be to do my Linux work in a VM.
I'm thinking of a MS Surface Pro and am curious how it would be to do my Linux work in a VM.
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.
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.
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.
I'm very interested in replicating your setup here, so if you have this documented, do you care to share?
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...
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!
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.
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
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.
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 -oThe 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....."
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
Looks like VMWare Workstation is on sale for $162 today. Might take the plunge.
So for me, as a PHP developer, my page loads time are 5x faster for VMWare compared to Vagrant
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.
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,
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.
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.
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.
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...
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.
Linux 4.10 will also support the improved Type Cover 4, (currently, support is there only up to Type Cover 3/SP3)
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.
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)
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.
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.
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.
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.
But that's an odd use case for most people.
I've just been trying it out. Weirdly hyper-v's NAT (which is hidden in from the UI) is super slow
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
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.
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.
I'd definitely recommend VMWare over Virtualbox - it's waaay higher-performance, and it's worth every penny IMO.