0

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
  • 10,515

1 Answers1

2
  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
  • 17,838
  • OK, for the second question. But, what about the first question? I was thinking that if some files (of a package) are deleted or corrupted, I can easily restore them by using the --reinstall option. – FedKad Nov 11 '23 at 19:50
  • 2
    @FedKad Take a look at this question. – mook765 Nov 11 '23 at 19:59
  • Thanks @mook765 for the pointer. So, in my case it is sudo apt install --reinstall -o Dpkg::Options::="--force-confask,confnew,confmiss" bash (and it worked!). I guess @ubfan1 can update the answer too. And, you can close my question as duplicate. – FedKad Nov 11 '23 at 20:05