Live data from Hacker News

Developing inside a virtual machine

blog.disintegrator.dev

131–140 of 147 posts

Re: Developing inside a virtual machine

#131

Earlier quoted context omitted.

I started working from home around 12 years ago and have been using this setup in various incarnations. I experience zero issues related to running work from inside of a VM. I work for an MS Shop, so we are using teams. The main issue with my setup is that VMware or Windows 11 (my host OS) can't use the GPU when rendering the UI of the VM (I'm not sure if VMware or MS is to be blamed or both) despite having a discret…

Weird, I pass through a dGPU for work VM sometimes on Win10/11 @ 2K without much memory usage except I don't use MSTeams but it doesn't surprise me that it needs 60GB RAM nowadays. I'm jealous of your system's 256GB, my memory controller looks to max at 128GB but it's kinda old now (DDR4).

As I understand it, when connecting to the vm through the VMware console viewer, since the desktop image of the remote computer is rendered within a VMware process, which is CPU-bound, only the CPU can handle this task.

Spanning multiple 4K monitors demands significant RAM to handle the large aggregate framebuffer size and the associated overhead for rendering and display synchronization.

Re: Developing inside a virtual machine

#132
At work, development with VMs has been a given since the early days of Amazon EC2 in 2010.

Likewise when Windows 7 came out, I stop bothering with dual booting hassles and using VMare Workstation instead for whatever Linux.

The exception being a netbook from the Asus Linux netbooks glory days, a price category nowadays replaced by tablets.

Re: Developing inside a virtual machine

#133

You can use pbcopy/pbpaste in a Linux VM on Mac by making a shell script wrapper in the VM that calls “ssh mac-host pb{copy|paste}” - that is, basically ssh back from the guest to the host to use its clipboard. It’s seamless and fast since it’s basically a local network connection. My specific setup is that I use an authorized_keys entry on the host that restricts the guest to running a specific command, which limits…

> I use an authorized_keys entry on the host that restricts the guest to running a specific command, which limits what a compromised guest can do to the host. The command is set to a script that has a list of specific permitted actions. That’s a neat trick, thanks for mentioning this. command="command" ssh-ed25519 ... would be the authorized_keys entry and I’m guessing the script would read the SSH_ORIGINAL_COMMAND e…

Yes, that's exactly it.

My authorized_keys line looks like this:

  command="${HOME}/bin/fromvm vmname",no-port-forwarding,no-x11-forwarding,no-agent-forwarding ssh-ed25519 ...
I give each of my VMs a different name and key, which lets me identify them for the purpose of e.g. constructing ssh:// links for remote editing.

The actual script uses $SSH_ORIGINAL_COMMAND, exactly as you've described, which means that while the guest thinks its executing e.g. "pbcopy", the host "fromvm" script is actually receiving "pbcopy" in the $SSH_ORIGINAL_COMMAND and can apply the appropriate access control or restrictions.

Re: Developing inside a virtual machine

#134
post #54
post #43

Earlier quoted context omitted.

> VM seems like a good way to add some protection. Yeah, but someone should try to fix this anyway. It's not a nodejs-specific problem, but it's badly needed in node. Any of the 100s of authors whose packages I depend on might have made a typo, or just been careless. Software development requires a scary level of trust. I am also increasingly moving to VMs. I want tools (such as VSCode) to run on the main machine, bu…

VSCode assumes that the remote side is trusted. So if VM is compromised, VSCode on the host can be compromised as well. For this reason I run VSCode inside the VM.

Can you point me to some documentation or proof of concept for this? Would definitely like to change my workflow if this is the case.

Re: Developing inside a virtual machine

#135
But why tho?

The only kind of plausible explanation the author gives is that it's "more secure" because the imaginary attacker will have to take an extra step to get the password from the VM instead of the host OS? -- This seems like such an inconsequential / worthless benefit to jump through the hoops of running things in a VM...

Like... I wasn't sold on this approach from the get go, and this pitch makes it sound like I was right all along?

Other non-starter "bonuses" include not installing developer tools on your laptop that you have for... drum roll... development. Why? It's sole purpose is to be used for development, why not install development tools on it? Just doesn't make any sense...

Re: Developing inside a virtual machine

#136

(Tangentially related) I had to run the desktop version of Excel to develop a quick VBA macro for a client. Problem: I've been developing on a Linux box for years and the idea of leaving my cozy dev environment for a plain Windows install gave me chills. After failing to install Windows in a VM (thanks TPM), I found a way to run Windows apps nearly natively ( https://github.com/winapps-org/winapps ). It works by star…

This is great!

Re: Developing inside a virtual machine

#137

Earlier quoted context omitted.

I used Kholia's scripts[1] on Qemu with Virsh. I didn't have much trouble other than some SELinux permission issues which I resolved quickly. iCloud/imessage have always been finicky with Hackintosh, but in my experience setting the correct serial number with appropriate Mac model is the key to resolve those issues. With just couple of years of Hackintosh scene left before support for x86 Macs are dropped completely,…

Even a VM will stop working soon as Intel support is removed from the OS and apps start demanding newer OS versions. Or is it possible to emulate Apple Silicon on a VM now?

Yes macOS VM will also be useless too in some years but a useless VM is better than a useless purpose built computer for hackintosh.

Qemu is capable of ARM emulation but I don't think its capable of emulating sophisticated SoC like Apple Silicon.

Re: Developing inside a virtual machine

#138
post #8

Earlier quoted context omitted.

I used to do that, but now that all of our microservices are dockerized every microservice has its own docker container Vscode supports remote containers, so everyone in the org just develops INSIDE a replica of the prod container All containers run remotely on enormous machines with 800+ GB of RAM and 8+ GPUs It’s trivial to share environments now because you just open the project and the dev container starts up and…

Do you have any more detail on how you're handling this on a shared host? My understanding is that the base remote containers + remote ssh extensions would require the code to exist directly on the remote host, and then the container to be created afterwards (and bind to the host directory etc). Is this what you're doing?

Yes that's right, the process is:

- clone the repo with git

- Open Cursor (or vscode) locally, click "open remote window" little blue button at the bottom left of the screen

- Navigate to the folder you cloned and press open

- IDE will recognise that there's a .devcontainer inside the folder and pop a dialog saying "Re-open in container", click that. If this dialog doesn't show press "Shift+Ctrl+P" and type "Rebuild" and a menu option "Dev containers: Rebuild and re-open in container" will show up, select that.

- The docker container will be built and you'll be dropped inside it, with the appropriate folder mounts happening automatically. Now when you open a terminal inside the IDE it's a terminal inside the container.

Re: Developing inside a virtual machine

#139
post #102

Earlier quoted context omitted.

Corporate IT security seems to be mainly about checklists and compliance, not about actual security.

There's no reason to do anything else. Nobody has gone to jail as of yet for not securing their company, and even "security" companies that get utterly popped still have plentiful business a year later. There is no legal incentive to do good security. There is no market incentive to do good security. Why is it so surprising to people that we have abysmal security?

In my case, it's surprising because companies waste a ton of money buying snake oil and aggravating their users for next to no benefit. You'd expect companies that "only care about their bottom line" to optimize this away, yet they don't.

Re: Developing inside a virtual machine

#140

You can use pbcopy/pbpaste in a Linux VM on Mac by making a shell script wrapper in the VM that calls “ssh mac-host pb{copy|paste}” - that is, basically ssh back from the guest to the host to use its clipboard. It’s seamless and fast since it’s basically a local network connection. My specific setup is that I use an authorized_keys entry on the host that restricts the guest to running a specific command, which limits…

I do something similar, and one more tip is to remember to provide your pbcopy and pbpaste with `LANG=en_US.UTF-8`, or else non-ASCII will be garbled.
Post reply on HN