6

I tried to find out to which package /etc/nsswitch.conf belongs on my Debian machine, but dpkg --search /etc/nsswitch.conf won't tell me. Does anyone know?

4 Answers 4

8

This file belongs to the base-files package. You can use the following apt-file command to see to which package a file belongs:

sudo apt-get install apt-file
apt-file update
apt-file search nsswitch.conf

Check debian README files for explanation about some files in base-files package

cat /usr/share/doc/base-files/README

Q. After upgrading my system recently, I noticed that some files from base-files do not match the ones which are installed on a fresh install of squeeze. Should I not be warned about that?

A. Those files are configuration files, so they are completely under the control of the system admin. The files installed by base-files are just defaults. Changes in the default files are not important enough to warn the user, as it is also policy that prompting should be reduced to a minimum. This is also the reason they are not handled via dpkg's conffile mechanism.

In either case, if you want to "upgrade" those files, just look at the postinst for base-files (i.e. /var/lib/dpkg/info/base-files.postinst) and you will see how they are created and where their master copies are:

install_from_default /usr/share/base-files/nsswitch.conf /etc/nsswitch.conf
install_from_default /usr/share/base-files/dot.profile   /root/.profile
install_from_default /usr/share/base-files/dot.bashrc    /root/.bashrc
install_from_default /usr/share/base-files/profile       /etc/profile
install_from_default /usr/share/base-files/motd          /etc/motd

So, if you want your system to be as similar as possible to a newly installed squeeze system, you might want to sync these files manually.

0
6

dpkg --search do not show /etc/nsswitch.conf because it is not registered as conffile so it is a bit of a special case. For example dpkg -S /etc/deluser.conf can be used to identify package that owns /etc/deluser.conf file.
With path omitted dpkg --search nsswitch.conf actually show results.

I also like dlocate utility which is very helpful to find which package owns a file. dlocate is a faster alternative to dpkg -S.

apt-file is most useful to search for files in non-installed packages.

1
File                                    Packages
/usr/share/base-files/nsswitch.conf     base-files

I got this from https://packages.debian.org/index and searched under "contents"

0

Some fine answers here already, to which I only have a little to add, though too much, it seems, for a comment:

For me, four packages appear to have their fingers in this pie:

martind@swiftboat:~$ grep -l /etc/nsswitch.conf /var/lib/dpkg/info/*.postinst
/var/lib/dpkg/info/base-files.postinst
/var/lib/dpkg/info/libc-bin.postinst
/var/lib/dpkg/info/libnss-mdns:amd64.postinst
/var/lib/dpkg/info/libnss-myhostname:amd64.postinst
martind@swiftboat:~$

base-files offers more than libc-bin:

martind@swiftboat:~$ diff /usr/share/{libc-bin,base-files}/nsswitch.conf
9a10
> gshadow:        files
martind@swiftboat:~$

libnss-mdns adds mdns to the hosts line. libnss-myhostname adds myhostname there, with the potential promise to remove the need for /etc/hosts, if only that weren't the recommended way to get hostname --fqdn to work.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .