Search code examples
yoctosystemd

How disable the RNGD service from Yocto?


Background: I am running Yocto Zeus, and Linux Kernel 4.14 using SystemD. My target is an embedded i.MX6.

I have been attempting to disable the RNGD service at startup. It consumes all the cores for many seconds after bootup, and when I manually disable (via systemctl disable rngd it is actually disabled and there are no ill-effects (our software doesn't use /dev/random).

I have looked through Disable a standard systemd service in Yocto build and have tried both the package remove and deleting the link, and neither seem to work. Here are the contents of my systemd_%.bbappend file in my layer.

# To remove the package completely, add it to this space separated list.
# Not all services can be removed.
PACKAGECONFIG_remove = "timesyncd kmod rngd"

do_install_append() {
    rmdir ${D}${sysconfdir}/systemd/network
    ln -sfn /var/local/etc/systemd/network ${D}${sysconfdir}/systemd/network

    rm -f ${D}${sysconfdir}/systemd/system/multi-user.target.wants/rngd.service
}

Is there a way to delete this service? Even with both of those, I still see rngd running at boot. I am reasonably confident my changes are being included, I can see them if I run bitbake -e systemd | grep rngd:

gen-ccm-root@ubuntu:~/workdir/tools/poky/build-dev$ bitbake -e systemd | grep rngd
#     "timesyncd kmod rngd"
    rm -f /home/gen-ccm-root/workdir/tools/poky/build-dev/tmp/work/armv7at2hf-neon-poky-linux-gnueabi/systemd/1_243+AUTOINC+efb536d0cb-r0/image/etc/systemd/system/multi-user.target.wants/rngd.service

I have also confirmed that the other things in that file are actually taking effect. The network link is being properly made and I have confirmed that the timesyncd service is removed. I have confirmed that the file I am removing is the link that systemctl disable would remove:

~# systemctl disable rngd
Removed /etc/systemd/system/multi-user.target.wants/rngd.service.

Solution

  • On Poky (Warrior branch) I have a bbappend to disable rng. The filename is rng-tools_%.bbappend and contains:

    SYSTEMD_AUTO_ENABLE_rng-tools = "disable"