Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to restore LightDM to its default state, because for some reason
/etc/lightdm/unity-greeter.conf is now an empty file.

Deleting /etc/lightdm/unity-greeter.conf and then running sudo apt-get install --reinstall unity-greeter doesn't create a new config file as you might expect.

How can I restore a missing config file?

share|improve this question
up vote 87 down vote accepted
  1. Find out what package installed the config file:

    $ dpkg -S unity-greeter.conf
    unity-greeter: /etc/lightdm/unity-greeter.conf

    As you can see, the name of the package is unity-greeter.

  2. Rename (or delete) the config file you wish to restore:

    sudo mv -i /etc/lightdm/unity-greeter.conf /etc/lightdm/unity-greeter.conf.bak 
  3. 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>
  4. If everything worked as expected, you should get this message:

    Configuration file `/etc/lightdm/unity-greeter.conf', does not exist on system. 
    Installing new config file as you requested.
  5. A Practical example when needing to reinstall all of the PulseAudio configuration files:

    apt-cache pkgnames pulse |xargs -n 1 apt-get -o Dpkg::Options::="--force-confmiss" install --reinstall 
share|improve this answer
Thank you; I have been wondering about this for years. It should really be easier to specify, though - is there a bug open somewhere for that? – Glyph Oct 11 '12 at 5:35
With --force-confask you could remove step 2. – bukzor Nov 30 '13 at 4:36
I converted this answer to a little script: – eegg Apr 12 '14 at 17:45
An extra benefit of --force-confask without deleting is that it offers to show the diff between your changes and the original. – anps Nov 10 '14 at 7:39
Not tested with Ubuntu, but under Debian to restore config files which are managed by ucf the --force-confmiss option won't work, you have to use sudo UCF_FORCE_CONFFMISS=1 apt-get --reinstall install [pkgname]. – Skippy le Grand Gourou Feb 23 '15 at 18:06

According to this thread on the Ubuntu Forums, it's as simple as running the following in a terminal:

sudo dpkg-reconfigure lightdm

share|improve this answer
I ran that command and this was the output: dpkg-maintscript-helper: warning: environment variable DPKG_MAINTSCRIPT_NAME missing dpkg-maintscript-helper: warning: environment variable DPKG_MAINTSCRIPT_PACKAGE missing. LightDM wasn't restored to its original configuration either. – Alvin Row Oct 14 '11 at 23:57
@DoR: Hm... that's odd. Is reinstalling the package an option. – Nathan Osman Oct 14 '11 at 23:57
I reinstalled it (sudo apt-get --reinstall install lightdm) and still /etc/lightdm/unity-greeter.conf is empty. – Alvin Row Oct 15 '11 at 1:21
This is common advice, but it is definitely wrong; it doesn't work for most cases I've tried it on. – Glyph Oct 11 '12 at 5:35

Delete (back) the file and and reinstall unity-greeter with apt-get install --reinstall unity-greeter.

share|improve this answer
This doesn't restore the configuration files. – starbeamrainbowlabs Jan 11 at 16:33

Your Answer


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.