2

Is there a resource on the internet, where I can download a single file I need in my ubuntu server install?

In this case, I need a clean version of /etc/grub.d/00_header for Ubuntu server 12.04. There are other times I would like to get a clean version of a file, for a specific linux version.

Besides installing ubuntu again somewhere else, and copying the file from there, how would I go about getting the file I need?


I did an apt-get upgrade in the hopes of a new version of grub replacing the problematic version, and get this error. As I understand it, the updated grub should replace the old one (I chose to use the package maintainers version of /etc/defualt/grub) and so the errors it has after parsing are to do with the new grub version, not my local version. Is that correct?

Replacing config file /etc/default/grub with new version                                                                                                                             
/usr/sbin/grub-setup: warn: Sector 32 is already in use by FlexNet; avoiding it.  This software may cause boot or other problems in future.  Please ask its authors not to store data in the boot track.
/usr/sbin/grub-setup: warn: Sector 33 is already in use by FlexNet; avoiding it.  This software may cause boot or other problems in future.  Please ask its authors not to store data in the boot track.
Installation finished. No error reported.
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.2.0-29-generic-pae
Found initrd image: /boot/initrd.img-3.2.0-29-generic-pae
Found linux image: /boot/vmlinuz-3.2.0-25-generic-pae
Found initrd image: /boot/initrd.img-3.2.0-25-generic-pae
Found linux image: /boot/vmlinuz-3.2.0-23-generic-pae
Found initrd image: /boot/initrd.img-3.2.0-23-generic-pae
Found memtest86+ image: /boot/memtest86+.bin
error: syntax error.
error: Incorrect command.
error: syntax error.
error: line no: 32
Syntax errors are detected in generated GRUB config file.
Ensure that there are no errors in /etc/default/grub
and /etc/grub.d/* files or please file a bug report with
/boot/grub/grub.cfg.new file attached.
done
Billy Moon
  • 1,417
  • 3
  • 17
  • 23

2 Answers2

5

While @cjc offers a low-level approach for general files provided by your package management, there's a neater way for configuration files. Key here is the --force-confmiss option as explained in answers to this question.

Here's an example for the file /etc/dnsmasq.conf.

Determine the binary package it belongs to

run for example for /etc/dnsmasq.conf

# dpkg -S /etc/dnsmasq.conf
dnsmasq: /etc/dnsmasq.conf

which means you'll have to acquire the dnsmasq package.

Download the right .deb package

for example:

$ aptitude download dnsmasq
Get:1 http://ftp.nl.debian.org/debian/ squeeze/main dnsmasq all 2.55-2 [14.2 kB]
Fetched 14.2 kB in 0s (190 kB/s)

$ ls
dnsmasq_2.55-2_all.deb

Let dpkg replace the file you want

First remove the file you need to get reset to default.

# rm /etc/dnsmasq.conf
# dpkg -i --force-confmiss dnsmasq_2.55-2_all.deb
gertvdijk
  • 3,362
  • 4
  • 30
  • 46
3

Grab the deb file for that file. It's in the grub-common package. Once you have it, you can run dpkg-deb to extract the package.

So, something like:

$ wget http://us.archive.ubuntu.com/ubuntu/pool/main/g/grub2/grub-common_1.99-22ubuntu2_i386.deb`
$ mkdir tmp
$ dpkg-deb -x grub-common_1.99-22ubuntu2_i386.deb ./tmp
$ ls tmp/etc/grub.d/
00_header        10_linux         30_os-prober     41_custom        
05_debian_theme  20_linux_xen     40_custom        README           
cjc
  • 24,533
  • 2
  • 49
  • 69