Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
cmd line vs /etc/modprobe.d precedence
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Sat Mar 20, 2021 4:18 pm    Post subject: cmd line vs /etc/modprobe.d precedence Reply with quote

Greetings,

I'm trying to determine precedence of setting module's option via cmd line or /etc/modprobe.d but I'm unable to find info regarding it.
my assumption is that incase it isn't build-in /etc/modprobe.d takes precedence.

anyone knows?
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54236
Location: 56N 3W

PostPosted: Sat Mar 20, 2021 8:50 pm    Post subject: Reply with quote

DaggyStyle,

/etc/modprobe.d is processed by the modules service which is in the boot runlevel.
That means its done its stuff before you can log in.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2006

PostPosted: Sun Mar 21, 2021 10:41 am    Post subject: Reply with quote

Neddy, IIUC that might be the right answer to the wrong question! Depends on which cmd line DaggyStyle is talking about.

Reading the kernel docs on the command line (which I assume is what DaggyStyle is asking about), it says
Quote:
Parameters for modules which are built into the kernel need to be specified on the kernel command line. modprobe looks through the kernel command line (/proc/cmdline) and collects module parameters when it loads a module, so the kernel command line can be used for loadable modules too.

I'd hope that overrode modprobe.d, not least because it should happen to modules loaded before the kernel can even access modprobe.d! And surely the purpose of command line overrides is to, ahem, override.

Of course, if you mean parameters on a terminal command line, I guess you're typing "modprobe <module> <overrides>", in which case the man text doesn't say, but I'd be very unhappy if modprobe.d overrode my overrides!
_________________
Greybeard
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54236
Location: 56N 3W

PostPosted: Sun Mar 21, 2021 10:59 am    Post subject: Reply with quote

Goverp,

Thank you. I hadn't even thought about the kernel command line.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1530
Location: South America

PostPosted: Sun Mar 21, 2021 1:55 pm    Post subject: Reply with quote

Looking at libkmod's code, it seems that module options from the kernel command line are appended to those specified in /etc/modprobe.d/*.config files, so I'd expect the former to take precedence.
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Mon Mar 22, 2021 4:20 pm    Post subject: Reply with quote

thank you all for the answers, basically what I need is the ability to override the ids option values if vfio-pci module is is loaded at later stage.
question is, will setting it in the cmdline will work?
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1530
Location: South America

PostPosted: Tue Mar 23, 2021 1:31 am    Post subject: Reply with quote

If the option is specified in the kernel command line (vfio-pci.ids=whatever), it should get passed when the module loads.
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Tue Mar 23, 2021 8:21 am    Post subject: Reply with quote

GDH-gentoo wrote:
If the option is specified in the kernel command line (vfio-pci.ids=whatever), it should get passed when the module loads.

thus overriding the entry in /etc/modprobe.d/vfio.conf?
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2006

PostPosted: Tue Mar 23, 2021 10:18 am    Post subject: Reply with quote

Why not try it and report back?
_________________
Greybeard
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1530
Location: South America

PostPosted: Tue Mar 23, 2021 2:49 pm    Post subject: Reply with quote

DaggyStyle wrote:
thus overriding the entry in /etc/modprobe.d/vfio.conf?
If a file in /etc/modprobe.d contains:
Code:
options vfio-pci ids=value1

and this was specified in the command line:
Code:
vfio-pci.ids=value2

if I understood libkmod's code correctly, at the time of module load (by an OpenRC service calling modprobe, by the udev daemon, which also links to libkmod, etc.) the behaviour is as if this command was used:
Code:
modprobe vfio-pci ids=value1 ids=value2
What happpens when the module's code sees the same option twice depends on the module, I guess.

Goverp wrote:
Why not try it and report back?
Indeed, it's the best way to now if it works :)
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Tue Mar 23, 2021 4:40 pm    Post subject: Reply with quote

Goverp wrote:
Why not try it and report back?

the system in question is a production server, I cannot take it down to test
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54236
Location: 56N 3W

PostPosted: Tue Mar 23, 2021 5:03 pm    Post subject: Reply with quote

DaggyStyle,

You need to test it somewhere before you deploy to production.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum