Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

4 Answers 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
share|improve this answer
sudo dpkg-reconfigure packageName

In your case:

sudo dpkg-reconfigure pptpd
share|improve this answer
1  
This doesn't always work, especially in this case, giving the error Starting PPTP Daemon: /etc/pptpd.conf: No such file or directory pptpd. –  izx Jul 13 '12 at 23:32
    
but this command can execute the scripts that are part of the package –  user827992 Jul 13 '12 at 23:34
    
Yes, but it doesn't help if he deleted the files that came with the package :) reconfigure isn't going to find the deb and extract those files for him. –  izx Jul 13 '12 at 23:35

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.

share|improve this answer

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.

share|improve this answer
    
This doesn't seem to work. –  Glyph Oct 11 '12 at 5:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.