1

Thinking that the /etc/skel/.profile was modified, I tried to find which package provides this file:

$ dpkg -S  /etc/skel/.profile 
bash: /etc/skel/.profile
$ apt-file list bash | head
bash: /bin/bash
bash: /bin/rbash
bash: /etc/bash.bashrc
bash: /etc/skel/.bash_logout
bash: /etc/skel/.bashrc
bash: /etc/skel/.profile
bash: /usr/bin/bashbug
bash: /usr/bin/clear_console
bash: /usr/share/debianutils/shells.d/bash
bash: /usr/share/doc/bash/COMPAT.gz

So, I moved that file and tried:

$ sudo apt --reinstall install bash

However, the file /etc/skel/.profile was not recreated.

  1. Why is this so? I was thinking that if some files (of a package) are deleted or corrupted, I can easily restore them by using the --reinstall option.
  2. How can I bring back a missing file from a package that it provides?

Obviously, $ sudo apt purge bash ; sudo apt install bash is not an option in this very specific case!

FedKad
  • 13,420

1 Answers1

4
  1. From your comment, to force the reinstall:

    sudo apt install --reinstall -o dpkg::Options::="--force-confask,confnew,confmiss" bash

  2. You could get the source package, and grab the skel.profile from it.

    sudo apt-get source bash

The package is put into your current dir as a xz compressed tar file, extract the debian/skel.profile and rename to .profile in /etc/skel

ubfan1
  • 19,049