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?
Asked
Active
Viewed 3,332 times
5
Olivier Lalonde
- 57,431
- 62
- 125
- 146
-
The best way is a backup. Even better is to use a tool like `etckeeper` to keep your whole `/etc` folder under version control, which makes it easy to back out from a change (or accidental deletion) and which allows you to track down configuration changes that created problems. – 0xC0000022L Nov 22 '18 at 11:04
4 Answers
4
Is there a way to "checkout" a single file from a package?
Yes, it's easy with the dpkg-deb tool.
- Use
dpkg --list | grep pptpdto find your pptpd version. - Download the appropriate deb file from http://archive.ubuntu.com/ubuntu/pool/main/p/pptpd/
- 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
- Use the following to get a TAR file of the contents from which you can extract the files you need:
- You can mount the TAR in Nautilus to easily get to the file, or you can use command-line
tar. - 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.confis the default configuration file which comes with the package and is not created dynamically at install time, asdpkg-debwith the list switch-cdemonstrates:$ 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
- 138,666
- 36
- 303
- 312
1
sudo dpkg-reconfigure packageName
In your case:
sudo dpkg-reconfigure pptpd
Eliah Kagan
- 116,445
- 54
- 318
- 493
user827992
- 2,859
- 2
- 18
- 16
-
1This doesn't always work, especially in this case, giving the error `Starting PPTP Daemon: /etc/pptpd.conf: No such file or directory pptpd.` – ish 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. – ish Jul 13 '12 at 23:35
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,064
- 9
- 57
- 78
tumbleweed
- 7,986
- 23
- 36
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.
ImaginaryRobots
- 9,058
- 4
- 34
- 38