Deprecate automatic loading of modules

In the hwclock, procfs and sysfs service scripts, we automatically
attempt to load the kernel modules we need before we take any action. We
shouldn't do this, because there are systems which do not use kernel
modules and do not have the kmod package installed.

With this change, we continue to load the modules ourselves, but we warn
the admin that they need to be added to /etc/conf.d/modules or built
into the kernel.

In the future, this automatic loading will be dropped.

X-Gentoo-Bug: 342313
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=342313
This commit is contained in:
William Hubbs 2016-08-18 16:25:56 -05:00
parent 1a55d46645
commit 73cdf10f1f
3 changed files with 19 additions and 5 deletions

View File

@ -30,6 +30,7 @@ fi
depend() depend()
{ {
provide clock provide clock
want modules
if yesno $clock_adjfile; then if yesno $clock_adjfile; then
use root use root
else else
@ -81,7 +82,7 @@ get_noadjfile()
start() start()
{ {
local retval=0 errstr="" local retval=0 errstr="" modname
setupopts setupopts
if [ -z "$utc_cmd" ]; then if [ -z "$utc_cmd" ]; then
@ -96,7 +97,12 @@ start()
[ -e "$rtc" ] && break [ -e "$rtc" ] && break
done done
if [ ! -e "${rtc}" ]; then if [ ! -e "${rtc}" ]; then
modprobe -q rtc-cmos || modprobe -q rtc || modprobe -q genrtc for x in rtc-cmos rtc genrtc; do
modprobe -q $x && modname=$x && break
done
[ -n "$modname" ] &&
ewarn "The $modname module needs to be configured in \
@SYSCONFDIR@/conf.d/modules or built in."
fi fi
fi fi

View File

@ -13,7 +13,8 @@ description="Mounts misc filesystems in /proc."
depend() depend()
{ {
use modules devfs use devfs
want modules
need localmount need localmount
keyword -docker -lxc -openvz -prefix -systemd-nspawn -vserver keyword -docker -lxc -openvz -prefix -systemd-nspawn -vserver
} }
@ -22,7 +23,10 @@ start()
{ {
# Setup Kernel Support for miscellaneous Binary Formats # Setup Kernel Support for miscellaneous Binary Formats
if [ -d /proc/sys/fs/binfmt_misc -a ! -e /proc/sys/fs/binfmt_misc/register ]; then if [ -d /proc/sys/fs/binfmt_misc -a ! -e /proc/sys/fs/binfmt_misc/register ]; then
modprobe -q binfmt-misc if modprobe -q binfmt-misc; then
ewarn "The binfmt-misc module needs to be configured in \
@SYSCONFDIR@/conf.d/modules or built in."
fi
if grep -qs binfmt_misc /proc/filesystems; then if grep -qs binfmt_misc /proc/filesystems; then
ebegin "Mounting misc binary format filesystem" ebegin "Mounting misc binary format filesystem"
mount -t binfmt_misc -o nodev,noexec,nosuid \ mount -t binfmt_misc -o nodev,noexec,nosuid \

View File

@ -15,6 +15,7 @@ sysfs_opts=nodev,noexec,nosuid
depend() depend()
{ {
want modules
keyword -docker -lxc -prefix -systemd-nspawn -vserver keyword -docker -lxc -prefix -systemd-nspawn -vserver
} }
@ -102,7 +103,10 @@ mount_misc()
# it will NOT appear in /proc/filesystems yet # it will NOT appear in /proc/filesystems yet
if [ -d /sys/firmware/efi/efivars ] \ if [ -d /sys/firmware/efi/efivars ] \
&& ! mountinfo -q /sys/firmware/efi/efivars; then && ! mountinfo -q /sys/firmware/efi/efivars; then
modprobe -q efivarfs if modprobe -q efivarfs; then
ewarn "The efivarfs module needs to be configured in \
@SYSCONFDIR@/conf.d/modules or built in"
fi
if grep -qs efivarfs /proc/filesystems; then if grep -qs efivarfs /proc/filesystems; then
ebegin "Mounting efivarfs filesystem" ebegin "Mounting efivarfs filesystem"
mount -n -t efivarfs -o ${sysfs_opts} \ mount -n -t efivarfs -o ${sysfs_opts} \