Developing/working inside a VM

So, currently I keep my work/play lives separate by having a gaming rig untainted by crapware for play and a laptop with all my IDEs and random tooling on for work.

This setup has served me well for the most part but since I’m 100% WFH nowadays (like most people) the faff in switching between laptop and PC on my desk is getting irritating. This was fine when WFH was only occasional but with one screen/keyboard/mouse switching cables is too annoying. I tried the KVM route but they are universally overpriced and shit (poor resolution/refresh rate limits), so that’s a bust.

I’ve recently been using remote desktop to control my laptop from my gaming rig. It seems to work well but it’s not without its caveats; colours are incorrect due to image compression (not helpful in my line of work) and let’s face it - my PC is far more powerful so it feels wasteful.

So, my last remaining option here is to go with creating a ‘work’ VM and reinstalling/running everything through there. For any that have experience with this, any tips/advice on the following issues (NB Windows 10 Pro for all):

  1. Any neat way to sync the VM with my laptop in future since I’ll inevitably have to go back to using it? As in, running the same VM on the laptop.
  2. Any performance related concerns?
  3. Any licensing issues - would I need another W10Pro license for the VM or would it activate with my current key?
  4. I have multiple clients I contract to - is it worth the effort of setting up a separate VM for each since I’m having issues with using 2 separate sets of credentials (e.g. Azure website, which sometimes doesn’t log me out properly when I try to switch)?

Any other tips/advice appreciated.

  1. I haven’t tried to do this but you could use Goodsync if you like GUIs or rsync if you prefer a CLI.
    https://www.goodsync.com/
  2. You will essentially be running 2 machines on the same hardware (host/guest) with all the performance requirements that brings. e.g. if you have 4 CPU cores you’ll probably want to split them (2 for host, 2 for guest). You’ll want a decent amount of RAM.
  3. You’ll need a separate Windows license for each VM.
  4. Probably not worth the hassle in my experience. You’re doubling up resource requirements, maintenance, software updates and all the rest. I generally don’t spin up a new VM unless there is a very strong reason to do so.

Hope this helps. Feel free to ping anymore questions.

Put your laptop on a stand next to your PC monitors, so it’s roughly at the same height.

I personally have this one, which is Amazon’s ripoff of the popular Rain Design stand. It’s fine.

Then install Barrier to share your keyboard and mouse between the computers. In other words, you move your mouse to the left of your PC monitor and it just continues onto your laptop’s screen. You type on the same keyboard and it works on the laptop.

@draxen Thanks for the swift reply. There was one more thing I wanted to ask originally but forgot about - I like using dual screens for dev work, any issues getting that working correctly in a VM?

@stusser Yeah, I’ve tried some similar software in the past (think it was Multiplicity) but the issue with this setup is the laptop screen is too small to be comfortable unless its right in front of me. I do web development which generally needs a lot of windows open at once to feel productive. The laptop is fine as a secondary or tertiary screen but I wouldn’t want to have to do everything on there.

But you’re working on the laptop right now. So what you really want isn’t to get off the laptop, it’s larger screens.

Sorry I’ve no idea. I don’t use dual screens.

@stusser Yes… also no. It’s complicated…? :)

I’ve got an ultrawidescreen monitor which I absolutely do not want to go to waste in whatever set up I end up with. I don’t have any other monitors to use at home and even if I did - not enough desk space. So, in an ideal world, I’d just hook the laptop up to it as a secondary input source then switch the monitor input on the fly (dual screen, baby!).

Unfortunately I just cannot get this laptop to use the monitor’s native resolution on the HDMI input left available on the monitor and it looks awful. Don’t get me wrong, I could just rewire everything 2 times a day and get the result I want (laptop works fine on the DP input). However, it’s just too much effort and every time I have to dig around the back of said monitor I worry I’m going to damage it. Much like my ego, it is large, hard to handle and fragile. Nothing gets accommodated into it without a lot of careful negotiation and dexterity.

I’d also need something to switch over the keyboard/mouse since… ew, laptop keyboards. Plus it just feels kinda dumb to have a PC which is magnitudes more powerful just sorta idling while my laptop struggles with some of the more intensive things I need.

So basically I’m trying to make the best of what I’ve got despite knowing, in my heart of hearts, that the real solution is to buy a new laptop. :\

Well, you could also buy a high-quality KVM that actually works.

But sure, you could run a Win10 VM if that really makes you happy. No way to completely sync with the laptop but I don’t see why you’d care. Just sync your documents/etc. Performance is fine in VMs these days. You can either buy a $30 grey-market Win10 key off kinguin.com or just run it without a key, it works forever that way, you just can’t change the wallpaper and such.

I really wanted to go for a KVM at one point but I effectively ruled it out as there were a litany of complaints against every model I looked at when it came to gaming. Seems they just don’t work well with high resolution/refresh rates. I’d also be concerned about HDR support which is finicky even at the best of times.

I just wasn’t willing to take the risk at the cost they’re demanding even for a semi-decent model and feel I’d be better off putting the money toward a laptop that’s happy with HDMI 2.1 output. No way I’m settling for 60Hz after spending so much on some of this stuff. That said, if you know of one that’d support 3440x1440@180Hz without issue I’d certainly consider it!

The VM sync thing - well, let’s just say that I occasionally have to work with some godawful enterprise-y web server nonsense that is 1) extremely unreliable 2) resource hungry 3) time consuming to set up 4) impossible to remove cleanly. Even if I was to do it all on the laptop quarantining it entirely in a VM definitely has appeal. Since I’m a contractor being able to nuke the VM after I leave a gig in a couple of seconds seems pretty cool - as does having a ‘starter’ VM with my tools preconfigured on it that I can just clone out when I go to a new gig. So I strongly suspect - monitor issues aside - that working within a VM has its merits.

Yo dawg VM while you KVM etc. etc.

FWIW I disregarded the KVM for the same reason (gaming support + expensive) but went the cheap route.

I have a USB hub to switch my keyboard, mouse, speakers, webcams, and mic from my desktop and my work laptop at the flick of a button. I have my work laptop connected to my dual monitors via the HDMI ports and I have my desktop connected via DisplayPort.

When I log into work I just change the inputs on my monitors and press the USB switcher button. When I log off for the day I do the same. If I need to reference something on my home desktop (rare) I just switch one monitor to my desktop and one on work, then just use the usb switcher to go between the two. It’s like a $20 setup.

I use a VM for developing my website and a few other things. It is convenient and keeps things nice and tidy, but there is a performance hit. Also, the image is about 20 to 40GB, so transferring it back and forth between different PCs and laptops over a network might be an bandwidth issue for you.

Take a look at Vagrant, it’s created with what you are talking about in mind. However it’s mostly based around linux, not windows environments because auto provisioning a windows box is amazingly more difficult. Or was, haven’t tried it in awhile.

That’s a really cool looking tool. I’m not quite sure I can get it to do what I want here, but I’m definitely adding it to my box of tricks nonetheless. Thanks!

I don’t find VMs to be tricky at all, and other than the cheap cost of the additional Win 10 licenses, should be a good solution. Not to mention since it’s a VM, you could simply copy the VM to your laptop and pick up where you left off. You’ll only be taxing your desktop resources when you’re running the VM. When powered off, the resources are free. Except for drive space, but I’d imagine you could live w some fairly svelte Windows 10 VMs.
.

I’m still hung up on why the colors are bad over remote desktop. I’ve steamed YouTube videos through remote desktop. The colors should be fine in 2020.

It uses lossy image compression for the whole shebang so it suffers from the same issues as a poor quality jpeg. However, your post prompted me to do a bit of searching and see if there’s a lossless option in the client I’d missed, or perhaps even a third party client I could use instead that’d support it. Turns out I was looking in the wrong direction and it’s actually configured on the host machine instead, behold:

This is under Group Policy Editor > Computer Configuration > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Remote Session Environment.

After disconnecting/reconnecting the client it all seems to work as I’d hoped. I’m still keen on setting up some VMs for containment purposes but this at least alleviates that particular issue I was having with remote desktop in the short term. I’m actually of a mind to set up the VMs on the laptop now and still connect with remote desktop.

As an update a few months later; I got my new laptop a few weeks ago and went the whole hog with setting up a VM for my dev environment. I honestly couldn’t be happier and kick myself for not having thought of it sooner. I got the VM set up with some of my tools installed and all the windows tweaks I usually do (plus some extras!) then cloned the disk before taking it further.

So I now have a baseline disk (that I’ve backed up) that I can just reclone down the line as I move between new gigs so I don’t need to waste massive amounts of time reinstalling everything from scratch. Just 10 mins rolling out the specific IDEs I need for the job and applying the odd update. And when I leave? Just delete a couple of files and bam, everything confidential is gone without worrying about ‘residual’ files floating around or having to waste time removing whatever web services I needed to have running locally for that particular project.

Some observations/tips that some might find useful:

  • Create your hyper-v vm as Gen 2. I believe this is the default but I think this allows use of the ‘Enhanced session mode’ which enables a lot of extras which are essential for me.
  • Such as multi-monitor support! :D
  • Such as mic/audio support! :D (so I can use Teams etc inside the VM)
  • You can create a shortcut to effectively allow you to connect to the vm in a single click. Point it to C:\Windows\System32\vmconnect.exe localhost "Your vm name"
  • Interestingly, vmconnect seems to make (some?) use of the underlying Remote Desktop client to work, which makes sense. However! As a result it uses the exact same lossy image compression algorithm. As in my post directly above this one, enable the RemoteFX options in the group policies of the vm to switch it to lossless.
  • Initially I set up my virtual switch as external which had the knock on effect of making network performance outside the vm abysmal. Not sure why, exactly, nor the scope of it - but I was trying to copy a file from my laptop to a server on my LAN and the throughput was less than 500kb/s. Removing the external switch and creating an internal one instead put things back to normal (I realised I didn’t need the features of a full external switch anyway).
  • I bought this neat little USB switch which allows me to quickly and effortlessly switch my keyboard & mouse between my laptop (work) and tower pc (play).