Sample Header Ad - 728x90

In my Linux yocto-base distribution is not istalled the file sysctl.conf by the procps recipe

0 votes
0 answers
99 views
On my Linux Yocto-base distribution I don't find any sysctl.conf file. The proof of this is the execution of the command:
> find / -name "sysctl.conf"
which has an output empty. On my Yocto build system (I'm using the release zeus) I can find: 1. the file sysctl.conf in the path: meta/recipes-extended/procps/procps/ 2. the recipe procps_3.3.16.bb in the path meta/recipes-extended/procps/ The content of the recipe procps_3.3.16.bb is the following:
SUMMARY = "System and process monitoring utilities"
DESCRIPTION = "Procps contains a set of system utilities that provide system information about processes using \
the /proc filesystem. The package includes the programs ps, top, vmstat, w, kill, and skill."
HOMEPAGE = "https://gitlab.com/procps-ng/procps "
SECTION = "base"
LICENSE = "GPLv2+ & LGPLv2+"
LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
                    file://COPYING.LIB;md5=4cf66a4984120007c9881cc871cf49db \
                    "

DEPENDS = "ncurses"

inherit autotools gettext pkgconfig update-alternatives

SRC_URI = "git://gitlab.com/procps-ng/procps.git;protocol=https \
           file://sysctl.conf \
           "
SRCREV = "59c88e18f29000ceaf7e5f98181b07be443cf12f"

S = "${WORKDIR}/git"

# Upstream has a custom autogen.sh which invokes po/update-potfiles as they
# don't ship a po/POTFILES.in (which is silly).  Without that file gettext
# doesn't believe po/ is a gettext directory and won't generate po/Makefile.
do_configure_prepend() {
    ( cd ${S} && po/update-potfiles )
}

EXTRA_OECONF = "--enable-skill --disable-modern-top"

PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}"
PACKAGECONFIG[systemd] = "--with-systemd,--without-systemd,systemd"

do_install_append () {
	install -d ${D}${base_bindir}
	[ "${bindir}" != "${base_bindir}" ] && for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i; done
	install -d ${D}${base_sbindir}
	[ "${sbindir}" != "${base_sbindir}" ] && for i in ${base_sbindir_progs}; do mv ${D}${sbindir}/$i ${D}${base_sbindir}/$i; done
        if [ "${base_sbindir}" != "${sbindir}" ]; then
                rmdir ${D}${sbindir}
        fi

        install -d ${D}${sysconfdir}
        install -m 0644 ${WORKDIR}/sysctl.conf ${D}${sysconfdir}/sysctl.conf
        if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
                install -d ${D}${sysconfdir}/sysctl.d
                ln -sf ../sysctl.conf ${D}${sysconfdir}/sysctl.d/99-sysctl.conf
        fi
}

CONFFILES_${PN} = "${sysconfdir}/sysctl.conf"

bindir_progs = "free pkill pmap pgrep pwdx skill snice top uptime w"
base_bindir_progs += "kill pidof ps watch"
base_sbindir_progs += "sysctl"

ALTERNATIVE_PRIORITY = "200"
ALTERNATIVE_PRIORITY[pidof] = "150"

ALTERNATIVE_${PN} = "${bindir_progs} ${base_bindir_progs} ${base_sbindir_progs}"

ALTERNATIVE_${PN}-doc = "kill.1 uptime.1"
ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1"
ALTERNATIVE_LINK_NAME[uptime.1] = "${mandir}/man1/uptime.1"

python __anonymous() {
    for prog in d.getVar('base_bindir_progs').split():
        d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir'), prog))

    for prog in d.getVar('base_sbindir_progs').split():
        d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_sbindir'), prog))
}

# 'ps' isn't suitable for use as a security tool so whitelist this CVE.
# https://bugzilla.redhat.com/show_bug.cgi?id=1575473#c3 
CVE_CHECK_WHITELIST += "CVE-2018-1121"
With the previous recipe procps_3.3.16.bb I think that the file sysctl.conf should be installed in /etc/; I'm thinking this because in the function do_install_append() declared in the previous recipe is present the command:
install -m 0644 ${WORKDIR}/sysctl.conf ${D}${sysconfdir}/sysctl.conf
which seems to install the file sysctl.conf in the path /etc of the filesystem of the image created by bitbake. Furthermore the output of the execution of the command bitbake procps, is saved in the build folder of procps and in this output, the file /etc/sysctl.conf in both the sub-folders image and package. So seems that the file is correctly prepared for the deployment to the final image, but the deployment is not executed. ### On my system is used systemd-sysctl ### At [this link](https://man7.org/linux/man-pages/man5/sysctl.conf.5.html) I have found the following sentence: > This man page describes the configuration files for procps sysctl. If you are using systemd-sysctl(8), refer to sysctl.d(5) and note that it won't use the file /etc/sysctl.conf. This mean that the /etc/sysctl.conf is not used on my system. ### Links about the same topic ### 1. Very useful [this link](https://stackoverflow.com/questions/57071108/add-new-kernel-parameter-to-custom-linux-image-generated-by-yocto) which speaks about the same argument, but in the case that the file sysctl.conf is deployed and so it is present in the filesystem of the Yocto distribution. 2. My exactly problem is found in [this other link](https://lists.yoctoproject.org/g/meta-xilinx/topic/sysctl_conf_not_being/76646124) , but I have tried to follow all the suggestions proposed in it without success. 3. [This other link](https://unix.stackexchange.com/questions/791401/the-yocto-recipe-procps-doesnt-deploy-into-the-linux-built-image-all-the-applic) is yet about the recipe pocps_3.3.16.bb. ### Question ### With the configuration explained above, why the file sysctl.conf is not deployed to the folder /etc/ into the filesystem of the yocto image?
Asked by User051209 (498 rep)
Feb 19, 2025, 05:37 PM
Last activity: Mar 17, 2025, 04:16 PM