5

I have accidentally deleted a configuration file (/etc/pptpd.conf) and was wondering what would be the best way to recover the default configuration file that comes with the pptpd package. Is there a way to "checkout" a single file from a package?

4 Answers4

4

Is there a way to "checkout" a single file from a package?

Yes, it's easy with the dpkg-deb tool.

  1. Use dpkg --list | grep pptpd to find your pptpd version.
  2. Download the appropriate deb file from http://archive.ubuntu.com/ubuntu/pool/main/p/pptpd/
  3. For convenience in this example, we'll assume the name is pptpd.deb
    • Use the following to get a TAR file of the contents from which you can extract the files you need:
      dpkg-deb --fsys-tarfile pptpd.deb > pptpd.tar
  4. You can mount the TAR in Nautilus to easily get to the file, or you can use command-line tar.
  5. Alternatively, instead of converting to a TAR file, you can directly extract the deb to a directory with:
    mkdir pptpd-temp && dpkg-deb -x pptpd.deb pptpd-temp
    

Note: in this case, pptpd.conf is the default configuration file which comes with the package and is not created dynamically at install time, as dpkg-deb with the list switch -c demonstrates:

$ dpkg-deb -c pptpd_1.3.4-5ubuntu2_amd64.deb | grep conf
  -rw-r--r-- root/root      2247 2012-03-01 22:03 ./etc/pptpd.conf
ish
  • 141,990
1
sudo dpkg-reconfigure packageName

In your case:

sudo dpkg-reconfigure pptpd
Eliah Kagan
  • 119,640
user827992
  • 2,901
0

By far the easiest way is to run in terminal, one line at a time:

sudo apt-get purge pptpd
sudo apt-get install pptpd

This purges the install of pptpd (including configuration files) and then the second line re-installs.

Mateo
  • 8,152
tumbleweed
  • 8,106
0

Another option for getting the files back, which is a bit less drastic than a remove/purge:

sudo apt-get install --reinstall ppptd

That will re-download the package and should restore any missing files.