Linux In JavaScript, With Persistent Storage
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."
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!
Because you can? Because nobody else has done it? Because it's cool? Because it's a challenge?
It depresses me that everyone always responds to these articles with "Why?" and "What's the point?" and "What a waste of time". The whole of human achievement is pretty much the story of people doing things just to see if they can, or because it's interesting to them, or because it's never been done before.
aww but it is art. Beautiful wonder full art.
epic sig..... ya i got nothing
Because this guy can.
Some apps are WYSIWYG. Some others are WYSIWTF.
I happen to be interested by the implementation of Javascript engines these days - but I don't know yet if I will write my own any time soon ! Anyway, this emulator was a way to learn how to write optimized code for recent Javascript engines, in particular Jaeger Monkey (for Firefox 4) and V8 (for Chrome).
I wouldn't exactly say that javascript is cool.. Now doing it in Hypercard, on a Mac IIx, that would be cool.. and a much bigger challenge.
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
Three awesome reasons:
1) Because you can,
2) Because no-one else ever has,
3) Because there are useful lessons that can be learned by performing an exercise like this.
and I'll go ahead and speculate on the fourth and possibly best reason:
4) Because the developer enjoyed solving the problems involved in doing it
The time he spent doing this is probably equivalent to the time you spent watching all 5 seasons of the Battlestar Galactica. I'll leave it to you to decide which was the more monumental waste of time.
You can never know everything, and part of what you do know will always be wrong. Perhaps even the most important part.
He got to the front page of Slashdot. I don't think I need to say more.
Clicked pie.
I think it's very cool. Technical, yes. Difficult? Probably not that difficult seeing as Linux is designed to be amazingly portable. It doesn't even need the C standard IO library to compile, so really you'd just need to emulate a few low level interfaces for things like memory access, keyboard input and a terminal display. There are a few different ways to implement it, but if he has it running quickly then that would be quite impressive :)
which is totally what she said
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 route to that architecture?
--
make install -not war
LOL, so those strings of characters you mention which produce an array of bytes which are interpreted mechanically by the processor are soooo much better than the string of characters in javascript which produce an array of bytes which are interpreted mechanically by the processor. Yup, you're right.
Do you want us to use Flash instead? O! Enlighten us, wise one, about the numerous other languages that are available for web browsers!
Clicked pie.
Pentium MMX. Is that what everyone gets as well?
"Windows 8 is going to use less memory"
"Oh yeah? Well Linux can run in javascript, ha!"
XML is like violence. If it doesn't solve the problem, use more.
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.
News flash: it won't and it will only get better.
Look at everyone going meta. :D
Now I want to run X on this virtual machine and fire up a browser. (Maybe just install Lynx on it if I can't install X on it.)
That'd be a browser in an OS in a browser in an OS.
Some apps are WYSIWYG. Some others are WYSIWTF.
The special thing about it, is that it's available on almost any modern computing device, down to phones. It's become the Windows of programming languages in a way - not the best option, but it's just so damn common that you should at least learn to use it. I don't know why we don't have any alternative scripting languages for browsers yet. CoffeeScript looks nice, but it just compiles down to JavaScript anyway.. so not the most efficient way to do things if you need to ship your framework as libraries on your website rather than it being built into the browser.
I did suspect that Ruby was a bit of a fad, but it is a nice language all the same.
which is totally what she said
Hell, it's basically a mistake of history and circumstance that it's so widely available.
Herein lies the reason why javascript is not 'just a fad'. No matter your opinion of the DOM and javascript syntax, it is *capable* of being used to get the job done and it is everywhere. Other than making tasks absolutely impossible, it's hard to offset in difficulty the benefit of being everywhere. No other language will be everywhere so long as javascript is 'good enough'. Any browser attempting to bring their own favored child in will not meet with adoption because Javascript will work too and on other browsers. Short of getting Microsoft, Google, Apple, and Firefox to adopt the language with *zero* footprint to start with, nothing will change.
XML is like violence. If it doesn't solve the problem, use more.
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?
Democracy Now! - your daily, uncensored, corporate-free
why?
To show that we have gone way too far allowing remote scripting facilities in the browser, to the point that websites can run a complete OS of their choice on our machine just because one clicked a link. Or maybe I am misunderstanding the intention? This is NOT considered a good thing, right?
Emm, what's d login name and password?
5ryn
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.
Having to work for a living is the root of all evil.
why?
Isn't it obvious? He wants to have the linux in order to run a browser with javascript.
Some drink at the fountain of knowledge. Others just gargle.
don't click, it's goatse.
On second thought, let's not go to Camelot. It is a silly place.
Well, obviously - that's the only way it can go.
What is bad about it, if it's within the bounds of the browser's sandbox?
which is totally what she said
I suppose at some point someone might get a JVM running in Javascript...
Lua is a better scripting language, and Python is a better prototyping language
So you're saying we should build a Lua/Python interpreter in Javascript so we can use these superior languages in our browsers?
Pretty good is actually pretty bad.
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.
and Java, C++ and C# are better languages for building large networked applications.
As for Java: A browser maker wants to blacklist the Java plug-in because of how it interacts with SSL.
As for C++ and C#: You have to be an administrator to install a C++ or C# program on a PC, and a lot of people don't know the administrative password of the machine they use. This could be because A. they aren't the head of the household or B. they aren't in the IT department. It's even worse on a set-top box:, you have to be a major corporation to get a C++ or C# program digitally signed for installation.
Google Chrome has "Native Client", a verifiably type-safe subset of native code. One might, for example, port DOSBox to Native Client.
Droste for the win.
You know the reason as to why they respond to these questions with "Why"? Because they can.
There is no reason to get depressed if people have not the same insight or opinion as you have. It will make your life a whole lot easier (and less depressing).
I am sure that some things these people do you will find a waste of time. Should they get depressed of that because you ask them "Why?" or "What's the point?".
The question of why is just as relevant as why not. The only thing it shows by your response is that you have different priorities. And that is a good thing. Remember: We are all individuals. ( ... I'm not.)
Don't fight for your country, if your country does not fight for you.
Having read TFA (well, the README), it's as the summary says and the only really new thing here is the HTML5 storage driver. So my last comment would have been better made on the previous article about JS/Linux. This storage driver is very useful if you want to mess around in JS/Linux, so it was a brilliant idea. It would be pretty funny to see X on this, maybe even with WebGL 3D acceleration.. I certainly wouldn't want to wait around for it to compile natively though!
which is totally what she said
Honestly, this should make you chuckle and smile and say "Wow!"
"Why" might be in there somewhere but if it's your first port of call, you're a lost cause - hand in your geek card.
OMG!!! Ponies!!!
There should a "Post as Anonymous Troll" option.
mod me out without posting or proving this isn't real
nice job
never again
enjoy your bots and bullshitting people
All hail the year of linux in the browser!
rewriting history since 2109
Yes. And the nice thing about this is that you can make things as slow as you need to. For a while, there was a threat that hardware would outpace the demands of software, but now that we're building everything in bloated virtual languages running in virtual machines running on virtual hardware, we can NEST that shit and continue to drive the demand for ever faster hardware.
Because otherwise, you know, my 2002 desktop runs KDE 4.7, Win7, the latest firefox and thunderbird, and everything else I throw at it with no problems. There's serious danger in that I haven't needed to upgrade it for a decade. We can't have that now, can we?
... Lua is a better scripting language...
Hahahaha. Oh wait, you were serious? Let me laugh even harder.
And you think there are things special with Lua? Yeah, maybe special about being awful.
Nobody thinks there is anything special with JavaScript, it was the one that won the browser scripting wars.
Where was Lua then? It wasn't even in the running.
Your awful opinion of JavaScript won't do anything to it.
It is a very, very capable language. The only terrible thing about working with JavaScript is working with the terrible DOM that it is built around. The HTML DOM is what is wrong with JavaScript.
It will still be here as long as browsers still exist, and will outlive everyone here probably, unless Native Execution Inside Browser Sandbox takes off. (NEIBS, the new buzzword coming to you in a near future!)
Doesn't run in my Android browser.
why not?
it'as easy to challenge something someone does, isn't it? now that you have discovered this, what have you done lately? it's hard to do something interesting yourself, huh?
there's people who dress up like characters from dead tv shows, people who try to grow giant pumpkins, people who bend giant steel beams and call it art, and people who spend years of their lives leveling MMORPG characters. why? why not?
and, i suppose, there are people who try very hard to comment on slashdot forums in the negative, regardless of intellectual or probative value
hmmm, maybe you understand the esotericity of human endeavour after all
intellectual property law is philosophically incoherent. it is your moral duty to ignore it or sabotage it
That'd be a browser in an OS in a browser in an OS. :D
... and that could be extended to an arbitrary depth!
It's easier to be a result of the past, but more fun to be a cause of the future! http://www.spacefinancegroup.com/
Umm, you don't have to be an administrator to install a C++ or C# program on a PC. I compile and install C, C++ and Java software to my unprivileged user's home directory all the time on Linux, Solaris and Mac OS X systems. I run Windows programs written in C++ and C# from my unprivileged account's desktop just slightly less often. I've never run into problems.
Heck, my mother (she's 76) has her own PC running Windows 7, and even she knows how to download and install software on her own, while using a non-administrator account.
Why do you JavaScript morons and Web 2.0 weenies always make the false claim that "you have to be an administrator to install a program on a PC"? Do you realize how badly it undermines your credibility when you so publicly show that you don't even know how to install software?
The whole of human achievement is pretty much the story of people doing things just to see if they can, or because it's interesting to them, or because it's never been done before.
Most of the achievements that actually push the world forward have been either to impress girls, make money or scientific curiosity. Hobbies don't tend to have the ambition to do any of those things, only to have personal value to you. It'd be a snowball's chance in hell if me watching TV or playing video games lead to anything like an achievement (or well, lately games have been giving me 100s of achievements for random crap). Sports or exercise might get me in better shape, but I'm not about to set any records at anything. I like to develop as a hobby, I think it's cool to be able to control a computer into doing things for me, like some people like to teach their dogs tricks only with less fur and far more obedient.
The only time I go "Why?" is when I feel you're making it extremely difficult for yourself for no particular reason I can think of, like can you scrub this floor with a toothbrush. Of course you can, but like... why? I fully understand when people want to do it themselves, like make their own pasta from wheat even though it's available in the store but not just arbitrarily limit myself to poor tools. Even within a hobby it's fun to do the best you can. Somehow using a javascript engine to run Linux sounds a bit like using the worst possible tool for the job. Yes, it's half "Wow, you can do that?" but the other half is "With a toothbrush? Seriously?"
Live today, because you never know what tomorrow brings
You have no clue what you're talking about.
which is totally what she said
That is worthy of attention. More so than climbing Mt Everest but less than inventing the transistor.
Do you even lift?
These aren't the 'roids you're looking for.
Have gnu, will travel.
No, encourage browsers to use the script tag for languages other than JS. That was the original intent.
It's been present on pretty much all browsers of any note since the late 1990s. Love it or hate it, Javascript stopped being a fad a decade ago, and has so much momentum now that unless you want to give up web development, you'd better just man up about it.
The world's burning. Moped Jesus spotted on I50. Details at 11.
With Linux, the browser runs you!
A Mac IIx, you must have been one of those rich kids. I had a Mac Plus and I fucking loved it!
LK
"Hi. This is my friend, Jack Shit, and you don't know him." - Lord Kano
Because this guy's ePenis is bigger than yours and he wants the whole world to know about it.
LK
"Hi. This is my friend, Jack Shit, and you don't know him." - Lord Kano
Where are instructions about how to create the advertised 'persistent block device'? Perhaps I missed it but the readme says that "This project allows the virtual machine to access a persistent block device. This means a user can format and partition this device inside it's virtual machine." BUT I do not see the instructions anywhere obvious. Even booting up this virtual machine ... I had to guess to login ... I eventually found user 'root' and an empty password would work to login. A quick 'df -h' does not reveal any persistent block device present. So I ask myself ... after going to all this trouble to host this demonstration ... why aren't there a few more instructions other than "For more details, see the source code." offered?
Signed perplexed.
OK, well then, keep an eye on Google News Montreal. Now where do I keep my chopsticks?
This isn't Linux ported to the browser (e.g. C to LLVM to JavaScript, which has been done in other instances). This is a reasonably "normal" build of x86 Linux running on an x86 emulator written in JavaScript, with a few special-cased virtual devices and drivers.
Some of us like goatse, you insensitive clod!
Start it up in VMWare instance. Start up VMWare. Hot move the instance running the web browser to itself. It would so rock.
We heard you like Linux... so we put some Linux in your Linux so you can Linux while you Linux.
Today, you is what i like least about Slashdot.
The soylentnews experiment has been a dismal failure.
You can only afford to nest virtual machines up to a point, after which the drag on performance becomes unaffordable, even on the fastest machines. A JavaScript x86 emulator is really cool, and it might be interesting to those who want to run (or serve) system code over the net, or push the limits of JS and it's implementation, but that's about the extent of it's potential as far as I can see.
"(NEIBS, the new buzzword coming to you in a near future!)" Awful... I much prefer NaCl...
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?
Operation Guillotine is in effect.
Only the bootloader needsto be signed for secure boot, so as long as grub is signed, you can boot whatever yoou want.
The license of GRUB requires that it be distributed with "Installation Information", which includes private keys for signing. Operating systems would need to be shipped with a non-GPL bootloader, and makers of home PCs would have no incentive to include keys for this bootloader because boot-time malware could work by installing it and setting it as default.
you can boot linux from the NTloader just fine if you have a system tah only has MS signing keys and no way to disable secure boot.
The NT loader of Windows 8 will check the signature on any kernel it loads, and (I'm guessing) so will the NT loader of Windows 7 and Windows Vista after a service pack to allow their use on machines that require UEFI secure boot.
and still no one sees the security problems and thinks maybe just maybe html5 encompasses far too much for web a browser.
increase features to hell with the consequences!
Umm, you don't have to be an administrator to install a C++ or C# program on a PC. I compile and install C, C++ and Java software to my unprivileged user's home directory all the time on Linux, Solaris and Mac OS X systems.
It appears you've never used a thoroughly locked down machine with /home mounted noexec.
I run Windows programs written in C++ and C# from my unprivileged account's desktop just slightly less often. I've never run into problems.
It appears you've never used a thoroughly locked down machine with Software Restriction Policies.
Why do you JavaScript morons and Web 2.0 weenies always make the false claim that "you have to be an administrator to install a program on a PC"?
For one thing, PCs have the measures I described above. For another, please address video game consoles and other set-top boxes, which won't run anything unsigned or self-signed.
How is Ruby more or less a fad than Python? How is Python a better language? Sure, they follow different language philosophies, but they offer many of the same features and occupy the same niche. And readability depends on one's aesthetic. Is white space more readable than begin end blocks (or curly braces)?
Ruby and others in a browser, not so revolutionary now but interesting.
http://ejohn.org/blog/the-browser-scripting-revolution/
TCL in a browser, if it were integrated it would be more relevant.
http://www.tcl.tk/software/plugin/:Python
I doubt gawk, perl, bash scripting or others will run in a browser soon.
I'd go on a Vegan diet but the delivery time from Vega is too long. --brownkitty
Not sure why this was modded offtopic. This type of "demonstration" is a direct result of the ubiquity, not the extensibility of the language.
You should think twice before suggesting that people like the GP "at least learn to use JavaScript". The people who are the most critical of JavaScript are often the ones who have used it the most, who know it the best, and who have likely used many other programming languages. They know in-depth just how awful JavaScript truly is.
cat README This will solve your problem.
I think, therefore you are.
Because they're a geek.
And you're not. Why are you reading Slashdot, let alone posting to it? Poser.
--
make install -not war
cat README
Most SW development isn't either to impress girls, make money, or even "scientific" curiosity (not eve CS). It's to enjoy doing something the doer has never themself done before, and/or have the results from your own labor. A pretty good amount of SW development motivated by that has pushed the world forward.
That is a lot different from hobbies like watching TV or playing video games. The difference is between producing something, and consuming something. Very little consumption has ever pushed the world forward - probably none by a single person (and any is vastly outweighed by pushing us backwards).
This particular hobbyist effort might not push the world forward. So what? Its equivalent is "let's make a tiny S-100 bus 6502 CPU into a personal computer mimicking a $100K IBM machine". A few dozen hobbyists doing that pushed the world far forward. The same happened with radio and plenty of other electronic hobbies, and (among the rich) with astronomy, botany and other hobbies become sciences.
And even here the "Linux in JS" effort is by a hobbyist specializing in embedded script engine development. This particular stunt might not push anything forward but their own expertise - or passion. Which is where world pushes come from.
Scrubbing a floor with a toothbrush is hazing partly because it's been done before, which makes it even more pointless - and so more tedious. "Linux in JS" is new, and so less pointless. Even if it is a terrible tool for running Linux. It's a pretty good tool for exercising the imagination, and the skills and commitment to back them up.
--
make install -not war
Liar.
--
make install -not war
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...)
Ok, that was, by far, the easiest way to get Linux running on my iPad.
It depresses me that some people think whacking away at a keyboard at some random futility is in any way comparable to an achievement along the lines of climbing Everest or inventing the transistor. If I decide to smear myself in feces and shove chopsticks up my ass and run screaming in the street, *just to see if I can*, that's worthy of attention?
Only if you set them on fire.
I wasn't meaning "you" as in the GP. I was making an analogy that like it or not, you're going to need it in future if you're in certain lnes of work
which is totally what she said
I really like the look of Pyjamas, another poster mentioned it. I was planning on trying out Python soon anyway, and Pyjamas seems to be a very, very nice way to create portable apps that can be run normally as Python apps under Linux and Windows, or compile to JavaScript for running in browsers (as long as you use no C libraries). Very cool.
which is totally what she said
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 - a transformative technology. But just an object pipeline with language iterators and collections operators against localhost resources would be awesome.
--
make install -not war
I know it is. It's still linux running on JavaScript in a browser, even if it's not as efficient as it could be.
which is totally what she said
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. In fact I don't see any network operations exposed to that shell. Which is too bad, since it's running in a complete network browser - to say nothing of reaching the network OS the browser is running in. The busybox installed in this instance doesn't seem to have any network commands enabled.
--
make install -not war
(I guess when I wrote my original comment, I didn't know that though - but then I read TFA)
which is totally what she said
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.
--
make install -not war
No lspci
which dynamically compiles x86 code into Excel macros.
*duck*
Its a great way to run Linux in places where installing Linux is strictly forbidden.
http://michaelsmith.id.au
Like it claiming to have the f00f bug - has anyone verified that this virtual cpu has it and that Linux fix for it works properly?
Maybe you could make a movie about lazy zombies. That would be great.
...is actually 3.0.6. kernel.org is back up but it's not updating properly.
It depresses me that some people think running around with a ball, throwing it, and smashing into other people is in any way comparable to writing javascript that can run a linux kernel. Calling programming -anything- "whacking away at a keyboard at some random futility" vastly underestimates the knowledge required to do anything cool with programming. Yeah, I wrote a calculator when I first started programming. There were thousands of calculators out there that were better and more efficient than mine. However, whacking away at a keyboard at that random futility taught me what I needed to be able to move on to creating bigger and better things. I think it would be damn cool to be able to hit a web site and run linux when I'm stuck at work on a crappy windows computer. Get this to the point I have a fully functional bash shell and a package manager, and to where it can compile small programs, and I will use the crap out of it.
.. the (html5) local storage capacity limit in most browsers is 5MiB (to 10MiB).
Except that this provides practical future value, especially in a world where "web apps" seem to the the Next Big Thing. It may be cost-efficient to run some legacy client application in a browser using JavaScript virtual hardware to translate, e.g. serial port I/O, into some AJAX or similar request towards an equally-legacy (emulated?) mainframe.
This similarly would allow companies to squeeze additional blood from stones by offering old DOS games running in a JavaScript emulator using HTML5 Local Storage for save games, while keeping the main game executable, bit-for-bit, to that they shipped two or more decades ago on floppy disks (or CD-ROMs).
Rewriting said games for the modern web is not a port. That is a remake, unless you are using LLVM + Emscripten to port the original C/C++ to the web. And it has to be the original game code, not a brand new codebase from scratch. There are some games whose experience would actually be changed by a remake, due to subtle programmer errors in the original code, which for accuracy's sake, must be maintained.