Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 595836 - openrc-0.22 : modprobe -q efivarfs returns a warning when EFI is build in the kernel
Summary: openrc-0.22 : modprobe -q efivarfs returns a warning when EFI is build in the...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-02 00:28 UTC by Francois Chenier
Modified: 2016-10-06 17:49 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
0001-init.d-sysfs-fix-efivarfs-handling.patch (0001-init.d-sysfs-fix-efivarfs-handling.patch,1.61 KB, patch)
2016-10-04 17:11 UTC, William Hubbs
Details | Diff
sysfs.patch (sysfs.patch,1017 bytes, patch)
2016-10-04 23:22 UTC, William Hubbs
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Francois Chenier 2016-10-02 00:28:50 UTC
In initscript /etc/init.d/sysfs this snippet is always returns a warning message when EFI is build in the kernel.

if modprobe -q efivarfs; then
   ewarn "The efivarfs module needs to be configured in" \
   "/etc/conf.d/modules or built in"
fi


Reproducible: Always

Steps to Reproduce:
1.Just install and check messages when booting
Actual Results:  
The efivarfs module needs to be configured in /etc/conf.d/modules or built in.

Expected Results:  
False warning - efivarsfs module is already built in.

Might be relevant or not ... I have =sys-apps/kmod-23 installed.
Comment 1 Francois Chenier 2016-10-02 00:30:59 UTC
belgix@darwin ~ $ emerge --info
Portage 2.3.1 (python 3.5.2-final-0, default/linux/amd64/13.0, gcc-5.4.0, unavailable, 4.7.5-gentoo x86_64)
=================================================================
System uname: Linux-4.7.5-gentoo-x86_64-Intel-R-_Core-TM-_i7-3537U_CPU_@_2.00GHz-with-gentoo-2.3
KiB Mem:     8116756 total,   6449488 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Sat, 01 Oct 2016 19:15:01 +0000
sh bash 4.4
ld GNU ld (Gentoo 2.26.1 p1.0) 2.26.1
app-shells/bash:          4.4::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.24.0-r1::gentoo
dev-lang/python:          2.7.12::gentoo, 3.5.2::gentoo
dev-util/cmake:           3.6.2::gentoo
dev-util/pkgconfig:       0.29.1::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/openrc:          0.22.1::gentoo
sys-apps/sandbox:         2.10-r2::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r2::gentoo
sys-devel/automake:       1.15-r2::gentoo
sys-devel/binutils:       2.26.1::gentoo
sys-devel/gcc:            5.4.0::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r2::gentoo
sys-devel/make:           4.2.1::gentoo
sys-kernel/linux-headers: 4.7::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r2::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.au.gentoo.org/gentoo-portage
    priority: -1000

belgix
    location: /home/Linux/overlays                                                                                                                                      
    masters: gentoo                                                                                                                                                     
    priority: 0                                                                                                                                                         
                                                                                                                                                                        
ACCEPT_KEYWORDS="amd64 ~amd64"                                                                                                                                          
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=corei7-avx -O2 -fomit-frame-pointer -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php7.0/ext-active/ /etc/php/cgi-php7.0/ext-active/ /etc/php/cli-php7.0/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=corei7-avx -O2 -fomit-frame-pointer -pipe"
DISTDIR="/home/Linux/src"
FCFLAGS="-march=corei7-avx -O2 -fomit-frame-pointer -pipe"
FEATURES="assume-digests binpkg-logs buildpkg config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news nodoc noinfo noman parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-march=corei7-avx -O2 -fomit-frame-pointer -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_AU.ISO-8859-1"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j5"
PKGDIR="/home/Linux/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/tmp"
USE="X acl amd64 berkdb bzip2 cli crypt cxx dri fortran gdbm gles2 iconv icu ipv6 lzma mmx mmxext modules multilib ncurses nls nptl openmp pam pcre readline seccomp session sse sse2 ssl tcpd truetype unicode xattr zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="alias auth_basic authn_core authn_file authz_core authz_host authz_user autoindex dir mime unixd socache_shmcb" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="avx mmx mmxext sse sse2 sse3 ssse3 sse4_1 sse4_2" ELIBC="glibc" FFTOOLS="qt-faststart" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev" KERNEL="linux" L10N="en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" USERLAND="GNU" VIDEO_CARDS="i965 nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 2 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2016-10-02 03:00:31 UTC
williamh:
use "test -d /sys/module/ip_set/"
to test, rather than modprobe. That will exist even for compiled-in functionality.
Comment 3 William Hubbs gentoo-dev 2016-10-03 17:32:23 UTC
@robbat2:
The goal is to complain if I have to load the module. What can I test
for that should only be present if the module is loaded or built in?

I want something like this (in pseudocode)...:

if [ eafivars is not loaded ] && [ modprobe -q eafivars ]; then
ewarn "I am complaining because I had to load the module. fix your"
ewarn "config"
fi
Comment 4 Francois Chenier 2016-10-03 21:51:56 UTC
(In reply to William Hubbs from comment #3)
That's better to do it that way because modprobe returns non zero if the module is already loaded (or built in).
Even a better way will be to split your IF in your pseudo code in two. You test if the module is loaded first. If yes, nothing more to do otherwise try to load efivarsfs.
Comment 5 William Hubbs gentoo-dev 2016-10-03 22:40:36 UTC
(In reply to Francois Chenier from comment #4)
> (In reply to William Hubbs from comment #3)
> That's better to do it that way because modprobe returns non zero if the
> module is already loaded (or built in).
> Even a better way will be to split your IF in your pseudo code in two. You
> test if the module is loaded first. If yes, nothing more to do otherwise try
> to load efivarsfs.

The goal of this is to warn you if I had to load the module so that you will configure the module in /etc/conf.d/modules or build it into the kernel.

The next step, which will happen in openrc-1.0, will be that I will not try to load the module.
Comment 6 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2016-10-04 04:52:59 UTC
(In reply to William Hubbs from comment #3)
> @robbat2:
> The goal is to complain if I have to load the module.
> What can I test
> for that should only be present if the module is loaded or built in?
> 
> I want something like this (in pseudocode)...:

if [ ! -d /sys/module/efivars/ ]; then
  # efivars not yet available 
  if modprobe -q efivars; then
    ewarn "Hey, you should load efivars before this!"
  else
    # it fails on both non-EFI systems and when the module is not built.
    ewarn "efivars not available or would not load"

  fi
fi
Comment 7 William Hubbs gentoo-dev 2016-10-04 17:11:31 UTC
Created attachment 449152 [details, diff]
0001-init.d-sysfs-fix-efivarfs-handling.patch

Please apply this patch and let me know if the warning goes away if the
module is built in.

Thanks,

William
Comment 8 Francois Chenier 2016-10-04 22:08:19 UTC
(In reply to William Hubbs from comment #7)
> Please apply this patch and let me know if the warning goes away if the
> module is built in.

Not exactly because the module doesn't appears in /sys/module (at least for kernel 4.8.0). However, because efivarsfs is built in my kernel, you can check for /sys/firmware/efi/efivars instead. The following works to get rid of the warning.

# set up kernel support for efivarfs
if [ ! -d /sys/firmware/efi/efivars ] && modprobe -q efivarfs; then
  ewarn "The efivarfs module needs to be configured in " \
        "/etc/conf.d/modules or built in"
fi
Comment 9 William Hubbs gentoo-dev 2016-10-04 23:22:04 UTC
Created attachment 449162 [details, diff]
sysfs.patch

Let's try one more. :-)

Apply this patch to 0.22.1 and let me know if it solves your issue.

Thanks,

William
Comment 10 William Hubbs gentoo-dev 2016-10-06 17:49:05 UTC
The following commits are the fix for this issue:

https://github.com/openrc/openrc/commit/6a0c033
https://github.com/openrc/openrc/commit/3d2c2f0
https://github.com/openrc/openrc/commit/deaae7a

This will be in 0.23 and is backported to 0.22.2.

Feel free to re-open if this is still an issue.

Thanks,

William