| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision |
| lxc_openwrt_host [2021/09/19 09:12] – remove sections darksky2 | lxc_openwrt_host [2021/09/22 08:05] – [Setup on the OpenWRT host] darksky2 |
|---|
| This example was using OpenWRT ARM64 MVEBU ESPRESSOBIN et ESPRESSOBIN ULTRA. It has also been verified on a OpenWRT aarch64 Raspberry Pi4 B. | This example was using OpenWRT ARM64 MVEBU ESPRESSOBIN et ESPRESSOBIN ULTRA. It has also been verified on a OpenWRT aarch64 Raspberry Pi4 B. |
| |
| | [[https://forum.openwrt.org/t/openwrt-arm64-quick-lxc-howto-guide-lms-in-debian-system-in-lxc-container/99835|Original Forum Topic]] |
| ==== Setup on the OpenWRT host ==== | ==== Setup on the OpenWRT host ==== |
| Install some necessary tools and prerequisites: | Install some necessary tools and prerequisites: |
| <code>opkg install kmod-ikconfig kmod-veth</code> | <code>opkg install kmod-ikconfig kmod-veth</code> |
| |
| Install the lxc packages (note that not all of these are required): | Install the core lxc packages: |
| <code>opkg install liblxc luci-app-lxc lxc lxc-attach lxc-auto lxc-autostart lxc-cgroup lxc-checkconfig lxc-common lxc-config lxc-configs lxc-console lxc-copy lxc-create lxc-destroy lxc-device lxc-execute lxc-freeze lxc-hooks lxc-info lxc-init lxc-ls lxc-monitor lxc-monitord lxc-snapshot lxc-start lxc-stop lxc-templates lxc-top lxc-unfreeze lxc-unprivileged lxc-unshare lxc-user-nic lxc-usernsexec lxc-wait rpcd-mod-lxc</code> | <code>opkg install lxc-start lxc-stop lxc-create lxc-attach lxc-destroy lxc-config lxc-ls getopt</code> |
| |
| Check the kernel config to see if anything required is missing: | FIXME: Note that getopt should be a package dependency, see: [[https://github.com/openwrt/packages/issues/16684|#16684]] is fixed. |
| <code>root@ultra:~# lxc-checkconfig | |
| | Additional packages exist that can add functionality but that aren't strictly required. Find them with: |
| | <code>opkg list | grep lxc</code> |
| | |
| | FIXME: Note that until [[https://github.com/openwrt/packages/pull/16660|PR#16660]] is merged, users of 21.02 will have to complete this extra step. Users of snapshot builds newer than 20-Sep-2021 can skip this next step. |
| | |
| | Edit ''/usr/share/lxc/config/common.conf'' and comment out all lines relating to legacy cgroup configuration: |
| | <code>sed -i s/lxc.cgroup.devices/#lxc.cgroup.devices/ /usr/share/lxc/config/common.conf</code> |
| | |
| | Optionally check the kernel config to see if anything required is missing: |
| | <code>root@ultra:~# opkg install lxc-checkconfig |
| | # lxc-checkconfig |
| LXC version 4.0.5 | LXC version 4.0.5 |
| --- Namespaces --- | --- Namespaces --- |
| <code>opkg install gnupg2-utils gnupg2-dirmngr</code> | <code>opkg install gnupg2-utils gnupg2-dirmngr</code> |
| |
| Alternatively, just use the <code>--no-validate</code> switch in the command when setting up the container. This is potentially dangerous and insecure. | Alternatively, just use the **--no-validate** switch in the command when setting up the container. This is potentially dangerous and insecure. |
| |
| Example: | Example: |
| |
| ==== Auto start the container on OpenWRT host ==== | ==== Auto start the container on OpenWRT host ==== |
| <code>uci show lxc-auto | <code>opkg install lxc-auto lxc-autostart |
| | 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 |