From 9ac5a070071a2ed866b8af2b5f1a3620b066ceaf Mon Sep 17 00:00:00 2001 From: Zolfa Date: Thu, 6 Oct 2022 12:40:00 +0000 Subject: [PATCH] lxc-unprivileged: fix mount options issue Fix an issue that cause unprivileged containers to not boot if /proc and /sys are mounted with the `noatime` option. At boot time /proc and /sys are remounted with the `relatime` option using a dedicated init.d script. --- utils/lxc/Makefile | 3 ++- utils/lxc/files/lxc-unprivileged.init | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100755 utils/lxc/files/lxc-unprivileged.init diff --git a/utils/lxc/Makefile b/utils/lxc/Makefile index 67abd17e1..0408f0b60 100644 --- a/utils/lxc/Makefile +++ b/utils/lxc/Makefile @@ -97,8 +97,9 @@ define Package/lxc-unprivileged/description endef define Package/lxc-unprivileged/install - $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_DIR) $(1)/etc/uci-defaults $(1)/etc/init.d $(INSTALL_DATA) ./files/lxc-unprivileged.defaults $(1)/etc/uci-defaults/lxc-unprivileged + $(INSTALL_BIN) ./files/lxc-unprivileged.init $(1)/etc/init.d endef define Package/lxc/config diff --git a/utils/lxc/files/lxc-unprivileged.init b/utils/lxc/files/lxc-unprivileged.init new file mode 100755 index 000000000..ab566da10 --- /dev/null +++ b/utils/lxc/files/lxc-unprivileged.init @@ -0,0 +1,13 @@ +#!/bin/sh /etc/rc.common + +. /lib/functions.sh + +START=98 + +# Remount /proc and /sys on host with relatime option, +# required for unprivileged containers to boot correctly. +boot() { + mount -t proc -o remount,rw,nosuid,nodev,noexec,relatime proc /proc + mount -t sysfs -o remount,rw,nosuid,nodev,noexec,relatime sysfs /sys +} +