Code Monkey home page Code Monkey logo

hyperos's Introduction

HyperOS

A 50MB linux distribution that has dat-container, a utility that can live boot containers using dat and systemd-nspawn remotely over the secure p2p encrypted dat network.

The goal of HyperOS is to provide the most minimal possible linux host environment that can be used to remote mount dat containers. It is intended to be run on Mac OS and/or Windows as a minimal host Linux. The idea is you only have to download a 50MB OS, boot it, and then you can use dat-container to boot your actual container (e.g. an Ubuntu based 1GB or more container) much more efficiently, as dat-container supports "live-boot".

You can install it easily using the npm install linux -g module on npm.

build it

Download Buildroot on a linux machine. Rename buildroot-config to buildroot/.config and rename linux-config to whatever file make linux-menuconfig edits (Should be something like buildroot/output/build/linux-*/.config).

The linux config enables virtio-net drivers in the linux kernel, which are disabled in Buildroot by default. You can also use make menuconfig to modify packages etc that are installed in the root filesystem. Currently systemd is the main requirement so that we can use systemd-nspawn. We also include openssh, fuse and a couple other utilities needed by dat-container.

Then place those two files in this repository and run the build script ./build.sh. Then you can copy the resulting initrd.gz into maxogden/linux to boot it.

how it works

When building the container, the rootfs.cpio is extracted to a temporary folder called dist/. The include/ folder in this directory is merged on top of the HyperOS filesystem. Currently the only thing we do with this is set the motd and install a startup service called set-ssh-auth-key. When booting the container, you can pass in a SSH public key and a hostname as the kernel CMDLINE, which becomes available in linux after boot as /proc/cmdline. The set-ssh-auth-key service parses this file and sets the container hostname and installs the SSH key in /root/.ssh/authorize_keys.

The container should attempt to acquire a DHCP lease on boot, so to know when the container is fully booted and online you can (on Mac OS) watch /etc/dhcpd_leases for the IP address that matches the hostname you passed into the container. You can then use this IP to ssh into the container. This functionality is implemented in the npm install linux -g module.

hyperos's People

Contributors

max-mapper avatar yoshuawuyts avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hyperos's Issues

have hypercore inherit host OS DNS

today on a university network that blocked ports etc, I ran into an issue where having /etc/resolv.conf configured with nameserver 192.168.64.1 worked, but nameserver 8.8.8.8 (google DNS) did not work

on other networks i've experienced the opposite being true -- google DNS fixes dns resolution, but using 192.168.64.1 didn't work

It would be nice to solve this for 100% of cases. I'm not an expert in this area, suggestions appreciated

build custom kernel (to get >= 3.18)

tinycore x86_64 supports kernel 3.16 by default and doesnt provide newer prebuilt kernels at the moment. to get overlayfs we need 3.18 or newer

overlayfs is just an optimization so this isn't blocking anything, it would just be a nice-to-have

run chroot as non-root

some chroot implementations have a --userspec arg to specify the user the chroot should run as. but it doesn't look like the busybox chroot does:

chroot: can't execute '--userspec=admin:admin': No such file or directory

perhaps we can create an admin user, give it chroot privs, then run chroot as that user. or maybe we can chroot as root then immediately drop privileges somehow

Problem: `linux status` throws error if not booted once

Steps to reproduce:

npm install linux -g
linux init
linux status

Then I get this error:

/usr/local/lib/node_modules/linux/cli.js:232
      if (err) throw err
               ^

Error: ENOENT: no such file or directory, open '/Users/johndoe/some_project/linux/linux.pid'

Once I actually boot the VM for the first time it's fine:

$ sudo linux boot
Linux has booted { ip: '192.168.64.137',
  hostname: 'joe-pony-man-bearpig',
  pid: 1337 }
$ linux status
Linux is running { pid: 1337 }

[research] composable package management for containers

problem: how to combine two container filesystems without conflicts, so you can use them as dependencies. docker compose goes for independent filesystems with shared services, but i am interested here in exploring package management solutions that avoid global state conflicts

research:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.