WebVM 2.0: A complete Linux Desktop Environment in the browser via WebAssembly
(labs.leaningtech.com)93 points by thunderbong 18 hours ago | 39 comments
93 points by thunderbong 18 hours ago | 39 comments
apignotti 17 hours ago | root | parent |
What makes WebVM (and CheerpX, the underlying virtualization engine) different is the level of performance that we have achieved.
Although CheerpX is not yet perfect and additional optimizations are required on its floating point and vector pipelines, it's already fast enough to be practically useful on many use cases, especially when legacy/older binaries are virtualized.
niutech 12 hours ago | root | parent |
Which WASM features does CheerpX use? GC, BMO, Branch Hinting, Relaxed SIMD, Threads, Memory64?
apignotti 11 hours ago | root | parent |
CheerpX uses SharedArrayBuffer, which is associated to threads, and can optionally use Branch Hinting if available. The latter is fully standardized, but not yet enabled by default in Chrome.
apignotti 17 hours ago | prev | next |
Hello HN! Lead dev of WebVM and CTO of Leaning Technologies here.
Happy to answer any question.
aidanhs 15 hours ago | root | parent | next |
All the emulation of desktop machines in WASM I've seen so far have been for x86 - do you think there are significant additional hurdles for x86_64? Or is it just a matter of time?
Separately, one bit of feedback - it's cool that webvm is open source, but I think it's fair to ask you to be upfront that cheerpx itself is not (which is fine!) in the blog post itself where you talk about webvm licensing. If I wasn't already familiar with the wasm emulation space I would have felt rather misled.
apignotti 14 hours ago | root | parent |
I cannot speak for other VMs, in the case of CheerpX there is nothing fundamental preventing emulation/JIT-ting of 64-bit platforms, but it is an inefficient choice due to the current limitations of Wasm, in particular on the front of how much memory can be used in total. In the best case scenario it would be 4GB, but it's unlikely this can be achieved on all devices in the real world.
64-bit code by its nature consume more memory, each pointer is twice the size, which makes the memory limitation even more pressing for no advantage. Please note, that this is unrelated to the work on WebAssembly Memory64. The issue is not the lack of address space, but rather on the actual memory that can be allocated in practice.
For this public deployment of WebVM we have chosen to limit the maximum memory to 700MBs, which makes the demo work fine on the vast majority of devices, including mobile ones. This said, we do plan to support the 64-bit ISA in the future with the main use case of supporting all the existing docker images available on Docker Hub and similar platforms.
Appreciate your feedback on licensing and we will take it into account, but please notice that this article is specifically about WebVM, that is indeed FOSS. A separate article dedicated to the CheerpX 1.0 release will be published soon, and it will of course be very clear that the latter is proprietary.
aidanhs 9 hours ago | root | parent |
Interesting, that's helpful, thanks - so with the eventual arrival of memory64 and assuming I only wanted to target desktop systems and assuming browser implementations permit large allocations (e.g. 8GB) - large 64bit apps could work fine. I have a use case for this I've been poking at for a bit, but implementing my own version of cheerpx would be a lot of work, maybe I'll just wait!
On open source - I can only give you feedback as an outside fresh pair of eyes :) I incorrectly interpreted that it was full stack OSS based on the overall blog post 'vibe' and had to deliberately double check because I was aware of cheerpx beforehand. Perhaps it's just me. I look forward to the cheerpx blog post!
ezequiel-garzon 16 hours ago | root | parent | prev | next |
This looks amazing, congratulations! I can see that it seems to run offline (curl says "# requires networking"), but if I launch it on airplane mode on an iPhone it halts. Is this the expected behavior? Also, is it possible to install packages? These two things could address some of the shortcomings of iSH. Thanks!!
apignotti 16 hours ago | root | parent |
The disk blocks are streamed on demand, so a connection is required.
The virtual disk is quite large (1.5GB) which is necessary to run a full distro but makes pre-downloading for offline mode not possible.
It _could_ work if you let your workload run once and then disconnect, but there is no guarantee.
Installing packages is supported both in the Debian terminal and Alpine desktop.
modeless 16 hours ago | root | parent |
It is certainly possible to download and store 1.5 GB in browsers these days.
nxobject 17 hours ago | root | parent | prev | next |
I’m glad that y’all are collaborating with GOG to get games running in the browser - I hope being able to ship fully emulated environments helps give some older games, that might have compatibility issues, a larger audience!
Do you have any other industries in mind that you think might be interested in CheerpX?
apignotti 17 hours ago | root | parent |
I want to clarify that we are not officially collaborating with GOG at this time, although we would love to do so.
We think CheerpX would be very useful in education, to provide ready-made environments for students that can be wiped out on demand. We also envision it to be an alternative to remote virtualization (e.g. Citrix) in the enterprise sector.
a2code 16 hours ago | root | parent | prev | next |
What are some other applications of WebAssembly that you find promising?
apignotti 16 hours ago | root | parent |
The promise of WebAssembly is bringing actual large scale applications to the browser.
To be clear, it is possible to build large apps with technologies like TypeScript, with VSCode being probably the standard bearer of this approach, but at Leaning Technologies we don't believe this solution to be viable for everybody.
We strongly believe that more "traditional" languages are required instead to work at scale, especially C++ and Java, and we offer products dedicated to these languages as well: Cheerp and CheerpJ respectively.
Although these languages might not be the most exciting ones, they have a proven track record for delivering large scale applications used by millions of people. Billions of people if the Operating Systems we all use are taken into account.
Thanks to WebAssembly these robust and scalable languages can be used to build Web apps. My own personal metric for the success of WebAssembly is seeing AAA games delivering playable demos as Web apps by cross-compiling (a portion of) the game to the browser.
ranguna 17 hours ago | root | parent | prev |
Amazing work!
How's performance?
Can I run any distros on WebVM?
apignotti 17 hours ago | root | parent |
Performance is expected to be between 3x-10x slowdown depending on the workload, which for this class of systems is quite good. The gap, especially on the high end, will further shrink as the virtualization engine improves.
Not all parts of the ISA are as well optimized currently. The codegen for integer operations (the most common by far) is very sophisticated. Floating point and vector operations still have a pretty basic implementation.
WebVM can run any distro, barring bugs in our syscall layer of course :-)
You can add your own Dockerfile and deploy a custom version on GitHub: https://github.com/leaningtech/webvm/?tab=readme-ov-file#for...
benob 16 hours ago | prev | next |
Firefox support is not great. Typing through the terminal eats some keystrokes.
apignotti 16 hours ago | root | parent |
Thanks for reporting this, the approach to keyboard input is quite convoluted to integrate mobile input well. No "keydown"/"keyup" events on mobile.
Any specific key or character that is not working for you? Or this is a widespread problem?
Jemm 14 hours ago | root | parent |
Also having trouble typing in terminal using firefox. Seems like keys are doubled or missing. I gave up after ten attempts to ping cnn.com
haspok 14 hours ago | root | parent |
+1
Simply typing `ls -la` + Enter in the terminal window was a significant challenge, even if I typed slowly. And then I had to press Enter about 5 times until it registered it.
sharpshadow 8 hours ago | prev | next |
Can one not run a VPN locally instead of using the service?
usemycomputer 15 hours ago | prev | next |
I clicked and see the operating system screen, but how can I use a console?, there are only ads at the sides.
apignotti 15 hours ago | root | parent | next |
I am not sure what 'ads' you are referring to, we don't have ads anywhere on our websites and demos.
Anyway, click on the "Apps" button on the top menu, then click on "Terminal". An xterm session will open for you.
You could be interested in the terminal-only version of WebVM, based on Debian: https://webvm.io
singularity2001 15 hours ago | root | parent | prev |
app -> terminal
mamidon 17 hours ago | prev | next |
Sounds like cool tech, but why would I want to run Linux in my browser? What use cases does this enable?
Thanks
apignotti 17 hours ago | root | parent | next |
There are lots of use cases, these are the few we have identified so far, but there are certainly many more:
* REPLs for any programming language (Python, ruby, nodejs) for trying out ideas or libraries without installing an environment or when on-the-go
* In education, to let students fiddle with languages or the whole linux system without the friction of local installation, which can break. At the end of the class refresh the tab and you are ready for another session
* Virtualizing legacy native apps that are common in the enterprise sector. With WebVM they can be converted to Web apps. These apps will be mostly Windows-based and our next big project will be to get WINE to work well in WebVM, with an initial focus on gaming.
Fundamentally WebVM brings the convenience of virtualization to lots of users that can not yet benefit from it. Not everybody is able to use docker or VirtualBox on its machine.
In the enterprise sector, remote virtualization via Citrix or similar tech is often used, but this comes at a very high operational costs due to server side execution. With WebVM you can have the security and reproducibility of virtualized environments with completely local execution.
lazyeye 13 hours ago | root | parent |
Would love to see a version of Tails running in the browser!
grougnax 17 hours ago | root | parent | prev | next |
Because everything should be in the browser now. The actual question would be "why would you want to run something out of the browser?"
ChocolateGod 17 hours ago | root | parent | next |
So I can control it's deployment, updates and not be at mercy if the website shuts down.
diegocg 17 hours ago | root | parent | prev |
This is obviously sarcastic, because I don't think there is anyone out there who still believes the old fantasy about browsers/JS becoming the "universal platform"?
James_K 14 hours ago | root | parent |
Surely it already is a universal platform. Almost all major software runs on the web / electron.
amelius 17 hours ago | root | parent | prev | next |
Maybe to quickly try out new things?
Or to run software that you'd rather not install?
ranguna 17 hours ago | root | parent | prev |
Having full blown Linux on my mobile phone would be great.
diegocg 17 hours ago | root | parent |
If only there was a mobile operating system based on the Linux kernel
anonymous344 16 hours ago | prev | next |
does the curl command work from inside that?
yuri91 16 hours ago | root | parent |
it does if you log in with Tailscale (networking tab in the side bar).
The terminal-based https://webvm.io has it pre-installed but the graphical demo running Alpine does not.
Luckily, the package manager also works so you can install it with `apk add curl`
znpy 17 hours ago | prev | next |
we've made it full circle ?
13 hours ago | prev |
smusamashah 17 hours ago | next |
Some other VMs that run in browser
https://copy.sh/v86/
https://bellard.org/jslinux/
https://jamesfriend.com.au/pce-js/ (https://github.com/jsdf/pce)
https://www.pcjs.org/ (lots of hardware and OSes) (https://github.com/jeffpar/pcjs)
https://infinitemac.org/ (https://blog.persistent.info/2023/03/infinitemac-dot-org.htm...)
https://jamesfriend.com.au/projects/basiliskii/BasiliskII-wo...
https://jamesfriend.com.au/pce-js/pce-js-apps/