Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to figure out how to reinstall/get copies of the scripts that Ubuntu has in the /etc/grub.d/ folder. The scripts have names like 00_header and 05_debian_theme. They're used when the command update-grub is run, to generate the Grub2 menu listing.

I was playing around with some customization stuff, and accidentally deleted all of the scripts (well, actually I deliberately deleted them, assuming that reinstalling the grub-pc package would replace them. Bad assumption!)

Does anyone know how to reinstall all the default Grub2 scripts that Ubuntu 12.04 ships with? Or, failing that, can someone point me to a resource to get the contents of the scripts? (I'm plenty willing to copy-paste them in...I don't want to have to reinstall all of Ubuntu for this silly mistake.)

share|improve this question
up vote 1 down vote accepted

Removing and reinstalling grub2-common should do the trick. Try:

sudo apt-get purge grub2-common
sudo apt-get install grub2-common

In general, you can find what files a package installs either through Synaptic (Right click on a package => Properties => Installed Files), or by running dpkg -L <package_name>.

In your case, you know that it has to be one of the grub related packages and you need to know which one installed 00_header, for example. First, list all grub related packages, then search for 00_header in the list of files that each of them installs:

  1. Find what grub related packages are installed:

    $ dpkg -l grub* | grep ii
  2. Find which of them installs 00_header :

    $ for n in $(dpkg -l grub* | grep ii | awk '{print $2}'); do echo  "$n :  `dpkg -L $n | grep 00_`"; done
share|improve this answer
Awesome! That did it. (Also, I bow to your shell-fu! I wish I had your level of bash wizardry.) – Isaac Dontje Lindell Aug 22 '12 at 2:51
Glad to hear it worked @IsaacDontjeLindell. As for shell-fu, use linux for work and play for more than a decade or so and it creeps up on you :) – terdon Aug 22 '12 at 3:00

You must log in to answer this question.

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