Giter Site home page Giter Site logo

openwrt-lxd's Introduction

These scripts create LXD images for OpenWRT.
Naturally, you can run them inside an LXD container.  I use a privileged Ubuntu 16.04 container, so I can run things like mknod (it is not needed yet).

Run as follows:
sudo ./build.sh <version>

There are three versions:  snapshot, chaos_calmer, barrier_breaker.
Only chaos_calmer and snapshot are usable, so far.

Ths script downloads rootfs tar.gz from openwrt.org, modifies it slightly, and generates LXD metadata.

rootfs tarballs are downloaded in ./cache, if they are not already there.
If you want to get fresh ones, delete the old ones first.

The resulting images are generated in ./target/<version>/image

The openwrt container should be privileged:
lxc launch openwrt -c security.privileged=true <name>

snapshot (designated_driver) and chaos_calmer boot partially.  They become usable after running the script /root/init.sh.  You can exec init.sh using lxd exec, either directly, or through an interactive shell:

lxc exec <container> /root/init.sh

or:

lxc exec <container> ash
sh init.sh


init.sh uses mknod to create a few missing devices in /dev.  The container should be privileged in order to be able to run mknod.

I haven't been able to make init.sh run automatically from inside the container.

To stop the container, run "halt" in it.  It does not seem to stop from the LXD tools.

If you try to run "halt" or "reboot" before completing the boot process, it won't work.  In order to get rid of such an unusable container, delete its rootfs from the host (/var/lib/lxd/containers/<container>/rootfs).  You will then be able to delete the container after a host reboot.

This build script modifies the network configuration so that the container gets its ip address from dhcp.  It also removes the wan interface.  You can experiment with other network configurations.

If you use the original network configuration, which includes a DHCP server, other containers may start getting their ip addresses from the OpenWRT container (which may be useful, if you disable the LXD DHCP server).

The resulting container seems functional.
You can access the Luci Web Interface.
If you try to login to it with ssh, you get an error:

  PTY allocation request failed on channel 0
  shell request failed on channel 0

But you can use scp, rsync, and run non-interactive commands with ssh.

barrier_breaker does not boot properly.  init.sh does not fix it.  This script does not modify rootfs in this case.  It just adds metadata.

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.