Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| lxc_openwrt_host [2021/09/19 09:03] – [Create a LXC container] wording darksky2 | lxc_openwrt_host [2021/09/22 08:05] – [Setup on the OpenWRT host] darksky2 | ||
|---|---|---|---|
| Line 15: | Line 15: | ||
| This example was using OpenWRT ARM64 MVEBU ESPRESSOBIN et ESPRESSOBIN ULTRA. | This example was using OpenWRT ARM64 MVEBU ESPRESSOBIN et ESPRESSOBIN ULTRA. | ||
| + | [[https:// | ||
| ==== Setup on the OpenWRT host ==== | ==== Setup on the OpenWRT host ==== | ||
| Install some necessary tools and prerequisites: | Install some necessary tools and prerequisites: | ||
| Line 22: | Line 23: | ||
| < | < | ||
| - | Install the lxc packages | + | Install the core lxc packages: |
| - | < | + | < |
| - | Check the kernel config to see if anything required is missing: | + | FIXME: Note that getopt should be a package dependency, see: [[https:// |
| - | < | + | |
| + | Additional packages exist that can add functionality but that aren't strictly required. | ||
| + | < | ||
| + | |||
| + | FIXME: Note that until [[https:// | ||
| + | |||
| + | Edit ''/ | ||
| + | < | ||
| + | |||
| + | Optionally check the kernel config to see if anything required is missing: | ||
| + | < | ||
| + | # lxc-checkconfig | ||
| LXC version 4.0.5 | LXC version 4.0.5 | ||
| --- Namespaces --- | --- Namespaces --- | ||
| Line 87: | Line 99: | ||
| Note : Before booting a new kernel, you can check its configuration | Note : Before booting a new kernel, you can check its configuration | ||
| usage : CONFIG=/ | usage : CONFIG=/ | ||
| + | |||
| + | In order to download distro images for the guest, we need to either: | ||
| + | - Use a keyserver on the host which requires additional setup, or | ||
| + | - Disable validation (not recommended) | ||
| + | |||
| + | To verify signature of the images, we need to install some additional packages which can be remove after the guest is setup: | ||
| + | < | ||
| + | |||
| + | Alternatively, | ||
| + | |||
| + | Example: | ||
| + | < | ||
| ==== Create a LXC container ==== | ==== Create a LXC container ==== | ||
| Line 99: | Line 123: | ||
| lxc-create: myLMS: lxccontainer.c: | lxc-create: myLMS: lxccontainer.c: | ||
| lxc-create: myLMS: tools/ | lxc-create: myLMS: tools/ | ||
| - | ==== Fix the Unable to fetch GPG key from keyserver ==== | ||
| - | There are two possible solutions to this. | ||
| - | - Use a keyserver on the host | ||
| - | - Disable validation (not recommended) | ||
| - | === 1. Use a keyserver on the host ==== | + | ==== Container management |
| - | < | + | To list the installed containers and query their status, use **lxc-ls**: |
| - | root@ultra: | + | |
| - | Setting up the GPG keyring | + | |
| - | Downloading the image index | + | |
| - | Downloading the rootfs | + | |
| - | Downloading the metadata | + | |
| - | The image cache is now ready | + | |
| - | Unpacking the rootfs | + | |
| - | </ | + | |
| - | + | ||
| - | === 2. Disable gpg validation === | + | |
| - | < | + | |
| - | Downloading the image index | + | |
| - | WARNING: Running without gpg validation! | + | |
| - | Downloading the rootfs | + | |
| - | Downloading the metadata | + | |
| - | The image cache is now ready | + | |
| - | Unpacking the rootfs | + | |
| - | + | ||
| - | --- | + | |
| - | You just created a Debian buster arm64 (20210623_05: | + | |
| - | + | ||
| - | To enable SSH, run: apt install openssh-server | + | |
| - | No default root or user password are set by LXC.</ | + | |
| - | + | ||
| - | ==== List container and status ==== | + | |
| < | < | ||
| NAME STATE | NAME STATE | ||
| myLMS STOPPED 0 | myLMS STOPPED 0 | ||
| - | ==== Starting the container ==== | + | Start and stop containers with **lxc-start** and **lxc-stop** respectively: |
| < | < | ||
| root@ultra: | root@ultra: | ||
| Line 142: | Line 138: | ||
| myLMS RUNNING 0 | myLMS RUNNING 0 | ||
| - | ==== Stopping the container ==== | ||
| < | < | ||
| root@ultra: | root@ultra: | ||
| Line 148: | Line 143: | ||
| myLMS STOPPED 0 | myLMS STOPPED 0 | ||
| - | ==== Networking | + | Setup networking |
| < | < | ||
| ... | ... | ||
| Line 158: | Line 153: | ||
| lxc.net.0.hwaddr = 00: | lxc.net.0.hwaddr = 00: | ||
| - | ==== Optionally mount a share from the OpenWRT host inside the guest ==== | + | Optionally mount a share from the OpenWRT host inside the guest |
| Make sure to create the path to the share in the container, then edit the container config adding the following line: | Make sure to create the path to the share in the container, then edit the container config adding the following line: | ||
| < | < | ||
| Line 191: | Line 186: | ||
| ==== Auto start the container on OpenWRT host ==== | ==== Auto start the container on OpenWRT host ==== | ||
| - | < | + | < |
| + | uci show lxc-auto | ||
| uci add lxc-auto container | uci add lxc-auto container | ||
| uci set lxc-auto.@container[-1].name=myLMS | uci set lxc-auto.@container[-1].name=myLMS | ||