The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd-pkg-snap/pull/66

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
The default limit as 200 will be obvious when provisioning multiple LXD
containers and installing snap packages into those at the same time.
Let's bump it as well as /proc/sys/fs/inotify/max_user_instances out of
the box. See more details in https://launchpad.net/bugs/1891223

Closes: #65
From 3a3f4d3b7d33ff87847d020d9283b8c79faed26c Mon Sep 17 00:00:00 2001
From: Nobuto Murata <nobuto.mur...@canonical.com>
Date: Fri, 11 Sep 2020 14:55:03 +0900
Subject: [PATCH] Bump /proc/sys/kernel/keys/maxkeys out of the box

The default limit as 200 will be obvious when provisioning multiple LXD
containers and installing snap packages into those at the same time.
Let's bump it as well as /proc/sys/fs/inotify/max_user_instances out of
the box. See more details in https://launchpad.net/bugs/1891223

Closes: #65
---
 snapcraft/commands/daemon.start | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/snapcraft/commands/daemon.start b/snapcraft/commands/daemon.start
index d3f75ba..9a6ac64 100755
--- a/snapcraft/commands/daemon.start
+++ b/snapcraft/commands/daemon.start
@@ -348,6 +348,13 @@ if [ "$(stat -c '%u' /proc)" = 0 ]; then
         fi
     fi
 
+    if [ -e /proc/sys/kernel/keys/maxkeys ]; then
+        if [ "$(cat /proc/sys/kernel/keys/maxkeys)" -lt "2000" ]; then
+            echo "==> Increasing the number of keys for a nonroot user"
+            echo 2000 > /proc/sys/kernel/keys/maxkeys || true
+        fi
+    fi
+
     if [ -e /proc/sys/kernel/unprivileged_userns_clone ]; then
         if [ "$(cat /proc/sys/kernel/unprivileged_userns_clone)" = "0" ]; then
             echo "==> Enabling unprivileged containers kernel support"
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to