Lightweight operating system using Node.js as userspace

Overview

Build Status Stories in Ready Join the chat at https://gitter.im/NodeOS/NodeOS MIT Licence

NodeOS

Greenkeeper badge

Lightweight operating system using Node.js as userspace.

NodeOS is an operating system built entirely in Javascript and managed by npm. Any package in npm is a NodeOS package, that means a selection of more than 400.000 packages. The goal of NodeOS is to provide just enough to let npm provide the rest. Since anyone can contribute to it, anyone can create NodeOS packages.

This project won the Spanish 9th National Free Software Championship on the Systems category and was Honorable Mention of its 10th edition. It was also presented as the degree thesis of Jesús Leganes Combarro with a qualification of 10/10 with distinction.

Useful links

Join the Discussion

Introduction

NodeOS is a Node.js based operating system, built-off of the Linux kernel. The NodeOS Project is aiming to, and can already run on some of the following platforms:

  • real hardware like desktops, laptops, or SoC's (Raspberry Pi)
  • cloud providers like Joyent, Amazon or Rackspace
  • virtual machines like QEmu, VirtualBox, VMWare and KVM
  • PaaS providers like Heroku or Joyent's Manta
  • container providers like Docker & Vagga

Core development is being done in layers. There could be some differences to adjust better to each target platform, but the general structure is:

  • barebones custom Linux kernel with an initramfs that boots to a Node.js REPL
  • initramfs Initram environment to mount the users partition & boot the system
  • usersfs multi-user environment with the same behaviour of traditional OSes

Booting process

All the layers are bootable, leading barebones to a raw naked Node.js REPL prompt as PID 1, while initramfs exec actual NodeOS code to isolate user code from the core system and, if available, mount a partition with the users' home directories and root filesystems.

If a usersfs partition is being set at boot time, it will be mounted and the system will consider each one of its folders as the home folder for a valid user on the system, and will execute a init file in the root of each of them. If found, the root user will be the first to be considered and will have access to all of the home directories, but by design it will not be possible to elevate permissions once the system has finished booting.

Hacking

If you are hacking on NodeOS for a somewhat production environment, you are likely interested on building a custom usersfs image or modify it once booted, since each user is isolated from the others and everyone can be able to define its own root filesystem, but you can customize all other layers if you want. For example, you can modify initramfs to login users and mount their home folders from a cloud service or craft a system without global services (no root user), or also dedicate a full NodeOS instance to a single Node.js application.

Pre-built Images

Ready to use pre-build images are automatically generated after each commit in master branch that sucessfully pass the tests. To exec them, you'll need to have QEmu installed on your system.

The iso can be written to a CD-R or flashed to a USB pendrive, but will only provide the read-only rootfs and the changes will be done in memory, losing them after reboot, so you'll manually need to set a read-write usersfs partition if you want to persist them. On the other hand, if you want to flash it to a USB pendrive, We recommended doing it by using bin/installUSB command so it will automatically create a read-write usersfs partition to fill the remaining space and use it as persistent storage.

Build NodeOS in five steps

  1. Download the project source code:

    git clone [email protected]:NodeOS/NodeOS.git
    cd NodeOS
  2. Install the required build tools. On a Ubuntu based system you can do it by executing:

    sudo bin/install-dependencies
  3. Install NodeOS build dependencies:

    npm install
  4. Build NodeOS:

    npm run build

    By default it will generate some files that can be used with QEmu, compiled for your current machine architecture. You can configure the build process by passing some environment variables. For example, to force to build for 32 bits, use BITS=32 npm install instead.

  5. Exec your freshly compiled NodeOS image:

    npm start

    It will automatically detect what CPU architecture will need to be used on QEmu and exec the correct emulation.

...profit! :-D

If you encounter an error when building NodeOS, take a look at the wiki or open an issue.

Single Process OS

NodeOS can be used as a Single Process OS, where only run a single executable. To do so, set the SINGLE_USER environment variable to the name of a npm module when executing npm run build. This will run fully from initram, persistence can be achieved by setting this environment variable to an empty string and later using a custom usersfs partition, but this is still experimental.

NodeOS on LXC containers (Docker and vagga)

NodeOS fully officially supports Docker, published images are available at the DockerHub NodeOS organization. If you are interested in helping or testing, you can build them from source code.

Vagga support is fairly experimental, and help here will be greatly appreciated.

Quick Start

  1. Install Docker

  2. One Liner

    sudo docker run -t -i nodeos/nodeos

Build from Source

git clone https://github.com/NodeOS/NodeOS.git
cd NodeOS
PLATFORM=docker npm install

License

MIT

This software consists of voluntary contributions made by many individuals. For exact contribution history, see the revision history available at https://github.com/NodeOS/NodeOS

Comments
  • Refresh the Website!

    Refresh the Website!

    Hi! Are you a front-end web developer? Now is your chance for you and your buddies to contribute to NodeOS (without having to decipher underlying technology in the build process; double win!)

    We're redesigning our website and would love to have the talent's of all the developers combined! The first step, of course, would be to design a new page so let's use this thread and create a new idea. You may propose:

    • Theme idea's
    • Template ideas (you can sketch, or paste screenshots)
    • Web frameworks (like bootstrap) that we should (or shouldn't) use, and why

    Looking forward to getting this going with you all! Tell all your friends!

    blog level: easy - first bug long task / multiple volunteers 
    opened by mitsukaki 124
  • Need a Desktop?

    Need a Desktop?

    Hello, I stumbled across your project. From the looks of it you guys need a Desktop? Well I'm helping out with one it's called OS.js and runs on node.js. (I'm not the creator but one of the contributors.).

    Here the website: http://os.js.org/ Here is the demo: http://osjsv2.0o.no/ Here is the source: https://github.com/andersevenrud/OS.js-v2

    It's still in Beta, were still having some trouble with getting help but were moving along quite well.

    opened by junland 94
  • Cross compiler musl

    Cross compiler musl

    This is a work-in-progress pull-request just so we can comment on it.

    Finally I've managed to create a cross-toolchain and use it to compile a runnable NodeOS instance (i386-glibc -> i686-musl, I need to test x86_64 -> i386). After some tries, I got it to work using as basis Cross Linux From Scratch - Embedded, that uses musl as C lib instead of standard glibc. I wanted to use a glibc based system, but this is the only one I've managed to make it to work, since using the plain Linux From Scratch or also the standard Compressed Linux From Scratch (both based on glibc) was fairly overcomplicated and gave a lot of compilation problems.

    This has some drawbacks that needs improvement (or not :-) ):

    • it's a musl based system, so compiled modules that use non-standard extensions of GNU glibc will not compile. It's a fail of the developers, so this could help to improve their code to be C standard compliant (win-win for all :-) ).
    • OpenSSL doesn't work well with musl (due to the use of that non-standard extensions...) and needs to be patched since nobody fix it :-( Luckily it's an easy one...
    • GCC is not aware of musl so it needs to be patched, too. This leads us to use a fixed GCC version, but since it's somewhat new (April 2014) and probably we'll move to llvm when Linux could be compiled with it so we can use one of the llvm Javascript flavours on the userspace, then it's a fair trade by this moment.
    • I was not be able to use a dynamically linked Node.js executable, so I'm using a fully-statically linked one. This should be fixed in the future for loading of compiled modules and specially to exec binaries, but if we don't allow binaries at all and since now require() of modules works because musl now include the required dl_ functions (at least native ones does while it was not working before, I need to test external ones), this could help to enforce a pure-Javascript environment :-) On the other hand, this also has the advantage that the memory foot-print is smaller since now the only required files on the initramfs are the console device and the Node.js executable (impossible to make it simpler!!! :-D )

    It's still unstable and needs some more work and testing (please test it! :-D ), but when it's finished, NodeOS build system will be self-contained and will be easier to port it to other platforms just by updating the cross-compiler :-) Also I've been developing it as a NPM package, so when it's ready in the future we could be able to move it to be an independent project (I would love to see NodeOS self-hosted... :-D ).

    opened by piranna 88
  • Error when running `vagga run` on RC

    Error when running `vagga run` on RC

    Hi all!

    Great work so far. I'm trying to run NodeOS using vagga within vagrant (because I'm on OSX). I downloaded both vagga RCs:

    x86_64-vagga & i386-vagga

    and after running vagga run I get:

    thread '<main>' panicked at 'assertion failed: iter.next() == Some(RootDir)', src/path_util.rs:18

    It's very possible that I'm doing something wrong. Any have any idea?

    Thanks!

    opened by TylerLeonhardt 70
  • I like the idea!

    I like the idea!

    I really like the idea of this, it would make the OS less prone to errors and would make security a lot easier - there will be only the NPM packages as suspects. And updates will be a breeze for anyone.

    Though i must admin i first thought it was a complete desktop experience ;-)

    opened by tmikaeld 57
  • nodeos-init musl command not found

    nodeos-init musl command not found

    I've got that error with Arch Linux

    Compiling init
    make: x86_64-nodeos-linux-musl-gcc: Kommando nicht gefunden
    <eingebaut>: die Regel für Ziel „init.o“ scheiterte
    make: *** [init.o] Fehler 127
    rmdir: konnte '/home/philipp/Dokumente/github/NodeOS/node_modules/nodeos-barebones/build/nocona' nicht entfernen: Datei oder Verzeichnis nicht gefunden
    
    opened by luii 55
  • B2G OS needs your help !

    B2G OS needs your help !

    Hello! I'm from B2G OS Communications. As you all know Mozilla handed over smart phone code development to it's community. Since then, we are working hard to make the project come live again. In this process, we don't have people to handle gecko. B2G OS relies on standard web APIs. I recently came across this project & it's cool & you are also targeting SoC's like raspberry pi !. Can you please help our project from gecko side.

    All our project discussions happen here: https://discourse.mozilla-community.org/c/b2g-os-participation

    Thank you

    discussion 
    opened by kskarthik 54
  • Init scripts

    Init scripts

    Does NodeOS already have a utility to launch applications that need to begin on start up? If there is one, does it have an interface for apps to add or remove themselves from this list? I'm thinking of people who run servers for testing (like redis) or for GUI users, messengers and such.

    opened by mitsukaki 49
  • ES6 features in NodeOS

    ES6 features in NodeOS

    Hey, i want to know if we can use es6 features like template strings and such things because nodejs.org (https://nodejs.org/en/docs/es6/) and kangax (https://kangax.github.io/compat-table/es6/#node4) shows that in node 4.4.3 we can use them.

    And if we can make use of them, should we use it in strict mode?

    opened by luii 34
  • Rename 'NodeOS' to 'nodeos' and set absolute path

    Rename 'NodeOS' to 'nodeos' and set absolute path

    Like in the other file (dockerBuild) we need to change the name to lowercase. And after this docker complains about absolute paths for this i put a slash infront of the userfs variable.

    After this i get this error we already discussed #227:

    λ philipp [~/Dokumente/NodeOS] at  master !?
    → npm run docker                                                                                          [e16936d]
    
    > [email protected] docker /home/philipp/Dokumente/NodeOS
    > scripts/docker
    
    mount procfs: Operation not permitted
    mount devtmpfs: Operation not permitted
    fs.js:1048
      return binding.symlink(preprocessSymlinkDestination(target, type, path),
                     ^
    
    Error: EEXIST: file already exists, symlink '/proc/mounts' -> '/etc/mtab'
        at Error (native)
        at Object.fs.symlinkSync (fs.js:1048:18)
        at /lib/node_modules/nodeos-mount-filesystems/server.js:381:6
        at /lib/node_modules/nodeos-mount-filesystems/node_modules/mkdirp/index.js:48:26
        at FSReqWrap.oncomplete (fs.js:117:15)
    /proc/sched_debug: Operation not permitted
    /proc/timer_stats: Operation not permitted
    /proc/kcore: Operation not permitted
    /proc/sysrq-trigger: Operation not permitted
    /proc/sys: Operation not permitted
    /proc/irq: Operation not permitted
    /proc/fs: Operation not permitted
    /proc/bus: Operation not permitted
    /proc/asound: Operation not permitted
    /dev/console: Operation not permitted
    /dev/shm: Operation not permitted
    /etc/hosts: Operation not permitted
    /etc/hostname: Operation not permitted
    /etc/resolv.conf: Operation not permitted
    /dev/sda: Operation not permitted
    /dev/mqueue: Operation not permitted
    /sys/fs/cgroup/blkio: Operation not permitted
    /sys/fs/cgroup/cpuset: Operation not permitted
    /sys/fs/cgroup/pids: Operation not permitted
    /sys/fs/cgroup/freezer: Operation not permitted
    /sys/fs/cgroup/devices: Operation not permitted
    /sys/fs/cgroup/memory: Operation not permitted
    /sys/fs/cgroup/net_cls: Operation not permitted
    /sys/fs/cgroup/cpu,cpuacct: Operation not permitted
    /sys/fs/cgroup/systemd: Operation not permitted
    /sys/fs/cgroup: Operation not permitted
    /sys: Operation not permitted
    /dev/pts: Operation not permitted
    /dev: Operation not permitted
    /proc: Operation not permitted
    /: Operation not permitted
    termination: Operation not permitted
    
    npm ERR! Linux 4.6.2-1-ARCH
    npm ERR! argv "/home/philipp/.nvm/versions/node/v5.12.0/bin/node" "/home/philipp/.nvm/versions/node/v5.12.0/bin/npm" "run" "docker"
    npm ERR! node v5.12.0
    npm ERR! npm  v3.8.6
    npm ERR! code ELIFECYCLE
    npm ERR! [email protected] docker: `scripts/docker`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the [email protected] docker script 'scripts/docker'.
    npm ERR! Make sure you have the latest version of node.js and npm installed.
    npm ERR! If you do, this is most likely a problem with the NodeOS package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR!     scripts/docker
    npm ERR! You can get information on how to open an issue for this project with:
    npm ERR!     npm bugs NodeOS
    npm ERR! Or if that isn't available, you can get their info via:
    npm ERR!     npm owner ls NodeOS
    npm ERR! There is likely additional logging output above.
    
    npm ERR! Please include the following file with any support request:
    npm ERR!     /home/philipp/Dokumente/NodeOS/npm-debug.log
    
    needs-maintainer 
    opened by luii 32
  • Change boot logo

    Change boot logo

    Framebuffer currently use the vanilla Tux logo on boot, we can cnange it to show NodeOS logo. Also, just today has been submitted a patch to Linux kernel to allow full-screen logos, that would be cool... :-)

    level: medium 
    opened by piranna 32
  • Docker error at start

    Docker error at start

    whk@machine:~$ lsb_release -a
    No LSB modules are available.
    Distributor ID:	Ubuntu
    Description:	Ubuntu 20.04.4 LTS
    Release:	20.04
    Codename:	focal
    whk@machine:~$ sudo docker run -t -i nodeos/nodeos
    [sudo] contraseña para whk: 
    Unable to find image 'nodeos/nodeos:latest' locally
    latest: Pulling from nodeos/nodeos
    94a50c750e92: Pull complete 
    cc815e2e56f5: Pull complete 
    b59c556bab11: Pull complete 
    Digest: sha256:be4ab273faeb9dd296a3dd161d1a16faa7e9a1f15c948649070c4f4818bc708f
    Status: Downloaded newer image for nodeos/nodeos:latest
    mount procfs: Operation not permitted
    mount devtmpfs: Operation not permitted
    Trace: { Error: EPERM, Operation not permitted 'overlay'
        at Error (native) errno: 1, code: 'EPERM', path: 'overlay', syscall: 'mount' }
        at onerror (/lib/node_modules/nodeos-boot-multiUser/server.js:23:11)
        at /lib/node_modules/nodeos-boot-multiUser/server.js:46:26
        at /lib/node_modules/nodeos-boot-multiUser/lib/index.js:97:24
        at /lib/node_modules/nodeos-boot-multiUser/lib/jocker_root.js:198:24
    Starting REPL session
    NodeOS-boot-multiuser>
    
    opened by yhojann-cl 3
  •  NodeOS windowing (GUI) kit

    NodeOS windowing (GUI) kit

    I have a plan + idea for starting a NodeOS windowing (GUI) kit, which being all js+html+css. I'd like to know how nodejs, when booted, how can it launch is UI process.

    opened by Nashorn 9
  • Misleading description

    Misleading description

    NodeOS is an operating system built entirely in Javascript.

    Pardon me if I'm wrong but after browsing through the repository source's I just can not find anything in that regards.

    The codebase is way too smal for this to be an operating system built in Javascript. Where's the kernel source in js? Where are the drivers in js? There's nothing?

    The first operating system powered by node.js and npm.

    This isn't really accurate either isn't it?

    As far as I can tell this is a linux distribution that comes shipped with node.js/npm that with a sort of set-up node environment that boots into a node.js REPL.

    This is FAR from being an operating system, let alone one built in JavaScript and let alone one that is powered by node.js/npm. It's a linux distribution, right?

    opened by FMNSSun 3
  • start script file has error.

    start script file has error.

    This is the default start script file provided by NodeOS:

    #!/usr/bin/env node
    
    /**
     * NodeOS
     *
     * @copyright 2013-2017 Jacob Groundwater, Jesús Leganés-Combarro 'piranna'
     *  and other contributors
     *
     * @license MIT
     */
    
    const spawn = require('child_process').spawn;
    
    const prepareCommandLine = require('..')
    
    
    const {command, argv, cwd} = prepareCommandLine(process.argv.slice(2))
    
    
    // Exec NodeOS
    spawn(command, argv, {stdio: 'inherit', cwd})
    .on('error', console.trace.bind(console))
    .on('exit', function(code, signal)
    {
      process.exit(code || signal)
    })
    

    And when I run "npm start" in Ubuntu WSL it displays this error:

    const {command, argv, cwd} = prepareCommandLine(process.argv.slice(2))
                                 ^
    
    TypeError: prepareCommandLine is not a function
    

    I have also tried "bash npm start", but it just displays this error:

    /home/stanlyhalo/.nvm/versions/node/v12.18.0/bin/npm: npm: line 2: syntax error near unexpected token `;'
    /home/stanlyhalo/.nvm/versions/node/v12.18.0/bin/npm: npm: line 2: `;(function () { // wrapper in case we're in module_context mode'
    

    What I'm trying to do in the end is run NodeOS in qemu.

    opened by Stanlyhalo 1
Releases(v1.0.0-RC3.2017-06-12)
Owner
NodeOS
Linux + Node.js + NPM = awesomess
NodeOS
A JavaScript PDF generation library for Node and the browser

PDFKit A JavaScript PDF generation library for Node and the browser. Description PDFKit is a PDF document generation library for Node and the browser

null 8.5k Jan 2, 2023
A pure JavaScript implementation of git for node and browsers!

isomorphic-git isomorphic-git is a pure JavaScript reimplementation of git that works in both Node.js and browser JavaScript environments. It can read

isomorphic-git 6.7k Jan 4, 2023
Streaming torrent client for node.js

peerflix Streaming torrent client for Node.js npm install -g peerflix Usage Peerflix can be used with a magnet link or a torrent file. To stream a vi

Mathias Buus 6k Dec 29, 2022
A javascript Bitcoin library for node.js and browsers.

BitcoinJS (bitcoinjs-lib) A javascript Bitcoin library for node.js and browsers. Written in TypeScript, but committing the JS files to verify. Release

bitcoinjs 4.8k Jan 1, 2023
Node module for creating dat compatible tools on file systems

dat-node dat-node is a high-level module for building Dat applications on the file system. For a lower-level API for building your own applications, u

Dat Project 507 Nov 18, 2022
Mad science p2p pipe across the web using webrtc that uses your Github private/public key for authentication and a signalhub for discovery

webcat Mad science p2p pipe across the web using webrtc that uses your Github private/public key for authentication and a signalhub for discovery We a

Mathias Buus 428 Dec 30, 2022
Using Obsidian.... For Business!

Obsidian For Business A combination of a template vault with initial structure and some Microsoft Office VBA Macros to facilitate a powerful, extensib

Bryan Jenks 93 Dec 27, 2022
The open source Community Operating System, built with developers in mind.

IMPORTANT: This project is still under active development. Be aware that future releases can lead to breaking changes. The open source Community OS, b

crowd.dev 383 Dec 29, 2022
The Frontend of Escobar's Inventory Management System, Employee Management System, Ordering System, and Income & Expense System

Usage Create an App # with npx $ npx create-nextron-app my-app --example with-javascript # with yarn $ yarn create nextron-app my-app --example with-

Viver Bungag 4 Jan 2, 2023
Remote Keyboard Tutoring System is a web-based system that can be attached to any keyboard synthesizer through a MIDI connector.

The Remote Keyboard Tutoring System is a web-based system that can be attached to any (electronic) keyboard synthesizer through a MIDI connector. Once our system is connected to the keyboard, the user can interactively learn, play or teach in combination with the web application that we provide.

Department of Computer Engineering, University of Peradeniya 3 Nov 15, 2022
Denail of service system for the Dentistimo system. Used to improve the tolerance and testing fail safe functionality.

Distributed Systems - Dos Testing DoS (Denail of Service) System for Testing and Practical demonstration of systems capability to handle a basic DDoS

null 28 Nov 8, 2022
🐬 A simplified implementation of TypeScript's type system written in TypeScript's type system

?? HypeScript Introduction This is a simplified implementation of TypeScript's type system that's written in TypeScript's type annotations. This means

Ronen Amiel 1.8k Dec 20, 2022
Lightweight JavaScript module system.

modulejs Lightweight JavaScript module system. License The MIT License (MIT) Copyright (c) 2020 Lars Jung (https://larsjung.de) Permission is hereby g

Lars Jung 124 Dec 21, 2022
⚡ A blazing fast, lightweight, and open source comment system for your static website, blogs powered by Supabase

SupaComments ⚡ A blazing fast, lightweight, and open source comment system for your static website, blogs ?? Demo You can visit the Below demo blog po

MC Naveen 112 Dec 27, 2022
tb-grid is a super simple and lightweight 12 column responsive grid system utilizing css grid.

tb-grid Lightweight (<1kb gzipped) 12 column grid system, built with css grid. ?? Demos & Playground Have a look at those examples: Main Demo: https:/

Taskbase 26 Dec 28, 2022
This is a simple ticket system bot using discord.js v13 and node.js v17. It works with buttons and slashcommands.

Ticket-bot This is an simple ticket system bot using discord.js v13. If you find an error or need support, go to my discord server and open a ticket >

Cristhian 14 Jan 2, 2023
This is a simple file uploading system made up using node & express

FileUploader A simple file-upload application made using Node.js and Express. Local Setup Install the Dependencies Using npm npm install Usage Starti

Kallyan Singha 21 Nov 2, 2022
EggyJS is a Javascript micro Library for simple, lightweight toast popups focused on being dependency-less, lightweight, quick and efficient.

EggyJS EggyJS is a Javascript micro Library for simple, lightweight toast popups. The goal of this library was to create something that meets the foll

Sam 10 Jan 8, 2023