Check Debian Vendor Identity with dpkg-vendor
You will finish with a reliable way to ask which distribution vendor dpkg is using, test whether that vendor derives from Debian, and read vendor-specific fields. The examples use dpkg 1.22.6 from the installed dpkg-dev package.
The route
Jump straight to the step you need, or tick off Done means at the end.
Allow about ten minutes. You need a shell and an installed dpkg-vendor command. The normal workflow is read-only and does not need sudo. Editing files under /etc/dpkg/origins is a separate system configuration change, so this guide does not ask you to do it.
1. See the command contract
Start by checking the installed command and its version:
$ command -v dpkg-vendor
/usr/bin/dpkg-vendor
$ dpkg-vendor --version
Debian dpkg-vendor version 1.22.6.
The command has three useful queries: --is tests the current vendor, --derives-from walks its Parent chain, and --query prints a field. The command writes the field value for --query, but the two tests communicate their result through the exit status.
Checkpoint: if the version is different, keep the installed manpages nearby while checking details. Distribution packages can backport changes, and this guide's observed output is from dpkg 1.22.6.
2. Query the current vendor
Run the simplest query:
$ dpkg-vendor --query Vendor
Ubuntu
With no override, dpkg-vendor discovers the current vendor from /etc/dpkg/origins/default. On this machine that file contains Vendor: Ubuntu, along with a vendor URL, a Launchpad bug address, and Parent: Debian. Your result can be different on Debian, a derivative, or a customised installation.
You can query any field present in the selected origin file. For example:
$ dpkg-vendor --query Vendor-URL
http://www.ubuntu.com/
An empty or unknown field is not a useful identity check. Use --query Vendor when the script needs the name, and treat other fields as optional metadata supplied by the vendor file.
3. Use exit statuses for decisions
Use --is in an if statement instead of parsing output:
if dpkg-vendor --is Ubuntu; then
printf '%s\n' 'Ubuntu vendor selected'
else
printf '%s\n' 'Another vendor selected'
fi
The command exits with status 0 when the current vendor matches and status 1 otherwise. A non-match is an ordinary result, not necessarily a command failure. If you need to inspect the status manually, run the test and print $? immediately:
$ dpkg-vendor --is Debian
$ printf 'status=%s\n' "$?"
status=1
$ dpkg-vendor --is Ubuntu
$ printf 'status=%s\n' "$?"
status=0
Do not place another command between the test and the status check. In a script, an if statement avoids that distraction and keeps the non-match branch explicit.
4. Test distribution ancestry
A derivative can have its own vendor name while still deriving from another vendor. Ask for that relationship with --derives-from:
$ dpkg-vendor --derives-from Debian
$ printf 'status=%s\n' "$?"
status=0
$ dpkg-vendor --derives-from Ubuntu
$ printf 'status=%s\n' "$?"
status=0
On the example system, the first command succeeds because the current vendor is Ubuntu and its origin file names Debian as its parent. The second succeeds because a vendor derives from itself. A vendor with a longer parent chain is checked through all of those ancestors.
This is useful when a packaging rule applies to a Debian family rather than one vendor name. It is not a general guarantee of binary compatibility, repository layout, or support policy. Keep those decisions separate from this small metadata query.
5. Select a vendor without changing the system
For a one-off query, --vendor tells the command which origin file to use:
$ dpkg-vendor --vendor Debian --query Vendor
Debian
$ dpkg-vendor --vendor Debian --derives-from Debian
$ printf 'status=%s\n' "$?"
status=0
This does not change /etc/dpkg/origins/default, install a package, or make the host Debian. It only changes the vendor assumed for that invocation. The named vendor must have a matching file under /etc/dpkg/origins; otherwise the query cannot select it.
The DEB_VENDOR environment variable is another override:
$ DEB_VENDOR=Debian dpkg-vendor --query Vendor
Debian
When both are present, the explicit --vendor option wins:
$ DEB_VENDOR=Debian dpkg-vendor --vendor Ubuntu --query Vendor
Ubuntu
Checkpoint: if a script reports an unexpected vendor, inspect its environment and command line before editing any origin file:
printf 'DEB_VENDOR=%s\n' "${DEB_VENDOR-}<unset>"
dpkg-vendor --query Vendor
6. Understand the origin files
The files in /etc/dpkg/origins are small field-based records. A field starts with a tag such as Vendor: or Parent:, followed by its value. Lines beginning with # are comments. The recognised fields documented for this workflow are:
Vendor:, the required vendor name.Vendor-URL:, the vendor's web address.Bugs:, a mail or debbugs address describing the bug tracker.Parent:, the vendor from which this distribution derives.
The file name normally uses the vendor name in lower case. dpkg 1.22.6 also applies its documented name normalisation when looking up a vendor, including mapping initial non-alphanumeric characters to dashes. Do not rely on old naming tricks for new files: the manpage says the historical compatibility lookups are being removed during the dpkg 1.22.x release cycle.
If you administer a derivative and need to change this metadata, back up the relevant origin file before editing it and validate the result with dpkg-vendor --query Vendor and --derives-from. There is no undo operation built into dpkg-vendor; recovery means restoring the file you changed. The examples above avoid that state change entirely.
7. Handle common traps
Do not confuse the vendor with the kernel, architecture, or package repository. dpkg-vendor reads origin metadata. It does not detect every aspect of the running operating system and it does not verify that a repository is trustworthy.
Do not parse a human-facing vendor URL to infer the vendor name. Query Vendor directly. Do not use --derives-from as proof that a package is available, and do not treat a status 1 from --is as a broken command. If the command itself is missing, install or repair the package that supplies it using your normal package-management procedure; that is outside this read-only check.
Done means
dpkg-vendor --query Vendorreports the vendor you expected, or you have recorded why an override changes it.- Your script uses
--isor--derives-fromas an exit-status test rather than parsing text. - You know whether the answer came from the default origin file,
DEB_VENDOR, or--vendor. - You have not edited system metadata merely to answer a query.