Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 342313 - sys-apps/openrc: nice support for systems w/out kernel module support (to avoid `modprobe: command not found` warnings)
Summary: sys-apps/openrc: nice support for systems w/out kernel module support (to avo...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
: 582830 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-10-23 13:45 UTC by Diego Elio Pettenò (RETIRED)
Modified: 2016-08-19 16:47 UTC (History)
3 users (show)

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


Attachments
Patch for the problem (0002-Protect-all-modprobe-calls-with-a-type-check.patch,4.65 KB, patch)
2010-10-24 02:09 UTC, Diego Elio Pettenò (RETIRED)
Details | Diff
Alternative approach (0002-Simplify-modprobe-checks-and-hide-error-output.patch,5.79 KB, patch)
2010-10-24 08:23 UTC, Diego Elio Pettenò (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Diego Elio Pettenò (RETIRED) gentoo-dev 2010-10-23 13:45:17 UTC
On various virtual servers there is _no_ need for module-init-tools at all.

If the dependency is there for the modules init tools, why is it not moved into module-init-tools itself?
Comment 1 SpanKY gentoo-dev 2010-10-23 20:54:53 UTC
openrc executes module-init-tools progs in multiple places

your question makes no sense as worded
Comment 2 Diego Elio Pettenò (RETIRED) gentoo-dev 2010-10-23 21:01:02 UTC
Can we reduce that so that it doesn't have to use it explicitly, or "soft-fail" if it's not installed? You might very well have systems where module-init-tools wouldn't work (vserver for instance).
Comment 3 Diego Elio Pettenò (RETIRED) gentoo-dev 2010-10-24 02:09:05 UTC
Created attachment 251759 [details, diff]
Patch for the problem

This patch protects all the modprobe calls in openrc with a type-check… this allows to run openrc fine without having module-init-tools installed.

Does this suffice?

My next move would be to move (sorry for the pun) the modules init script from openrc to module-init-tools that provide the tools it uses, anything seems wrong about that?
Comment 4 SpanKY gentoo-dev 2010-10-24 04:18:34 UTC
ugh, no.  if you want to go that route, it'd make sense to have a wrapper func in one place.  although i'd be inclined to tell you to just do it yourself:
  ln -s `which true` /sbin/modprobe
Comment 5 Diego Elio Pettenò (RETIRED) gentoo-dev 2010-10-24 08:06:21 UTC
I was just mimicking the kldload handling in init.misc.d.

If you want an easier solution what about testing for ! modprobe >/dev/null 2>&1 and let it fail silently if modprobe is not installed?
Comment 6 Diego Elio Pettenò (RETIRED) gentoo-dev 2010-10-24 08:23:59 UTC
Created attachment 251773 [details, diff]
Alternative approach

This one simplifies the code from before as well.

If a /proc or /sys path does not exist and module fails to load assume error; this also means that if modprobe succeed, assume success, which was the case for a few checks previously as well.
Comment 7 SpanKY gentoo-dev 2010-10-24 15:52:53 UTC
i'm not interested in hiding modprobe output either.  i already spent time in making sure that invocation of it would not output anything in the default case.  hiding valid errors to cater to a tiny number of people who dont have modprobe installed isnt going to happen.
Comment 8 Diego Elio Pettenò (RETIRED) gentoo-dev 2010-10-24 17:32:52 UTC
What about not-so-tiny number of people who _don't use modules_?

Can you provide an alternative? Would a _modprobe() function wrapper work for you? Remember that Gentoo doesn't have to be the way you want it, there are more use cases, and one of this (which is not so rare) is monolithic kernels. There are people for which having module-init-tools is just a waste of space/time/build; we force it already enough with the profile, you don't want to test for it everywhere, you don't want to hide output, tell me what you want, so I can make it, but I don't want module-init-tools forced in on LXC/xen/monolithic installs.
Comment 9 SpanKY gentoo-dev 2010-10-24 18:29:56 UTC
try reading the source.  modprobe doesnt care if module support doesnt exist in the kernel.  plus, the kernel always populates /sys/kernel/modules/ which is largely what the tools parse.
Comment 10 William Hubbs gentoo-dev 2010-11-14 22:09:07 UTC
Does it make sense to add -xenu to the keyword line in the depend function in the modules init script so that the script will not run for xenu installs to begin with (I'm taking this idea from -lxc already being there)?
Comment 11 Diego Elio Pettenò (RETIRED) gentoo-dev 2010-11-15 00:54:37 UTC
Not really. You _can_ run a domU-kernel with modules (albeit it makes little sense IMHO); you _cannot_ use different kernels with lxc guests.
Comment 12 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2011-01-17 08:14:02 UTC
vapier:
The point I see remaining here is that OpenRC should work without the module-init-tools package installed.

Instead of hiding the modprobe output, I think it just shouldn't be called if not present. We don't depend on it anywhere per-se, we just try the modprobe calls in case the user has a modular system.

Alternatively, we introduce a variable like RC_NEVER_MODPROBE or something.
Comment 13 SpanKY gentoo-dev 2011-01-17 09:58:10 UTC
openrc does work fine if m-i-t isnt installed.  Diego is merely concerned with the harmless warnings at boot time along the lines of "modprobe: command not found".

if you really want to waste time on this, then make a wrapper function like "rc_modprobe".  openrc isnt the only init.d package that attempts to modprobe.

rc_modprobe()
{
    type modprobe >/dev/null 2>&1 || return 1
    modprobe -q "$@"
}
Comment 14 SpanKY gentoo-dev 2011-01-17 09:58:59 UTC
Comment on attachment 251773 [details, diff]
Alternative approach

most of the changes in here actually break the initial sanity checks
Comment 15 nzqr 2012-05-09 11:58:31 UTC
Now openrc should depend on virtual/modutils, please fix this.
Comment 16 SpanKY gentoo-dev 2012-05-17 04:07:47 UTC
(In reply to comment #15)

no, it shouldn't.  please read the bug rather than drive by spamming.
Comment 17 William Hubbs gentoo-dev 2015-04-20 18:52:56 UTC
@flameeyes:
I haven't forgotten about this bug.

The fix I'm thinking of won't happen in 0.14, but I'm seriously
considering going a completely different direction in 0.15.

I'm considering moving the modules service to the sysinit runlevel and
making it the very first service we run when we boot.

If I can do that, I believe I can remove all other modprobe calls from
OpenRC.

Thoughts?
Comment 18 William Hubbs gentoo-dev 2016-05-13 17:22:13 UTC
*** Bug 582830 has been marked as a duplicate of this bug. ***
Comment 19 William Hubbs gentoo-dev 2016-05-13 17:30:50 UTC
I am going to take a look at this again. My current idea is still the
same, putting modules in sysinit and making it the very first service to
run.
Comment 20 William Hubbs gentoo-dev 2016-08-17 16:37:06 UTC
Since we have the want dependency now, I'm thinking I can modify the
services that use modprobe directly to have "want modules" in their
dependencies and also move toward deprecating the use of modprobe in the
services by warning that the modules they load should be configured in
/etc/conf.d/modules or built in.
Comment 21 William Hubbs gentoo-dev 2016-08-19 16:47:14 UTC
http://github.com/openrc/openrc/commit/73cdf10

This will be included in openrc-0.22.

The idea here is to start warning the admin to reconfigure their kernel
or set up /etc/conf.d/modules to include the appropriate modules. The
next step will be to drop the modprobe calls in 1.0.