9

I'm currently working on a project that needs kernel boot parameters added during a custom adapted Ubuntu installer (based on 14.04.3).

I know that

  • they belong into GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub.
  • one can add configuration files to /etc/default/grub.d in order to influence the generation of /etc/default/grub.
  • the default grub seems to be available as /usr/share/grub/default/grub.
  • grub-mkconfig then takes the scripts from /etc/grub.d and settings from /etc/default/grub and generates /boot/grub/grub.cfg.

My current problem is the following: Two of my packages and mdadm place files into /etc/default/grub.d, all of them altering GRUB_CMDLINE_LINUX_DEFAULT. But for some reason, one of my files gets ignored. And I can't really find when or by what /etc/default/grub is created initially created or how I could regenerate it.

2
  • 1
    Are both files executable? grub-mkconfig sources for executable files in grub.d.
    – muru
    May 19, 2016 at 12:46
  • Actually none of the three are executable. AFAIK, grub-mkconfig searches in /etc/grub.d but not /etc/default/grub.d.
    – Hurzelchen
    May 19, 2016 at 12:50

2 Answers 2

3

/etc/default/grub is created by the grub-pc post-installation script. You can probably regenerate in using

dpkg-reconfigure grub-pc

although I haven't tested it.

2
  • It looks like it does half the job... I removed /etc/default/grub and ran dpkg-reconfigure grub-pc which didn't re-create /etc/default/grub but somehow /boot/grub/grub.cfg with the parameters from all 3 cfg files.
    – Hurzelchen
    May 19, 2016 at 15:10
  • 1
    you'll need to force the recreation of the deleted configuration file using UCF_FORCE_CONFFMISS=Yes dpkg-reconfigure grub-pc
    – user448115
    May 19, 2016 at 16:45
3

Nowadays another way is to rename current /etc/default/grub and restore it to default with

sudo cp /usr/share/grub/default/grub /etc/default/grub
1
  • That's a bingo!
    – Déjà vu
    Dec 20, 2022 at 17:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .