Saturday, May 4, 2024
217
rated 0 times [  217] [ 0]  / answers: 1 / hits: 163392  / 3 Years ago, tue, october 5, 2021, 3:29:55

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?


More From » package-management

 Answers
7

  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.



    If you deleted a directory, like /etc/pam.d, you can list every package that added to it by using the directory path:



    $ dpkg -S /etc/pam.d
    login, sudo, libpam-runtime, cups-daemon, openssh-server, cron, policykit-1, at, samba-common, ppp, accountsservice, dovecot-core, passwd: /etc/pam.d

  2. Run the following command, replacing <package-name> with the name of the package:



    sudo apt install --reinstall -o Dpkg::Options::="--force-confask,confnew,confmiss" <package-name>


    And for restoring the directory:



    sudo apt install --reinstall -o Dpkg::Options::="--force-confask,confnew,confmiss" $(dpkg -S /etc/some/directory | sed 's/,//g; s/:.*//')

  3. If everything worked as expected, you should get a message:



    Configuration file `/etc/lightdm/unity-greeter.conf', does not exist on system. 
    Installing new config file as you requested.

  4. 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 


[#43007] Tuesday, October 5, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
odenanno

Total Points: 207
Total Questions: 113
Total Answers: 94

Location: South Korea
Member since Sat, Oct 2, 2021
3 Years ago
odenanno questions
;