DH_INSTALLNSS(1)
π DH_INSTALLNSS π
okay so bestie, this is dh_installnss(1) from the User Contributed Perl Documentation section of the manual. it's a whole manual page, she's got lore, she's got range, and she's about to make your /etc/nsswitch.conf look right. π
β¨ NAME β¨
dh_installnss β enable NSS services π¦
πΈ SYNOPSIS πΈ
dh_installnss [debhelper options]
π DESCRIPTION π
so dh_installnss is a debhelper program and her whole job, her entire purpose, her main character moment, is injecting NSS (that's Name Service Switch, iykyk) services into /etc/nsswitch.conf. that's it. that's the gig. π
π FILES π
debian/package.nssβ this file lists the services to inject into/etc/nsswitch.confwhen a package is configured, and the ones to remove when a package is removed or purged. bestie behaviour fr fr.
every line in that file (we call each one a directive) should look like this:
db position service action condition
and here's what each field is actually saying:
dbβ the NSS database where the service is gonna get added. usually it's"hosts". classic.positionβ where to add the NSS service.
the possible values are "first", "last", "before=service", "after=service", plus these three pseudo-positions: "remove-only", "database-add" and "database-require".
the pseudo-position "remove-only" is for marking services that are NOT gonna be added when the package installs, but WILL be removed when it deinstalls (think legacy services, the exes that never leave π« ).
the pseudo-position "database-add" is used to request adding a non-standard NSS database to /etc/nsswitch.conf during the package's installation, and removing it during deinstallation. β οΈ when you use "database-add", every other field in the directive should be left empty. no extras, she's minimalist.
the pseudo-position "database-require" is announcing that one or more services in the nss file are gonna be installed under a non-standard NSS database that some other package added. β οΈ when you use "database-require", again, all the other fields in the directive should be left empty.
serviceβ the name of the NSS service to add. iconic, no notes.actionβ optional action specification, and it looks like"[STATE=ACTION]".conditionβ optional set of conditions that better define when a service should (or should not) get installed.
only one kind of condition is defined right now: "skip-if-present=service,service,...".
also, literally anything between a # character and the end of the line gets ignored. comments, we love her. π
π EXAMPLES π
an example debian/nss file could look like this:
hosts before=dns mdns4
hosts before=mdns4 mdns4_minimal [NOTFOUND=return]
hosts remove-only mdns # In case the user manually added it
so after this package installs, the original configuration of the hosts database in /etc/nsswitch.conf changes from:
hosts: files dns
to:
hosts: files mdns4_minimal [NOTFOUND=return] mdns4 dns
the glow up is REAL. β¨
β οΈ CAVEATS β οΈ
π Non-standard NSS databases π
okay this is the serious part, listen up bestie, no cap:
directives in a package.nss file can reference a non-standard NSS database only if that database has first been declared with a "database-add" or "database-require" directive in the same file. same file. don't try it anywhere else.
and what counts as a non-standard NSS database? it's all databases that are not defined in /etc/nsswitch.conf as shipped by the package base-files. that's the line.
if a directive references an undeclared non-standard NSS database (like"somedb"),dh_installnsswill exit with the error message"Unknown NSS database 'somedb'". π
a non-standard NSS database can be declared by at most one installed package. in other words: if the directives in the nss files of two packages, A and B, reference the same non-standard NSS database "somedb", and both packages can be installed at the same time, you gotta implement one of these two solutions:
- Package A supplies the
"somedb database-add"directive, package B Pre-Depends on A and uses a"somedb database-require"directive. - The shared package C supplies the
"somedb database-add"directive, both package A and B Pre-Depend on C and use a"somedb database-require"directive.
pick one, don't freestyle it. π
π SEE ALSO π
debhelper(7)- this program is a debhelper addon. periodt.
π AUTHOR π
Gioele Barabucci <gioele@svario.it> β the icon who wrote this, we stan π«Ά
and that's a wrap, my love π this page is from perl v5.40.1, dated 2025-12-08, and you're officially NSS-pilled now. go forth and slay your nsswitch.conf. π¦β¨π
π¦ where this page comes from
- ubuntu resolute: dh-nss 1.7build1 Β· 0BSD
- ubuntu stonking: dh-nss 1.7build1 Β· 0BSD
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms