is it possible to permanently add some option in “grub.cfg” to the “linux” command line?
I noticed that changes there are overwritten by core updates. So is there something like a “local override” mechanism or any othe way that I can make additions permanent?
You need to make changes in:
Such changes will be incorporated in grub.cfg next time there is a kernel upgrade in a core update.
Thanks, and these files are not overwritten by an update?
I think they probably will, but I am not 100% sure. Another way would be to add
/var/ipfire/backup/include.user and restore your config after the update. See the wiki entry for the backup system.
EDIT: this is an embarrassingly stupid idea, as described by @bonnietwin in a post #5 to this thread.
These will be overwritten if grub is updated in a core update as those files are part of the grub rootfile set.
You would need to be careful with this. grub.cfg is a file that is created anew by grub-mkconfig every time a kernel update is done. I am not sure what might happen if you copied back a grub.cfg from an earlier version of IPFire into one with a new kernel.
Even if it does work then doing this will mean that any improvements, changes done to the grub system will never be available on your system as the restore will replace the grub.cfg with an older based version.
Your best bet would be to add your option into /etc/default/grub after any core update, if it is needed, and run
grub-mkconfig -o /boot/grub/grub.cfg
You could probably create a script that you would run after a core update has been done that checks if your option is still present or not and runs the grub-mkconfig command if needed.
What is your opinion on writing a script called by
rc.local at boot time that checks
/etc/default/grub for the presence of those modifications, if absent it adds them, then it calls
grub-mkconfig and then reboot?
Do you see any problem with this approach?
That would seem a reasonable approach to me and would be what I would try out if I needed it.
I can’t see any problems with it but I am just a hobbyist in computing so I could be wrong.
It would be good if other more experienced people could confirm this approach as being the best way.
/etc/default/grub will not overwritten because it is excluded to prevent this. (It contain the config if serial consoles are used or not.)
That’s good to know. That makes the situation for @chrisk1 much easier.