View previous topic :: View next topic |
Author |
Message |
DaggyStyle Watchman
Joined: 22 Mar 2006 Posts: 5909
|
Posted: Sat Mar 20, 2021 4:18 pm Post subject: cmd line vs /etc/modprobe.d precedence |
|
|
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 |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54236 Location: 56N 3W
|
Posted: Sat Mar 20, 2021 8:50 pm Post subject: |
|
|
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 |
|
|
Goverp Advocate
Joined: 07 Mar 2007 Posts: 2006
|
Posted: Sun Mar 21, 2021 10:41 am Post subject: |
|
|
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 |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54236 Location: 56N 3W
|
Posted: Sun Mar 21, 2021 10:59 am Post subject: |
|
|
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 |
|
|
GDH-gentoo Veteran
Joined: 20 Jul 2019 Posts: 1530 Location: South America
|
Posted: Sun Mar 21, 2021 1:55 pm Post subject: |
|
|
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 |
|
|
DaggyStyle Watchman
Joined: 22 Mar 2006 Posts: 5909
|
Posted: Mon Mar 22, 2021 4:20 pm Post subject: |
|
|
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 |
|
|
GDH-gentoo Veteran
Joined: 20 Jul 2019 Posts: 1530 Location: South America
|
Posted: Tue Mar 23, 2021 1:31 am Post subject: |
|
|
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 |
|
|
DaggyStyle Watchman
Joined: 22 Mar 2006 Posts: 5909
|
Posted: Tue Mar 23, 2021 8:21 am Post subject: |
|
|
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 |
|
|
Goverp Advocate
Joined: 07 Mar 2007 Posts: 2006
|
Posted: Tue Mar 23, 2021 10:18 am Post subject: |
|
|
Why not try it and report back? _________________ Greybeard |
|
Back to top |
|
|
GDH-gentoo Veteran
Joined: 20 Jul 2019 Posts: 1530 Location: South America
|
Posted: Tue Mar 23, 2021 2:49 pm Post subject: |
|
|
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 |
|
|
DaggyStyle Watchman
Joined: 22 Mar 2006 Posts: 5909
|
Posted: Tue Mar 23, 2021 4:40 pm Post subject: |
|
|
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 |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54236 Location: 56N 3W
|
Posted: Tue Mar 23, 2021 5:03 pm Post subject: |
|
|
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 |
|
|
|