Forgot your password?
typodupeerror
Linux

Linux In JavaScript, With Persistent Storage 171

Posted by timothy
from the and-all-I-want-is-a-working-wireless-card dept.
An anonymous reader writes "Remember Fabrice bellard's [Linux-booting PC emulator in JavaScript] ? This modified version [Note: click on "emulator.html" in that directory to see it in action] allows the same emulator to boot the most recent linux kernel, 3.0.4, as well as providing the user with persistent storage. It is achieved by building a virtual block device, which stores data in HTML5 local storage. The block device can be partitioned and formatted as ext2, so it can be easily used."
This discussion has been archived. No new comments can be posted.

Linux In JavaScript, With Persistent Storage

Comments Filter:
  • Great! (Score:2, Funny)

    by Anonymous Coward
    So when the web browser becomes the OS we will still be able to issue cryptic command-line incantations to do things that everyone else has to point-and-click to do!
  • Educational sandbox? (Score:4, Interesting)

    by Irick (1842362) on Saturday October 08, 2011 @10:35AM (#37647718)
    This could be a great thing to embed into online how-tos and the like for teaching basic or even advanced linux. ... heh, embedded linux on the rise again :P
    • Some post-PC pessimists are under the impression that this educational sandbox will soon end up being all you have because the operating system publisher or hardware maker won't give you the cryptographic keys to boot anything else unless you represent a major corporation.
      • "unless you represent a major corporation"
        So we'll have RedHat, Ubuntu, and Oracle Enterprise Linux and Suse. And I guess the Ubuntu folks get a key for debian as well.
        Of course it would negatively affact minor distributions, and I'm totally against it, but don't pretend that Linux would just suddenly disappear.

        • by Velex (120469)

          You know damned well it doesn't work that way. Ask your local soccer mom. Linux has a scary black background with a cryptic text interface and is either a.) a tool for copyright infringement to steal from hard-working, job-creating content owners b.) only used by subversive teenagers c.) used to commit cyber crimes (just like in The Lawnmower Man and isn't it wonderful that writer in Maine can explain computers to us simple folken, say thankya) d.) a tool of the devil with its black background. Nobody wh

    • by Guylhem (161858)

      Believe me or not but for a 101 bioinformatics course I taught this year, I picked up jslinux to teach grep, pipe and other shell scripting basics.

      This was just the simplest option to get a linux prompt on every machine of the computer lab - and studenta who had brought their own laptops could work on the very same examples as the rest of the class, in an identical environment.

      Busybox grep is good enough for teaching the basics to students, and they can access the very same setup from home if they want to r

  • Oracle is making announcements about Java 7 and 8 this week. Supposedly the new stuff is better integration between Java and HTML5, and between Javascript and the JVM.

    Will that revised tech be good support for an interactive user shell with a Javascript commandline calling Java objects, reporting back HTML5 in a DOM? Interactive HTML5 GUI objects that can take GUI events back into Javascript logic or just Javascript glue to Java objects in the JVM?

    Will Android's Dalvik JVM follow that route, or take its own

    • by g4b (956118)

      I dont think Java will play a big role anytime soon in most of the web. Especially this demo shows, that js itself has become so powerful, that powerful conversion a compilation apis will evolve, completely removing java from interest in the web. and I fear the people who might consider your path of using integration to a VM in the background will use adobe products more for these tasks, where interaction is already given - even if the flash vm sucks.

      Your point is however interesting, because it shows what

      • by g4b (956118)

        ah yeah, and there is the werewolf in the vampire: .net with silverlight and browsers would compete here too on windows devices.

        but vampires get fewer after generations of desperate although somehow successful geeky witchhunts.

      • by Doc Ruby (173196)

        I don't see a GUI shell on a JVM being a Web technology. Except that the GUI and JVM could be remote from each other, transparently. Mainly I'm interested in a GUI shell to an OS and a complete machine, distributed or not. That's not really the "Web", though it could be the "Internet".

        I'm especially interested in a mobile platform that works this way, so Android - which is an OS dedicated to running a JVM.

        I'd like to use a fully dynamic GUI markup format like HTML5 for presentation, Java classes for computa

        • by g4b (956118)

          Now I understand. There is however in this scenario also the possibility that Google will Go another way.

    • by Velex (120469)

      Java and Javascript are two completely different technologies. The only thing they have in common is a C-like syntax and four letters.

      It's the same thing to glue a Javascript object to a Java object as to glue a C# or Ruby or PHP or Perl or CGI or whatever you're running server-side object to a Javascript or VBScript or Ruby or whatever you're running client-side object.

      I find languages like Javascript and Ruby very interesting, but just don't get it mixed up that Java has anything to do with Javascri

      • by Doc Ruby (173196)

        You are wrong. As Oracle has been announcing, Javascript is now supported by (announced) technology in the Oracle JVM.

        You were correct for a long time. When introduced, the only connection was a superficial syntax similarity that is shared with many other OOP languages. But, as I pointed out, the "Sun" JVM now has Javascript support in it. FWIW, I wasn't talking about the browser, either.

        • ..you can use Javascript as a scripting language in a JVM - no still no connection, you can script JVM with Groovy already does this mean it is Java ... no

          JVM is a virtual machine, the main language for programming it is Java
          You can also program in other languages and script it in several languages - One of this will soon be JavaScript

  • 9.80 BogoMIPS (Score:2, Informative)

    by Anonymous Coward

    Pentium MMX. Is that what everyone gets as well?

  • by Junta (36770) on Saturday October 08, 2011 @10:44AM (#37647778)

    "Windows 8 is going to use less memory"
    "Oh yeah? Well Linux can run in javascript, ha!"

  • New malware vector? (Score:3, Interesting)

    by Anonymous Coward on Saturday October 08, 2011 @10:46AM (#37647798)
    Rather than using javascript to load infected files that use *.pdf and other infectible formats, they can now run a botnet just using an infected ad straight inside your web browser.
    • But where is the advantage? I would assume that the linux VM would face the same restrictions as any other javascript in a browser.

      • by ksandom (718283)

        As soon as someone figures out a more useful way to access the internet than simply tunneling through http/s, this will effectively provide rooted-box-in-a-box. Ie stuff-all effort to get a huge number of hosts at your disposal. Persistent storage provides an easy way to resume where you left off.

        • by mysidia (191772) *

          As soon as someone figures out a more useful way to access the internet than simply tunneling through http/s

          How about a kernel mode driver inside the browser-based Linux box for a network stack tunnelled over HTTP/s to a dedicated application running on the same host as the browser to decapsulate tunnelled traffic and dump it onto a local virtual network bridge, kind of like the one used by VMware Workstation or Xen ?

          Or even just an application utilizing a Java extension API to allow the Linux-in-br

          • As soon as someone figures out a more useful way to access the internet than simply tunneling through http/s [...]

            As soon as that happens, an attacker could just write his program in javascript instead of stuffing it into a VM running on the same JS engine, with the same access restrictions.

            [...] to a dedicated application running on the same host as the browser [...]

            What's with all the hoops? if the attacker can run an application with net access, there is no need for a Linux VM.

            • by mysidia (191772) *

              What's with all the hoops? if the attacker can run an application with net access, there is no need for a Linux VM.

              I'm suggesting the application would be something 'legitimate' with legitimate uses eg users who WANT their Linux-in-browser to have network connectivity, to help with training or whatever function this Linux VM is being used for.

          • How about a kernel mode driver inside the browser-based Linux box for a network stack tunnelled over HTTP/s to a dedicated application running on the same host as the browser to decapsulate tunnelled traffic and dump it onto a local virtual network bridge

            So, to break the Linux-in-a-browser out of the browser security sandbox the malware distributor simply has to gain the ability to run a HTTPS server on the same client machine outside that the Linux-in-a-browser can talk to and that will then issue the actu

  • What's the login? If I download it, will my js Linux remember things from session to session? Could I install a webserver on it?
    • by felipekk (1007591)

      I logged in with root and no password.

      I guess you could install a webserver on it, then maybe even host those same files (including "emulator.html")...

      Then on another session open a web browser, point to your webserver and open the emulator...

      That way you'd have an emulated web server serving an emulator that is being run on an emulated web browser emulating linux.

    • by sho-gun (2440)

      standard linux fresh-install login.
      username root
      no password.

  • by sgt scrub (869860) <saintium@yahoo.cMENCKENom minus author> on Saturday October 08, 2011 @10:53AM (#37647836)

    While jsLinux is cool, and this is a cool addition, it just makes me wish JavaScript wasn't the only languageVM embedded in the browser. The thought of what could be done if one could take advantage of what the various scripting languages do best instead of trying to fit JavaScript to everything makes me sad.

    • Google Chrome has "Native Client", a verifiably type-safe subset of native code. One might, for example, port DOSBox to Native Client.
      • by sgt scrub (869860)

        Salt and Pepper, PPAPI, are really cool if you write C/C++. I was talking more broad like Parrot.

    • by catbutt (469582)
      Well Dart is coming out in a couple days.

      Although I'm not sold on the "use the best language for the job" mentality, I have better things to do than learn new languages and port my code from one to another. I see no reason why a single language can't do everything from user scripts to systems development, while maintaining elegance and expressiveness. Not saying that language has been invented yet (or will be any time soon), but still.
      • by sgt scrub (869860)

        I have better things to do than learn new languages and port my code from one to another

        That sounds a lot like what a person that writes Python, Perl, Squeak, etc... would say when asked to re-write everything in JavaScript for the web. :)

        IMHO. Computer languages are tools. The more tools you know how to use the easier life will be.

    • by BZ (40346)

      If you want to embed multiple language VMs in the browser, you immediately start having issues with cross-VM reference cycles causing leaks. The infrastructure needed for breaking those is .... nontrivial. You also get very complicated interactions performance characteristics as the VMs interact. Note that historically browsers have had issues just solving these problems for the JS VM and C++ DOM, without adding more VMs into the mix.

      A better bet may be having a single VM that multiple languages can comp

      • by sgt scrub (869860)

        I was referring to your second example, JVM, though it isn't a very good example. All the languages need to be "JIT'd" before use. Parrot is the better example. If they would nail down the embedding API we might have what I think people would like. I certainly would.

        • by BZ (40346)

          Yes, but why is Parrot a better approach than just compiling to JavaScript and using the existing JS VM?

          (And note that Parrot is much like ActiveX: an unspecified single-vendor kinda thing.)

          • by sgt scrub (869860)

            1) You loose a lot in translating code. No optimizations.
            2) You can not use libraries native to the language.
            3) You end up having to write/correct the translators with "if (typeof myFunction=='undefined') {"

            unspecified single-vendor? ActiveX is a response to NPAPI with gapping holes in system security. Adding a VM that can interpret native code eliminates ActiveX, NPAPI, and PPAPI while, if done correctly, creates a jail/sandbox for web content.

            • by BZ (40346)

              > 1) You loose a lot in translating code. No
              > optimizations.

              This is true of any intermediate representation not designed with a particular language in mind, to some extent. The emscripten compiler does in fact do a fair amount of optimization, and it's operating on LLVM bitcode that's already had some optimization passes applied.

              > 2) You can not use libraries native to the language.

              In the specific case of emscripten, again, you just compile the libraries,

              > 3) You end up having to write/correct

              • by sgt scrub (869860)

                Parrot is GPL'd. Being locked into Open Source for code visible to any user isn't much of a lock in.

                • by BZ (40346)

                  1) Many project can't use GPL'd code. Opera comes to mind, say.

                  2) Being GPL'd in this case just means you can fork it, not that you can affect its development or prevent changes that break you. Google has complete power to evolve Parrot in any way it wants, and if it happens to break other browsers that happen to be using Parrot or breaks websites they have no choice but to deal. It's not quite as bad as being locked into something you _can't_ fork, of course. But don't pretend like it's "not much of

                  • by BZ (40346)

                    Er, I just realized there's some confusion here (on my end) between Pepper and Parrot. So ignore what I said here while I go and read up on Parrot details. ;)

                    • by sgt scrub (869860)

                      :) and while your at it think about why google didn't spend some effort advancing parrot instead of dumping yet another scripting language on us. it boggles the mind.

    • The answer is Curl http://en.wikipedia.org/wiki/Curl_(programming_language) [wikipedia.org]

      this is a full programming language that also does markup, scripting, CSS, all in one language ...

      • by sgt scrub (869860)

        Curl allows one to have my_python_code.py, my_perl_code.pl, and my_javascript_code.js files on the server and content type tags for perl, python, and javascript and the browser will interpret the three scripting languages and apply the code to the content? That is the behavior I, obviously poorly, tried to describe.

  • Year of (Score:5, Funny)

    by JustOK (667959) on Saturday October 08, 2011 @11:24AM (#37648026) Journal

    All hail the year of linux in the browser!

  • by PPH (736903) on Saturday October 08, 2011 @12:04PM (#37648238)

    ... and I've got a Beowulf Cluster!

  • With Linux, the browser runs you!
  • This'll be handy for those who've bought into the Google Chromebook and discovered that all they get is a browser... no, seriously, don't you guys think you were even the slightest bit done over, when you can get a webbook for £60 with free lifetime data allowance?

  • Did anyone manage to run stuff like gcc in this? It would make a _GREAT_ education tool.

    (network access would be great too, but I guess that would be pretty hard with javascript...)

  • by prograde (1425683) on Saturday October 08, 2011 @05:29PM (#37650308)
    Ok, that was, by far, the easiest way to get Linux running on my iPad.
  • Can I get a JavaScript engine that copies the best features of MS PowerShell script (as PS has copied the best features of JS, Perl, csh, and Java/C++)?

    Mainly I'm looking for a typed object pipeline with reflection the shell can access. Reflection that exposes APIs of all the classes (bundled in apps and in the OS) installed in the system. Which, as Javascript, should mean "installed in the Internet". Javascript that wraps reflection via CORBA or some other webservices registry/server would be extraordinary

  • This web app would be even cooler if the local Linux state could be synced with a server's state. If I could run commands locally, generating a history file that I could send to a server to execute over again there. Or vice versa, where I create state in the local Linux by rerunning history commands downloaded from the server. Or sync either direction, line by line. A kind of "VMWeb".

    As it is I don't see any way to install any app in it, either by downloading a binary or by compiling typed-in source locally

  • by Doc Ruby (173196) on Saturday October 08, 2011 @06:55PM (#37650804) Homepage Journal

    This cool Web app is not "Linux in Javascript". It is in fact a "Javascript PC Emulator", just as the app says in the app's page title. It's a bootloader and a virtual PC implemented in Javascript running in the browser JS engine. Which loads a stripped-down Linux binary into itself and runs it, as if it were running on the PC. The Linux was written in C, compiled into PC (x86) machine instructions like any PC Linux, and then runs on the Javascript PC emulator.

    I suppose it might be possible to run a Windows binary on it, if that bloatware would fit in the browser. Maybe DOS, or even Novell Netware (though this Linux demo has its networking stripped, and in any case the browser enforces the originating-server-only network access).

    Very admirable project. Truly journalistic bad headline and summary.

  • which dynamically compiles x86 code into Excel macros.

    *duck*

  • ...is actually 3.0.6. kernel.org is back up but it's not updating properly.

Do molecular biologists wear designer genes?

Working...