[lsb-discuss] New uname option to query exact OS distribution

Markus Kuhn Markus.Kuhn at cl.cam.ac.uk
Sun Aug 22 11:52:15 PDT 2004

Feature proposal for POSIX uname:

At present, the 'uname -o' command simply gives GNU/Linux for any of the
many Linux distributions. Since these distributions differ often very
significantly, it would be useful if uname could also identify the OS
distribution and version that it came with. I believe, the granularity
of the fields provided traditionally by uname is no longer sufficient
and additional fields are necessary to distinguish between exact
distribution variants of the same operating system. The presence of the
lsb_release in the LSB Core specification is an indication that uname as
currently defined by POSIX no longer fulfills its role adequately.

I propose to review uname and extend it appropriately such that other
new non-POSIX OS identification mechanisms such as lsb_release become
unnecessary. As a start, I suggest to add new command line options to
uname to distinguish between operating system distributions:

For example, this could look like:

$ uname -d
SuSE Linux Professional 9.1 (DVD 32-bit)
$ uname -d
Red Hat Linux 9

The information could be split up further into four fields:

  - DISTRIB_VENDOR. This is the commonly used colloquial shortname of
    the vendor or organization that prepared the installable OS
    distribution. Colloquial should mean that this name should be free
    of legal designators (i.e. use "Sun" and not "Sun Microsystems Inc.").
    (e.g. "SuSE", "Red Hat", "Novell", "Sun", "IBM", "Mandrake", "Debian")

  - DISTRIB_PRODUCT: This is the product name, without the vendor
    name (which typically precedes it immediately), and also without the
    version number (which typically follows immediately afterwards).
    (e.g. "Linux", "Linux Professional", "Enterprise Server",
    "Terminal Server", "Home Edition")

  - DISTRIB_RELEASE: Typically a dot-separated list of integer
    numbers. Where this is a release date instead of a version number,
    the ISO 8601 notation should be used.
    (e.g., "8", "9.1", "2004-12-31")

  - DISTRIB_ATTRIBUTES (optional): This is a list of optional attributes
    such as CPU type, installation source medium, regional variant, etc.
    that distinguish several available variants of the same product version.
    The individual attribute in this list should not contain any whitespace
    or parenthesis and should be separated by a single whitespace.
    (e.g., "DVD 32-bit", "FTP i586", "CD Amiga nocrypto")

These fields can be made individually accessable:

$ uname -d
SuSE Linux Professional 9.1 (DVD 32-bit)
$ uname -dv
$ uname -dp
Linux Professional
$ uname -dr
$ uname -da
DVD 32-bit

The suggested output format is very simple:





Note: I deliberately did not include in this proposal an extra field for
a release code name (as can be queried via 'lsb_release -c'). Most
vendors do not use or publish such release project code names. They also
add no information beyond DISTRIB_RELEASE and lack the temporal ordering
implied by a version number.

Suggested implementation for uname in GNU coreutils:

There is little point in trying to autodetect this, as there is no
portable and predictable way yet to find out this information (uname -d
is meant to become exactly that). The person preparing uname for
inclusion into a distribution package will have to manually provide
values for these four fields in a configuration file. To ensure that
this is not forgotten, the uname distribution should refuse to compile
out of the box, until these values have been configured.

Related files:

  /etc/*-release, /etc/issue, /etc/issue.net, /etc/motd, /usr/bin/lsb_release

Related specifications:

  - http://www.opengroup.org/onlinepubs/009695399/utilities/uname.html
  - http://www.opengroup.org/onlinepubs/009695399/functions/uname.html
  - http://www.linuxbase.org/spec/booksets/LSB-Core/LSB-Core.html#LSBRELEASE
  - http://cvs.openpkg.org/openpkg-src/openpkg/platform


Markus Kuhn, Computer Laboratory, University of Cambridge
http://www.cl.cam.ac.uk/~mgk25/ || CB3 0FD, Great Britain

More information about the lsb-discuss mailing list