From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 0BC681FF187 for ; Tue, 2 Dec 2025 16:27:19 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 16A6D163BC; Tue, 2 Dec 2025 16:27:43 +0100 (CET) From: Filip Schauer To: pve-devel@lists.proxmox.com Date: Tue, 2 Dec 2025 16:27:28 +0100 Message-ID: <20251202152733.204787-1-f.schauer@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1764689214219 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.005 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [lxc.pm, mount.auto] Subject: [pve-devel] [PATCH container] lxc config: mount /dev/shm tmpfs for application containers X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Mount a tmpfs at /dev/shm into containers without an init system which would normally set up a shared memory filesystem. This satisfies the OCI Runtime Spec [0], which specifies that the following should be made available in the container: /proc proc /sys sysfs /dev/pts devpts /dev/shm tmpfs The reason the mount is added conditionally is to avoid interfering with init systems: systemd correctly detects an existing /dev/shm, but OpenRC mounts it even if already present, resulting in duplicate mounts. [0] https://github.com/opencontainers/runtime-spec/blob/fd25dd34a06b/config-linux.md#default-filesystems Signed-off-by: Filip Schauer --- src/PVE/LXC.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm index de54a0d..e5ff3a1 100644 --- a/src/PVE/LXC.pm +++ b/src/PVE/LXC.pm @@ -756,6 +756,11 @@ sub update_lxc_config { $raw .= "lxc.mount.auto = sys:mixed\n"; } + if (defined($conf->{entrypoint}) && $conf->{entrypoint} ne '/sbin/init') { + # Mount /dev/shm tmpfs into the container, if no init system runs to set it up. + $raw .= "lxc.mount.entry = shm dev/shm tmpfs rw,nosuid,nodev,create=dir 0 0\n"; + } + PVE::LXC::Config->foreach_passthrough_device( $conf, sub { -- 2.47.3 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel