sysbox icon indicating copy to clipboard operation
sysbox copied to clipboard

Redundant setting of sysctls in sysbox package install postinst script

Open nudgegoonies opened this issue 4 years ago • 0 comments

The sysbox-ce debian package contains the /lib/sysctl/99-sysbox-sysctl.conf file configuring inotify and keys kernel values.

But the postinst script runs this section too:

# Ensure kernel's 'inotify' resources meet sysbox requirements -- default values
# in most distros are too low for decent-size scenarios.
function define_inotify_resources() {

    val=$(sysctl fs.inotify.max_queued_events)
    if [[ "${val##* }" -lt ${inotify_pool_size} ]]; then
        sysctl -w fs.inotify.max_queued_events=${inotify_pool_size} >/dev/null 2>&1
    fi

    val=$(sysctl fs.inotify.max_user_watches)
    if [[ "${val##* }" -lt ${inotify_pool_size} ]]; then
        sysctl -w fs.inotify.max_user_watches=${inotify_pool_size} >/dev/null 2>&1
    fi

    val=$(sysctl fs.inotify.max_user_instances)
    if [[ "${val##* }" -lt ${inotify_pool_size} ]]; then
        sysctl -w fs.inotify.max_user_instances=${inotify_pool_size} >/dev/null 2>&1
    fi
}

# Ensure kernel's 'keyring' resources meet sysbox requirements --
# default values in most distros are too low for decent-size
# scenarios. See definition of keyring_maxkeys variable above for
# details.
function define_keyring_resources() {

    val=$(sysctl kernel.keys.maxkeys)
    if [[ "${val##* }" -lt ${keyring_maxkeys} ]]; then
        sysctl -w kernel.keys.maxkeys=${keyring_maxkeys} >/dev/null 2>&1
    fi
}

Couln't this replaced by calling /lib/systemd/systemd-sysctl or restarting systemd-sysctl.service which should pickup /lib/sysctl/99-sysbox-sysctl.conf? Maybe there is a debhelper/systemd helper function too but i havn't found it yet.

nudgegoonies avatar Jul 30 '21 14:07 nudgegoonies