Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
JSLinux – Run Linux or other Operating Systems in your browser (bellard.org)
312 points by begoon on Sept 18, 2017 | hide | past | favorite | 83 comments


It takes less time to boot Linux in Chrome on my laptop than it takes Reddit to load a discussion on my phone. That's pretty amazing. Not sure which is more amazing: How slow Reddit mobile is or how fast Linux boots in JS.


The old Reddit .compact page loads very fast : https://reddit.com/r/.compact

Don't use the mobile web view! It sucks!


wow, this is really insanely fast, great share!

I currently use Joey for Reddit and OpenGur for Imgur.


Thanks! This is much better.


To boot Linux you formally need just the kernel image and a statically compiled busybox executable. This are only 2-3 MB. The boot process can be optimized as well for such a tiny system. You don't need long and complex boot scripts. Just start the kernel and then start directly busybox und you are done.

Windows 2000 takes much longer to boot.


Or try muLinux that boots on a single floppy


I feel like Bellard is a super hero. I wonder if he has a day job and just takes on these interesting (and large?) projects during his off time.


He's the co-founder and CTO of Amarisoft, an LTE/4G hardware and software company: https://www.amarisoft.com/company/


Companies with this type of leadership are the ones I'm interested in giving my money to, long-term, as a consumer. Not because of any sort of principled decision based on his skills, but because I feel these types of workers would stay sharp and be quicker to solve problems correctly should they appear.


Super Hero was exactly what I just said before reading this comment. bow


I'd love to watch him work for a few days and ask him about his productive habits.


tccboot is beyond insane


I just played Pinball in Windows 2000 in Chrome on Windows 10. I lost, but winning was not the point. Playing was. :)

I think that that sentiment encapsulates my CS experience.


Just want to say that Windows Pinball may be MS's best software ever. The gameplay is pretty deep and well balanced.


This sounds a bit sarcastic, considering it's not by Microsoft: https://en.wikipedia.org/wiki/Full_Tilt!_Pinball


>I lost, but winning was not the point. Playing was. :)

Ha, that reminds me something from the book "The Soul of a New Machine" by Tracy Kidder:

https://en.wikipedia.org/wiki/The_Soul_of_a_New_Machine

From the article above:

[ The motivational system is akin to the game of pinball, the analogy being that if you win this round, you get to play the game again; that is, build the next generation of computers. ]

The idea is described better in the book, though.

[ The book won the 1982 National Book Award for Nonfiction[1] and a Pulitzer Prize for General Non-Fiction. ]


That book is a must-read for anybody in tech. I used to order it by the stack to give them away.


Ha ha, cool :)


>winning was not the point. Playing was.

Wise words, I hope you don't mind me pasting this on my monitor. This phrase resonated with me particularly while I'm trying to work out a particular intellectual tough spot.


In case you don't know it (it's well known in France but not sure about elsewhere) that was the motto of the founder of the modern Olympic Games, Pierre de Coubertin.

The important thing is not to win, but to take part.


In German we have „dabei sein ist alles“: „taking part is everything“


Oddly, no one here linked to Gary Bernhardt's talk: The Birth & Death of JavaScript (YavaScript)

[1] https://www.destroyallsoftware.com/talks/the-birth-and-death...


It hung at the boot screen for me, which really took me back.


Disable your ad blocker.


Works fine for me with uBlock Origin enabled.


Took a few minutes on my Chromebook, but it eventually loaded.


> Disable your ad blocker to boot Windows 2000.

WHAT YEAR IS THIS?!?!?!


Did you try to turn it off and on again?


What a great nostalgic color. I think I'll change my Windows 10 desktop to it.

http://www.colorhexa.com/3a6ea5


better get rid of Windows10


Please don't reddit on HN.


Well put.


I'm not agreeing or disagreeing, but I am curious why you say this.


Fabrice Bellard's jsLinux and Jeff Parsons's https://www.pcjs.org/ are pretty fascinating.

I think Bellard uses emscripten (transpiled machine and device emulator code from C to JS), while pcjs is hand-coded JS (which is neat: https://github.com/jeffpar/pcjs/blob/master/modules/pcx86/li...).

Also is the source for jslinux available anywhere? The emscriptified file at https://bellard.org/jslinux/x86emu.js is quite compex.


https://news.ycombinator.com/item?id=5400185 for a previous discussion re source code...


You don't have to rely on the source code of jslinux. There are a lot of other web emulators and most of them are open source.

https://github.com/fcambus/jsemu


It doesn't look like emscripten to me


Bellard wrote JSLinux in 2011, well before Emscripten was a thing.


How does it do wget, etc. without violating CORS? I was able to download from a couple different websites.


It uses a proxy. JSLinux emulates a network device and sends ethernet frames to a proxy via websockets. The proxy sends these frames to a Linux TAP device. The rest is a decent firewall configuration.

You might even be able to connect to another emulated JSLinux machine if you know that IP address.

More information here:

http://www.benjamincburns.com/2013/11/10/jor1k-ethmac-suppor...


https://bellard.org/jslinux/faq.html

> Can I access to the network from the virtual machine ?

Yes it is possible. It uses the websocket VPN offered by Benjamin Burns (see his blog). The bandwidth is capped to 40 kB/s and at most two connections are allowed per public IP address. Please don't abuse the service.


ad blockers here translate nicely to boot errors: Boot failed: could not read the boot disk ntoskrnl.exe missing or corrupt



These are 2 independent developers. However the emulators have some technologies in common like the 9p virtio filesystem under Linux.


Wow, that's impressive! I tried FreeDOS and it booted very quickly. Nice to play around with DOS again - it's even got tab completion on the command line these days - fancy!

p.s. By the way archive.org were doing something very similar. You could load up a DOS box from their web site and have the old disk mags and demos running in your browser. All very cool stuff!


    rm -rf / 
It just feels so wrong. I know it's doing exactly zero damage but I still feel guilty running it.


Interesting with the VFSync site, nice to see some standardization on this. I used to work on on-demand file systems in Emscripten, but it never worked well, especially because you can't have binary XHR outside webworkers.

https://github.com/kripken/emscripten/commit/e2046bb8ce2b2cc...

But I don't understand, why is VFSync superior to something like NFS?

It seems that Bellard is trying to set up a hosting site for VFSync, so that people can easily share images. I dreamt about having something like that, combined with copy-on-write, which would make it possible to make small changes to a big filesystem and share them, without having to upload the full system. Kind of like with Docker. I wonder if that would be compatible with the VFSync model.


I couldn't get the Windows 2000 VM to connect to the internet, otherwise I wanted to try and get at least a 1-level recursive reference going... Windows 2000 running in Firefox running in Windows 2000 running in Chrome running on a Macbook Pro.

If anyone has gotten Windows 2000 to connect to the internet, would love to take a stab at it.


I was a little disappointed to see there wasn't any internet connection on Windows 2000.

All I wanted to do was to open Firefox, goto https://bellard.org/jslinux/ , and fire up the Linux emulator ...


I had working internet in IE5. You have to walk through the internet connection setup for LAN, but it works.


There's internet in the windows 2000 setup.

But remember that old IE versions doesn't support SNI !


I tried pinging google.com from cmd and it worked, both on Firefox and Chrome. Didn't try browsing the web though. Maybe the VPN (https://news.ycombinator.com/item?id=15278430) is overloaded or blocks that somehow?


You need to configure DNS!


Cool stuff! GCC works - I thought it was broken, but it just takes a long time.

[root@localhost tmp]# time gcc hello.c -o hello

real 0m 24.43s

user 0m 2.63s

sys 0m 2.17s

[root@localhost tmp]# ./hello

Hello, World!


TCC is faster. It's on the comments of hello.c


please try at least two times. The first time it has to download GCC and all dependencies.


Windows 2000 plays wonky with my keyboard. Any idea why?

For instance, I open Pinball and, after getting a new game with F2, pressing space (to launch the ball) does nothing except open that menu that pops up when you right click a window.

I open Notepad and I can't type words. If I press "o" it opens the "Format" menu. Which strikes me as odd.

(But really, just let me play Pinball. :D)


My psychic debugging skills tell me that the Alt key has gotten stuck down in the emulated machine. Try focusing on the emulator and hitting Alt a couple of times. (This can happen e.g. if you alt-tab away from the window: the emulator sees alt-down, but the alt-up happens in another window and the key stays stuck down in the emulator.)


That sounds like a reasonable explanation, thank you. And it works!

Now behold all the work I will not be doing today. :v


Yay, glad I could help!


Sounds like Windows thinks you're pressing the Alt key all the time. Try pressing and releasing the Alt key when Windows has your keyboard focus.


Is there a practical use case for this other than "ain't it cool"?


Possible emulation option for olde Windows applications, but installing stuff would probably be tricky, and Virtualbox would be a better option. But it depends. Chromebooks or other browser-only systems would be a target.

But anyway, ain't it cool?


Checking for bugs in Emscripten perhaps? A project as complex as an OS is probably good for finding edge-cases.


Doesn't this work by emulating the processor instruction set along with a few key drivers? The complexity of the OS itself wouldn't be directly hitting the emulator.


Fulfilling my lifeline dream of getting to run

    rm -rf /


If you're on Windows, could you use it instead of a virtualized Linux? Maybe a work computer disabled the virtualization?


How do I install vim?

PS: It has git, but no network.

PS: Upload non-zipped tar balls works. How to access the image (downloading)?

PS: Well, it is way too slow and hangs easily. I guess it is only an interest at this point.


Browsers won't let javascript that's running on a webpage access random TCP ports, at the very least you'd need a server component that could act as an IP proxy for you, perhaps tunneling over websockets.


I haven't tried it, but apparently you can upload files, so it would be a matter of pushing the vim source tarball there and build it. (edit: oops, you beat me to it)

As for network, they say this:

>Can I access to the network from the virtual machine ?

> Yes it is possible. It uses the websocket VPN offered by Benjamin Burns (see his blog). The bandwidth is capped to 40 kB/s and at most two connections are allowed per public IP address. Please don't abuse the service.

But I haven't been able to get it to work...

Edit: the X11 VM has networking. Don't know how to get networking in the non-X11 VM


Wow, now includes graphics!!! Fabrice Bellard is amazing.


Is it using WebAssembly?


According to https://bellard.org/jslinux/tech.html it's using asm.js since 2015. But at the bottom of the page it mentions wasm, so it's not clear.


I thought it's just a vm?


The virtual machine host itself has been compiled to asm.js (or maybe wasm) and runs in the browser.


Super slow, but pretty cool....

Finally I can play Solitaire without Ads again.


There's a way to get the old windows 7 games working in Windows 8/10, you can find it on the winaero forums.

Personally I just have windows 3.1 installed under dosbox, as it gives me the entire WEP and Crystal Caves. If you decide to do this, I recommend dosbox-x, or other unofficial release, as official releases are old.


oh !

- linux kernel 4.12

- freedos image - windows 2000 image (!!!)

and riscv32 emulation for the above listed


Not sure about the true meaning of your comment. But if you search for a 32-Bit RISC-V emulator, you can find it here:

http://s-macke.github.io/jor1k/demos/riscv.html


Has anyone gotten uploading to FreeDOS to work?


One step closer to GNU Hurd hegemony!


Was windows 2000 open-sourced?





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: