You are not logged in.

#1 2020-09-21 17:50:40

tapt65
Member
Registered: 2020-09-21
Posts: 1

Put Grub Parameters in multiple files

Hello,

currently I have the following parameters in my Grub configuration:

mem_sleep_default=deep intel_iommu=on iommu=pt loglevel=3 rd.systemd.show_status=auto rd.udev.log_priority=3 apparmor=1 lsm=lockdown,yama,apparmor

Is there a way to split these parameters into multiple files? e.g. like

/etc/modprobe.d/i915.conf

Thanks in advance

Offline

#2 2020-09-21 22:06:08

solskog
Member
Registered: 2020-09-05
Posts: 462

Re: Put Grub Parameters in multiple files

Well, you can always write a shell script that parse several /etc/grub.d/*.conf files and create a /etc/default/grub for you, before generating a final /boot/grub/grub.cfg.

Last edited by solskog (2020-09-21 22:08:24)

Offline

#3 2020-09-22 02:13:07

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Put Grub Parameters in multiple files

tapt65 wrote:

Hello,

currently I have the following parameters in my Grub configuration:

mem_sleep_default=deep intel_iommu=on iommu=pt loglevel=3 rd.systemd.show_status=auto rd.udev.log_priority=3 apparmor=1 lsm=lockdown,yama,apparmor

Is there a way to split these parameters into multiple files? e.g. like

/etc/modprobe.d/i915.conf

Thanks in advance

"why would you ever want to do that"

...

grub.cfg supports the "source" command: https://wiki.archlinux.org/index.php/Us … _reference
So you may source files in turn, and use them to append to a $cmdline variable. Eventually you'll pass the $cmdline variable as an argument to the "linux" command (specifies a kernel specification to boot into).


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#4 2020-09-22 03:13:42

solskog
Member
Registered: 2020-09-05
Posts: 462

Re: Put Grub Parameters in multiple files

eschwartz wrote:

grub.cfg supports the "source" command:

Yes, I agree. The difference is the "source" occurs at runtime, a typo could result unbootable system. A predefined /etc/default/grub will be checked by grub-mkconfig.

Offline

#5 2020-09-22 03:21:30

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Put Grub Parameters in multiple files

Hardly unbootable. The grub boot menu is interactive and lets you run arbitrary grub commands to boot manually.

You're unlikely to find real syntax errors unless you use grub-mkconfig, which is a hodgepodge of hideous complexity. The link I gave includes an example 6-line grub.cfg which is easily vetted.

You should also just be using `grub-script-check /path/to/grub.cfg` to verify for correctness.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#6 2020-09-22 07:06:40

ondoho
Member
Registered: 2013-04-30
Posts: 692
Website

Re: Put Grub Parameters in multiple files

tapt65 wrote:

e.g. like

/etc/modprobe.d/i915.conf

I think what OP means (and here I am playing the guessing game myself) is that module settings can be put in /etc/modprobe.d, instead of the kernel command line. That is certainly correct.
Whether this applies to the kernel command options in post #1, I do not know. OP probably knows best because they put them there.

edit:
I agree that there's no pressing reason to do this; probably best to not fix what is not broken.

Last edited by ondoho (2020-09-22 07:08:03)

Offline

#7 2020-09-22 08:32:23

solskog
Member
Registered: 2020-09-05
Posts: 462

Re: Put Grub Parameters in multiple files

mem_sleep_default=deep intel_iommu=on iommu=pt loglevel=3 rd.systemd.show_status=auto rd.udev.log_priority=3 apparmor=1 lsm=lockdown,yama,apparmor

I think these are builtin kernel parameters that can't be placed in /etc/modprob.d/, which is for loadable kernel modules, unless recompile the kernel.
However sysctl could be used to change builtin kernel parameters att runtime inside /etc/sysctl.d/ and /usr/lib/sysctl.d/.
https://wiki.archlinux.org/index.php/Sysctl

Last edited by solskog (2020-09-22 09:16:04)

Offline

#8 2020-09-22 10:22:12

loqs
Member
Registered: 2014-03-06
Posts: 19,043

Re: Put Grub Parameters in multiple files

mem_sleep_default=deep

Runtime control by /sys/power/state

intel_iommu=on iommu=pt  apparmor=1 lsm=lockdown,yama,apparmor

I believe these options can only be set / changed at boot

rd.systemd.show_status=auto rd.udev.log_priority=3

Modifies behavior of systemd and udev during early boot.

loglevel=3

sysctl variable kernel.printk

Offline

#9 2020-09-22 11:32:02

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Put Grub Parameters in multiple files

The OP's goal as stated is to take parameters in grub configuration and "split these parameters into multiple files", nothing has been said about moving them out of grub.

If the OP wishes for a different answer, the goal must be redefined.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#10 2020-09-22 12:48:08

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,648

Re: Put Grub Parameters in multiple files

Let's wait for the OP to come back and tell us if any of the posted answers are what they are looking for (or define the goal more clearly) before we do any more speculation.

Offline

#11 2020-10-02 20:29:19

ondoho
Member
Registered: 2013-04-30
Posts: 692
Website

Re: Put Grub Parameters in multiple files

...and OP never even logged in anymore after that initial post.
I'm seeing this often; is it a particular form of spamming or trolling? Or are so many people so short-lived?

Offline

Board footer

Powered by FluxBB