Boot Linux In Your Browser
An anonymous reader writes "Fabrice Bellard, the initiator of the QEMU emulator, wrote a PC emulator in JavaScript. You can now boot Linux in your browser, provided it is recent enough (Firefox 4 and Google Chrome 11 are reported to work)."
That is rather cool, but I'd rather not upgrade FF to v4. Although, now I have a reason to install Chrome :)
...does it run BSD?
Why?
No cooler story is possible.
Very nice, but how much use is this?
Yo dawg, we hear you liked Linux and virtual machines so we wrote a virtual machine for the Java Virtual Machine so you can run Linux while you run Linux.
The preceding post was not a Slashvertisement.
Fabrice also wrote his own version of emacs in his own realtime C compiler, and he also at one time held the record for calculating pi.
sweet I just segfaulted it with emacs :)
This is very funny. A nice trick of which there may be some use. Suggestions?
http://www.xpurple.com
Would be nice to run a BBS from a DOS prompt attached to a PCI 56k Modem that interlinks to a USB MagicJack,
BECAUSE BILLY "FFUCKING" MAYSSS sayd it works!
Doesn't work for me. Just hangs.
.......... of Linux on the browser on the desktop.
da da da dum indeed.
I wonder how happy Apple would be about you running Linux on your iPhone browser.
Well, I'm off to tie up a few loose ends. It's only a matter of time before he gets X running in there. After that someone will try running firefox. Shortly after that someone will direct that copy of firefox to the link posted in the summary and then the universe will end.
There's no rcp, scp, or ftp. Aside from manually entering in code and compiling, how do you get anything INTO this machine to make it do anything useful? I see there's telnet but only a loopback interface... somebody, quick! Do something useful!
Either that, or the Higgs bogon will be discovered.
I was promised a flying car. Where is my flying car?
Just had a scary thought:
Linux running inside Internet Explorer on a Windows Vista system! *shudder*
rm -rf /
Build a man a fire and you warm him for a day. Set a man on fire and you warm him for the rest of his life.
- nt -
I got root! :)
Wait, crap.
Ooh, wait, I know....imagine a Beowulf cluster of nested linux-in-a-browsers.
<body background="natalie-portman-naked-and-petrified-covered-in-hot-grits.jpg">
The only surefire protection against Microsoft infections is abstinence. - The Onion
This has been done before with JSMIPS - a Javascript MIPS system with well-implemented JIT optimizations. :)
See http://codu.org/jsmips/system.html. Even runs vi pretty well
Finally I have the courage to do a /*
rm -rf
Free the Quark 3 from asymptotic confinement! Bring your charm! Don't get down! All colours and flavours welcome!
+1 Brilliant
A tech-demo to be sure for the moment, as qemu is far slower than native (about 5-10% in my experience) and this may be even slower. Still, it is impressive and there are some things you can do well even with a slow Linux.
Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
Yall know about this? Native client
Run native C code in browser, via some special compiler hacks to keep the code sandboxed.
Hmm...
The only answer that would not surprise me would be "a university/PhD grant."
Let's see what this baby has under the hood:
/proc/cpuinfo :
/proc/meminfo
/bin/sh /sbin/init
~ # cat
processor : 0
vendor_id : GenuineIntel
cpu family : 5
model : 4
model name : Pentium MMX
stepping : 3
cache size : 0 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : yes
coma_bug : no
fpu : no
fpu_exception : no
cpuid level : 1
wp : yes
flags
bogomips : 20.21
clflush size : 32
~ # cat
MemTotal: 30448 kB
MemFree: 26960 kB
Buffers: 2048 kB
Cached: 456 kB
SwapCached: 0 kB
Active: 2636 kB
Inactive: 64 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 8 kB
Writeback: 0 kB
AnonPages: 212 kB
Mapped: 324 kB
Slab: 700 kB
SReclaimable: 96 kB
SUnreclaim: 604 kB
PageTables: 36 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 15224 kB
Committed_AS: 456 kB
VmallocTotal: 1007592 kB
VmallocUsed: 0 kB
VmallocChunk: 1007592 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
Hugepagesize: 4096 kB
~ # top
Mem: 3472K used, 26976K free, 0K shrd, 2048K buff, 472K cached
CPU: 0.5% usr 0.3% sys 0.0% nic 87.2% idle 0.0% io 6.2% irq 5.5% sirq
Load average: 0.08 0.04 0.01 1/12 78
PID PPID USER STAT VSZ %MEM CPU %CPU COMMAND
78 75 root R 1136 3.7 0 12.7 top
75 1 root S 1156 3.8 0 0.0 sh
1 0 root S 1136 3.7 0 0.0
3 1 root SW< 0 0.0 0 0.0 [events/0]
4 1 root SW< 0 0.0 0 0.0 [khelper]
2 1 root SWN 0 0.0 0 0.0 [ksoftirqd/0]
5 1 root SW< 0 0.0 0 0.0 [kthread]
16 5 root SW< 0 0.0 0 0.0 [kblockd/0]
34 5 root SW< 0 0.0 0 0.0 [kswapd0]
35 5 root SW< 0 0.0
Well's all that ends.
works fine in my FF4 4.01, boots real quickly, compiles simple C..!! nice, sir! now a network stack would help much to get some code/extra sw into it.. pasting would not work.. regretfully.
I'm sure Windows 7 will get to the login screen this week.
Anons need not reply. Questions end with a question mark.
Many years ago we had a loaner machine that had to be returned to the vendor because after we'd tested it our director decided we should buy a machine with a more politically correct logo on the front of the box. We had to remove all our files anyway, after copying them to other machines, so "why not rm -rf /".
It ran ok for a while, though once "ls" and "df" were gone it was a bit harder to tell how it was doing. "echo *" still worked fine, and eventually there wasn't much left but enough directory to hold the shell and rm and a few /dev entries. Unfortunately, there was no easy way to save "dd" in the process, so I couldn't overwrite the disk as well.
Bill Stewart
New Fast-Compression-only CPR http://preview.tinyurl.com/dy575ks
It's been too long since I've tried running a browser in emacs, so I don't remember how (and therefore I'm not using it to reply to this Slashdot thread :-), but emacs itself seems to be running fine. Can Slashdot run in an emacs browser?
Bill Stewart
New Fast-Compression-only CPR http://preview.tinyurl.com/dy575ks
"ifconfig -a" only shows lo0, and /dev/ doesn't have a lot of networking hardware to work with, in particular it doesn't look like there's an ethernet driver, and I doubt you could easily coerce a /dev/tty driver to go anywhere. But it's still cool.
Bill Stewart
New Fast-Compression-only CPR http://preview.tinyurl.com/dy575ks
qemu supports emulating various guest CPUs. Would a simpler instruction set make for faster in-browser emulation?
20.21 bogomips in Chrome 11.0.696.68 on my Samsung N140 netbook running Fedora 15 Linux.
From TFA:
What's the use ?
I did it for fun, just because newer Javascript Engines are fast enough to do complicated things. Real use could be:
Of these, I suppose the benchmark is the really useful part. I suppose it'd make a nice fallback for Google's Native Client, which seems like a much better approach for using an x86 library if you need it -- and after all, if you have an x86 library, it's probably portable to x86_64, ppc, arm, etc. Old DOS games are probably better handled by DOSbox, though I guess it would be cool if someone got that to work.
It is cool as a tech demo, and as a benchmark, but I don't really see it being useful.
Don't thank God, thank a doctor!
...but because of ridiculousness.
Don't thank God, thank a doctor!
Get the "browser too old" message in Opera v11.10, unfortunately.
...no wonder the utilities all suck fucking balls and have bugs. As I sat around trying to figure out why less was chopping off 4-5 lines from the bottom of the screen, stty -a not reporting columns/rows, and $TERM defaulting to vt100 (uhh...). Yeah.
Busybox -- too busy to fix bugs.
No safari, no Opera, no IE9. All of those browsers are recent enough, but the script craps out rather than attempt to run. Poor form.
I run: Windows, OS X, Linux, FreeBSD. Just because you have a hammer, doesn't mean everything is a nail.
cat /dev/zero > /dev/mem
Admit it - who else tried startx!
Freeing unused kernel memory: 124k freed BUG: unable to handle kernel NULL pointer dereference at virtual address 0000000 0 printing eip: c01376a0 *pde = 00000000 Oops: 0002 [#1] invalid opcode: 0000 [#2] Recursive die() failure, output suppressed Chrome 12.0.742.16 dev. Works on FF4 however :)
Very cool... but anybody noticed that this is not FOSS? Javascript code is obfuscated. This way, it would be difficult to change the code. Without custom made javascript code, it will only support all browsers but IE :-).
This will become interesting when I can run webkit or gecko inside IE.
Imagine... no more lousy cross-browser headaches...
If Pandora's box is destined to be opened, *I* want to be the one to open it.
Ouch that's a factor of 200 below one of my processors (an Intel Xeon at 2.5GHz).
What this guy did is really cool. But it would be much more useful if we could run VirtualBox or VMWare inside the browser. Sure, that would require a completely different approach, but imagine the possibilities...
people have been able to run windows in a browser for a long time now, its about time Linux got this feature too...
http://www.deanliou.com/WinRG/
Politics is Treachery, Religion is Brainwashing
You can already run Linux and X in your browser. There's a project called JPC that is a Java based x86 PC emulator. http://jpc.sourceforge.net/home_home.html
They've recently been able to boot Windows XP.
When you think about it, most user land applications should be targetting a virtual machine. If Linux shipped with an LLVM runtime, all the userland apps could be built the once regardless of hardware and they would execute against the runtime. Behind the scenes the runtime would compile and cache a native binary on first invocation but it would be completely seamless and transparent to the user. Performance would be exactly the same as if the app had been natively compiled in the first place. The runtime could even be ported to Windows or OS X or QNX or some funky hypervisor from VMWare / Redhat whatever and be running over PPC, MIPS, ARM, x86 and they'd still run. The potential for this is enormous.
I get a feeling that Apple will soon have native LLVM support in OS X in preparation for their move to ARM and it would not surprise me if Windows got some kind of analog too. Therefore I wonder if it's time for Linux to be considering likewise.
I never used Linux before let alone the command line interface, so what's the first thing I typed? "penis"... because I can! After seeing the error message, I typed "it". "sh: it: not found" -- please tell me I'm not the only juvenile poster on this website.
This really broadened and expanded my horizon. While this was of course theoretically feasible ever since any touring complete scripting was available for web browsers, someone actually DOING it and letting the world play around with it marks a considerable paradigm shift to me, regarding how virtualization is viewed. ... or how computers are viewed.
Because to me, computers have now become nothing more than web pages, nothing more than windows that you open somewhere, and then THAT is a computer, and independent machine.
The machine is the content now.
I guess it's hard to convey the magnitude of the insight I just got from experiencing this near little java script hack... but it's way up there with my first contact with cloud & virtualization technology.
Didn't work for me. It got to a text thing with a flashing cursor but stopped there. I don't see my Ubuntu desktop or browser icon.
== Jez ==
Do you miss Firefox? Try Pale Moon.
This is infinitely cool! I would like to have an unobfuscated version of the JS source code. Any chance of releasing it? And I don't think the tag "pointless" applies here! I could be used to perform massive tests on the new versions of the kernel (of course nothing hardware-related!) and stuff like that. Really, this blows my mind.
However there is no virtual keyboard so can't use it - duhhhh.
Mayb relevant - I do have the Phony extension installed and the UI set to desktop Firefox.
Doesn't run on Chromium 13...
This thing booted on my Android phone running Firefox 4 Mobile.
Can't type anything though, as I can't get the virtual keyboard activated.
However I also got 20.21 bogomips, which seems odd.
aka Gardener, aka ollej
If we can just get Windows running in this emulator, they can cut a bulk license deal with Microsoft and finally have a way of delivering a working flash plugin on other platforms!
Have ya heard about the new Hot Pocket (tm) Hot Pocket (tm)? It's a Hot Pocket (tm) filled with a Hot Pocket (tm)? Tastes just like a Hot Pocket (tm)?
Who else immediately typed "rm -rf /" into it?
After years of not using a signature, I am going to make one to say the following: Fuck Beta
No man pages.
AT &F1DT0,T0800665544 - Real men, real help desk support.
I just couldn't see any other reason for you to make that post unless you are constantly reading Slashdot to find some reason, however vague, to post some xkcd promotion.
FYI it doesn't look like it works in Chrome 12 Dev. Everything seems fine, but bash never starts. Works fine in the Firefox 5 Aurora channel though.
Any one else noticed, that Fabrice included his C-Compiler TCC together with the distribution?
Using IPI Shortcut mode /* This C source can be compiled with:
Time: pit clocksource has been installed.
RAMDISK: ext2 filesystem found at block 0
RAMDISK: Loading 2048KiB [1 disk] into ram disk... done.
VFS: Mounted root (ext2 filesystem).
Freeing unused kernel memory: 124k freed
Welcome to JS/Linux
~ # cat hello.c
tcc -o hello hello.c
*/
#include
int main(int argc, char **argv) ./hello
{
printf("Hello World\n");
return 0;
}
~ # tcc hello.c -o hello
~ #
Hello World
~ #
Will this add more security problems? Does it easier to create powerfull malware in a browser?
If you die in any of it, you wake up in the outer most OS, unless you are trapped by the limbo exception handler, for which you are trapped forever.
1. Get millions of visitors to run your pop-up linux server
2. Sell access to your Cloud
3. Profit!
Anyone else rm -r -f / ?
Opera 11.10
I mean, too crap would be truthful. Too old is incorrect.
Can you imagine a Beowulf cluster of Chrome tabs?
Recursion jokes aside, I wonder how long it will be before we have fully-functioning ports of (say) java running in javascript. Because that'd be a hilarious way around Apple's language / appstore restriction on idevices.
it's just an animation. no real *nix is running there whatsoever.
Create a mounted loopback file system as ~/loopback.img, mounted to /mnt. Then copied hello.c to our mount point, unmounted it, and gzipped the image =D
# dd if=/dev/zero of=loopback.img bs=1000 count=400
400+0 records in
400+0 records out
400000 bytes (390.6KB) copied, 0.129992 seconds, 2.9MB/s
# mkfs.ext2 -F loopback.img
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
48 inodes, 390 blocks
19 blocks (5%) reserved for the super user
First data block=1
Maximum filesystem blocks=262144
1 block groups
8192 blocks per group, 8192 fragments per group
48 inodes per group
# mount -o loop loopback.img /mnt
# cp hello.c /mnt && ls -al /mnt ..
drwxr-xr-x 3 root root 1024 May 17 14:21 .
drwxr-xr-x 13 root root 1024 May 16 16:33
-rw-r--r-- 1 root root 166 May 17 14:21 hello.c
drwxr-xr-x 2 root root 12288 May 17 14:19 lost+found
# umount /mnt
# gzip loopback.img
# ls -lh
-rwxr-xr-x 1 root root 1.9K May 17 14:14 a.out
-rw-r--r-- 1 root root 166 May 15 22:15 hello.c
-rw-r--r-- 1 root root 905 May 17 14:23 loopback.img.gz
Launching the page in IE9 tells me my browser is too old. :-)
Works fine in Firefox 4, although at this time, I am not really sure what the advantage of running Linux in a webbrowser is, other than to say "I can do it".
I haven't looked at his javascript yet, but from what I can read from the technical notes it's an x86 intepreter. I'm actually working on a pc emulator in javascript, but with a dynamic translator at its core.
The project is hosted at github here: https://github.com/poizan42/jsx86
Hi from Emacs. It seems to work quite well, although a lot of scrolling is needed in order to get past the boilerplate that's normally at the top and sides of the screen. (I had to try multiple backends; the Lynx backend kept logging me out, but this w3m backend works fine.) One slight bizarreness; when I went to write this comment, it opened up an editor for me to write the comment in - and perhaps surprisingly, given that the browser was running in Emacs, it opened in vim. Still inside Emacs, though. I've long been aware that it's possible to run vim from inside Emacs, but I hadn't thought that either vim users or Emacs users would be particularly inclined to try...
(1)DOCOMEFROM!2~.2'~#1WHILE:1<-"'?.1$.2'~'"':1/.1$.2'~#0"$#65535'"$"'"'&.1$.2'~'#0$#65535'"$#0'~#32767$#1"
only vi...
got root
"I believe in Karma. That means I can do bad things to people all day long and I assume they deserve it." : Dogbert
But not the latest Safari.
It's too late to lose the weight you used to need to throw around.
I'm going to run Firefox inside Linux which is running inside Firefox. I'm going for Inception!!
Nice work, great way to advertise Google Chrome on Slashdot.
True because that would make you a zombie!!
Encryption: I may not agree with what you say, but I will defend your right to encrypt it...
Oh man, I have a strong desire to get apache running in this, just so I can have the web browser serving pages to itself =) We just need a network driver...
Well, make up your mind. Is it "far" slower, or only 5-10%? Because if it's only 5-10% I can fix that by buying a computer 3 months later or buying it now but spending an extra $40 on the CPU.
now where is network support, ssh, nmap and other tools that could make this actually useful to the roaming sysadmin?
frog blast the vent core
This is the year for Linux in the browser...
... a beowulf cluster of tabs!
/.
Or is that joke a little too 20th century these days? Been out of touch with
This would be amazing if if had an eth0 interface with an SSH client.
That would mean that you could SSH to any of your servers from within Safari on an iPhone with no need for paid-for apps.
http://bellard.org/jslinux/config_linux-2.6.20
Given that "ifconfig" only shows a loopback interface, it would be helpful if you explained how you got Internet connectivity working in that thing.
You better believe it.
http://bellard.org/jslinux/cpux86.js calls ya.load_binary() that makes XMLHttpRequest()s for "vmlinux26.bin", "root.bin", and "linuxstart.bin". For the latter two his HTTP server responds with root.bin.en.gz and linuxstart.bin.en.gz. After gunzip you can mount root.bin.en as a loopback ext2 filesystem to see the ramdisk FS contents; most binaries are hardlinks to the same 768kB BusyBox ELF 386 binary. I'm not sure what the 14,858 byte linuxstart.bin file is.
=S
press f5 to reboot
Best thing ever! Mind-blowing.
Although he's using JavaScript typed arrays (U?Int{8,16,32}Array), the JavaScript isn't using other recent language features like let and const. "Just" tons of switch statements and bitwise operations (and the mind of a brilliant hacker). That it runs so fast demonstrates how fantastic V8 and JaegerMonkey are at optimizing JavaScript.
=S
What about running a remote VM from your browser based on a PHP or Perl app? Then it wouldn't be limited by client abilities, only the connection speed required to return results. As long as you had a fairly simple output (plain text in an iframe with some basic javascript RPC) it should be responsive enough with a broadband connection. Not good for running X obviously, but more processor-hungry apps might benefit.
I don't see much benefit in running anything on Linux using client resources anyway (it will always be slower than the client), but being able to better harness a more powerful server in a datacenter (usually decent spec blades) for computationally-intesive tasks (finite element, medical image processing, etc) would be useful.
Perhaps someone could try a virtualized Linux/Apache box with a PHP-driven psuedo-shell exposed to the outside, driving some basic shell tools like nano, gcc, etc. There would be plenty of people who would be more than happy to screw it up so maybe put a password on it or something.
Then you could have limited access to a true dinks native i386 Linux machine from your iPad without ssh software and overhead.
Might have a go myself at home. I'm a "gunna-do" though so don't hold your breath.
sh: getcwd: No such file or directory /sbin/init: line 21: /bin/true: not found
(unknown) # exit
Kernel panic - not syncing: Attempted to kill init!
this is legendary high geekery. *slow clap*
Oh, I wasn't running inside that thing, I was working from my own computer. I thought it was a question about Emacs generally, not about the browser simulator in question. Sorry if there was a misunderstanding.
(1)DOCOMEFROM!2~.2'~#1WHILE:1<-"'?.1$.2'~'"':1/.1$.2'~#0"$#65535'"$"'"'&.1$.2'~'#0$#65535'"$#0'~#32767$#1"
I was in fact asking in the context of the browser simulator (since it does have emacs), but it's interesting to know that a text-based browser can still read Slashdot given the excessive amount of Javascript that's gotten into everything the last few years.
Bill Stewart
New Fast-Compression-only CPR http://preview.tinyurl.com/dy575ks
This is almost as interesting as the OS written in Postscript and said to be able to run on HP printers.