How do you revert or reinstall a configuration file in Debian/Ubuntu?

I accidentally overwrote the file /etc/bluetooth/main.conf. Running dpkg -S /etc/bluetooth/main.conf shows that the package bluez provides it, but when I run sudo apt-get install --reinstall bluez, it doesn't get reinstalled.

  • Related (possibly dupe) unix.stackexchange.com/a/12748/4671 Apr 18, 2016 at 6:56
  • Lets turn this duplicate arround, this question deals with the more generic problem and has an answer that goes to the point solving the problem stated in the title.
    – Braiam
    Apr 1, 2021 at 11:28

2 Answers 2


You should mv the file out of the way:

mv /etc/bluetooth/main.conf /etc/bluetooth/main.conf.old
apt-get -o DPkg::options::=--force-confmiss --reinstall install bluez

I don't know if you can get apt to overwrite an existing config file, that's why you should move it out of the way first.


Solution 1

Run the following command, replacing package-name with the name of the package:

sudo apt-get -o Dpkg::Options::="--force-confmiss" install --reinstall package-name

Solution 2

If you have .deb package then go to that directory where package is exist and run,

dpkg -i --force-confmiss package-name.deb

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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