OpenWrt ARM64 QUICK LXC HOWTO/GUIDE
Based on 21.02-RC
TESTED on ARM64 MVEBU ESPRESSOBIN et ESPRESSOBIN ULTRA
Install some necessary tools
opkg install xz tar gnupg
Install some necessary kernel modules
opkg install kmod-ikconfig kmod-veth
install some cgroups necessary tools
opkg install cgroupfs-mount cgroup-tools
install all lxc stuff
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
Check your kernel configs
root@ultra:~# lxc-checkconfig
LXC version 4.0.5
--- Namespaces ---
Namespaces: enabled
Utsname namespace: enabled
Ipc namespace: enabled
Pid namespace: enabled
User namespace: enabled
Network namespace: enabled
--- Control groups ---
Cgroups: enabled
Cgroup v1 mount points:
/sys/fs/cgroup/cpuset
/sys/fs/cgroup/cpu
/sys/fs/cgroup/cpuacct
/sys/fs/cgroup/blkio
/sys/fs/cgroup/memory
/sys/fs/cgroup/pids
/sys/fs/cgroup/rdma
/sys/fs/cgroup/systemd
Cgroup v2 mount points:
Cgroup v1 freezer controller: missing
Cgroup v1 clone_children flag: enabled
Cgroup device: missing
Cgroup sched: enabled
Cgroup cpu account: enabled
Cgroup memory controller: enabled
Cgroup cpuset: enabled
--- Misc ---
Veth pair device: enabled, loaded
Macvlan: enabled, not loaded
Vlan: enabled, not loaded
Bridges: enabled, not loaded
Advanced netfilter: enabled, not loaded
CONFIG_NF_NAT_IPV4: missing
CONFIG_NF_NAT_IPV6: missing
CONFIG_IP_NF_TARGET_MASQUERADE: missing
CONFIG_IP6_NF_TARGET_MASQUERADE: missing
CONFIG_NETFILTER_XT_TARGET_CHECKSUM: enabled, not loaded
CONFIG_NETFILTER_XT_MATCH_COMMENT: enabled, loaded
FUSE (for use with lxcfs): enabled, not loaded
--- Checkpoint/Restore ---
checkpoint restore: missing
CONFIG_FHANDLE: enabled
CONFIG_EVENTFD: enabled
CONFIG_EPOLL: enabled
CONFIG_UNIX_DIAG: missing
CONFIG_INET_DIAG: missing
CONFIG_PACKET_DIAG: missing
CONFIG_NETLINK_DIAG: enabled
File capabilities:
Note : Before booting a new kernel, you can check its configuration
usage : CONFIG=/path/to/config /usr/bin/lxc-checkconfig
Create a LXC container for LMS based on Debian BUSTER
root@ultra:~# lxc-create --name myLMS --template download -- --dist debian --release buster --arch arm64
Setting up the GPG keyring
ERROR: Unable to fetch GPG key from keyserver
lxc-create: myLMS: lxccontainer.c: create_run_template: 1616 Failed to create container from template
lxc-create: myLMS: tools/lxc_create.c: main: 319 Failed to create container myLMS
FIXME ERROR: Unable to fetch GPG key from keyserver
in case of GPG error :
Two solutions, force a gpg keyserver or disable GPG validation
first solution, force a gpg keyserver
opkg install gnupg2-utils gnupg2-dirmngr
or
opkg install gnupg-utils
root@ultra:~# DOWNLOAD_KEYSERVER="pgp.mit.edu" lxc-create --name myPOD --template download -- --dist debian --release buster --arch arm64
Setting up the GPG keyring
Downloading the image index
Downloading the rootfs
Downloading the metadata
The image cache is now ready
Unpacking the rootfs
Or second solution with disabling gpg validation
root@ultra:~# lxc-create --name myLMS --template download -- --dist debian --release buster --arch arm64 --no-validate
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:24) container.
To enable SSH, run: apt install openssh-server
No default root or user password are set by LXC.
List container and status
root@ultra:~# lxc-ls -f
NAME STATE AUTOSTART GROUPS IPV4 IPV6 UNPRIVILEGED
myLMS STOPPED 0 - - - false
FIX CGROUPS V1 ERROR
root@ultra:~# lxc-start -n myLMS
lxc-start: myLMS: lxccontainer.c: wait_on_daemonized_start: 860 Received container state "ABORTING" instead of "RUNNING"
lxc-start: myLMS: tools/lxc_start.c: main: 308 The container failed to start
lxc-start: myLMS: tools/lxc_start.c: main: 311 To get more details, run the container in foreground mode
lxc-start: myLMS: tools/lxc_start.c: main: 314 Additional information can be obtained by setting the --logfile and --logpriority options
THE FIX (comments all cgroups legacy parts)
root@ultra:~# nano /usr/share/lxc/config/common.conf
# Default legacy cgroup configuration
#
# CGroup allowlist
#lxc.cgroup.devices.deny = a
## Allow any mknod (but not reading/writing the node)
#lxc.cgroup.devices.allow = c *:* m
#lxc.cgroup.devices.allow = b *:* m
## Allow specific devices
### /dev/null
#lxc.cgroup.devices.allow = c 1:3 rwm
### /dev/zero
#lxc.cgroup.devices.allow = c 1:5 rwm
### /dev/full
#lxc.cgroup.devices.allow = c 1:7 rwm
### /dev/tty
#lxc.cgroup.devices.allow = c 5:0 rwm
### /dev/console
#lxc.cgroup.devices.allow = c 5:1 rwm
### /dev/ptmx
#lxc.cgroup.devices.allow = c 5:2 rwm
### /dev/random
#lxc.cgroup.devices.allow = c 1:8 rwm
### /dev/urandom
#lxc.cgroup.devices.allow = c 1:9 rwm
### /dev/pts/*
#lxc.cgroup.devices.allow = c 136:* rwm
### fuse
#lxc.cgroup.devices.allow = c 10:229 rwm
START CONTAINER
root@ultra:~# lxc-start -n myLMS
root@ultra:~# lxc-ls -f
NAME STATE AUTOSTART GROUPS IPV4 IPV6 UNPRIVILEGED
myLMS RUNNING 0 - - - false
STOP CONTAINER
root@ultra:~# lxc-stop -n myLMS
root@ultra:~# lxc-ls -f
NAME STATE AUTOSTART GROUPS IPV4 IPV6 UNPRIVILEGED
myLMS STOPPED 0 - - - false
ADD NETWORK CONFIG IN LXC CONTAINER
root@ultra:~# nano /srv/lxc/myLMS/config`
...
# Network configuration
#lxc.net.0.type = empty
lxc.net.0.type = veth
lxc.net.0.link = br-lan
lxc.net.0.flags = up
lxc.net.0.hwaddr = 00:FF:DD:BB:CC:01
START CONTAINER
root@ultra:~# lxc-start -n myLMS
root@ultra:~# lxc-ls -f
NAME STATE AUTOSTART GROUPS IPV4 IPV6 UNPRIVILEGED
myLMS RUNNING 0 - 192.168.1.188 fdc5:f7f:d0b5:0:2ff:ddff:febb:cc01 false
DEBIAN POSTINSTALL SSH + SUDO FIXME
root@ultra:~# lxc-attach -n myLMS
root@myLMS:~#
$ adduser admin
$ apt install sudo
$ addgroup admin sudo
$ apt install ssh -y
$ ip a
root@myLMS:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0@if12: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:ff:dd:bb:cc:01 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 192.168.1.188/24 brd 192.168.1.255 scope global dynamic eth0
valid_lft 42908sec preferred_lft 42908sec
inet6 fdc5:f7f:d0b5:0:2ff:ddff:febb:cc01/64 scope global dynamic mngtmpaddr
valid_lft forever preferred_lft forever
inet6 fe80::2ff:ddff:febb:cc01/64 scope link
valid_lft forever preferred_lft forever
$ exit
LXC-AUTO AUTOBOOT AT BOOTUP FIXME
uci show lxc-auto
uci add lxc-auto container
uci set lxc-auto.@container[-1].name=myLMS
uci set lxc-auto.@container[-1].timeout=30
uci show lxc-auto
uci commit lxc-auto
access with SSH to Debian system
ssh admin@myLMS
ssh admin@192.168.1.188
---8<---
install LMS inside Debian system
REFS :
sudo apt install wget -y
sudo apt-get install libio-socket-ssl-perl
wget http://downloads.slimdevices.com/LogitechMediaServer_v8.1.1/logitechmediaserver_8.1.1_all.deb
sudo dpkg -i logitechmediaserver_8.1.1_all.deb
ACCESS LMS WEBUI
http://mylms.local:9000/
http://192.168.1.188:9000