It must be rocket science…
So I’m sitting here writing some generic “unhandled exception” code to display a dialog box in case Banshee throws up, as it’s better to have some kind of indication that it’s sick, than nothing at all. Along with the exception message and stack trace, I have it print the version information for all assemblies, and print the output of `uname -sirom` However one of the simplest, most useful pieces of platform information is the name and version of the
Why isn’t there some simple static file, like /etc/distro, that contains a one line string of the distro name and version? Can it be too much to ask? Is there something simple that I’m missing? Am I the only developer that finds this information useful?
Actually, maybe some kind of Key=Value file, /etc/distro, could have more detailed, standard keys. Like Name=SuSE, Version=10.0, Release=Beta 3, Vendor=Novell, Kernel=Such and Such, etc., etc. Just so long as there’s some kind of standard distribution version file, with standard keys. I don’t care if it’s Key/Value, XML, Binary… just something with lots of useful information, that is standard across all distributions.
Oh well… the exception dialog rocks anyway.

September 20th, 2005 at 9:18 pm
Most Linux distributions do put some kind of versioning information into ‘/etc’ (Debian is ‘/etc/debian_version’, RedHat is ‘/etc/redhat-release’). The autoconf scripts for NetworkManager and Sabayon use them: look there for the correct filenames for some common distributions.
September 20th, 2005 at 9:31 pm
$ cat /etc/lsb-release
DISTRIB_ID=Debian
DISTRIB_RELEASE=3.1
DISTRIB_CODENAME=sarge
DISTRIB_DESCRIPTION=”Debian GNU/Linux”
September 20th, 2005 at 10:35 pm
In Mandriva we have /etc/mandriva-release, /etc/mandrake-release and /etc/mandrakelinux-release for backwards compatibility, and /etc/redhat-release for wider compatibility (it was in initial versions of MDK, people started using it in scripts, so we’ve kept it ever since in case people still are :>)
September 20th, 2005 at 11:16 pm
I just checked, and on my Ubuntu Hoary system the /etc/lsb-release file has the info you want:
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=5.04
DISTRIB_CODENAME=hoary
DISTRIB_DESCRIPTION=”Ubuntu (The Hoary Hedgehog Release)”
The file /etc/debian_release also exists, but is significantly less informative:
$ cat /etc/debian_version
3.1
September 20th, 2005 at 11:54 pm
SuSE has /etc/lsb-release, but that just contains the kernel version. But it also has /etc/SuSE-release, which contains:
SUSE LINUX 10.0 (i586) beta2
VERSION = 10.0
So these /etc/*-release files seem decently standard with regard to their location and general content, but the formats seem to vary, and some are more useful than others.
It’d still be great to have some kind of unified standard for the contents and layout of say /etc/lsb-release.
In the mean time, thanks for the tips… maybe I’ll end up throwing together some kind of parser - it’s better than nothing!
September 21st, 2005 at 12:11 am
And by “kernel version,” what I really meant the LSB_VERSION field, which is allegedly supposed to identify against which LSB release the distro is compatible with. At first I had only glanced at the filed and it resembled my kernel version
September 21st, 2005 at 1:33 am
Slackware
/etc/slackware-version
September 21st, 2005 at 3:48 am
/etc/issue is printed by getty before the login prompt. It should be a
good indicator of the distribution and version of any UNIX-like
system.
September 21st, 2005 at 4:29 am
You really want to use the lsb_release command, not base it off a file in /etc or something similar. Something along the lines of:
: tfheen@thosu ~ > lsb_release -a
LSB Version: n/a
Distributor ID: Ubuntu
Description: Ubuntu (The Breezy Badger Release) Development Branch
Release: 5.10
Codename: breezy
should be enough, by far.
September 21st, 2005 at 4:39 am
I agree with using the lsb_release command is the best way for LSB 1.1
compliant systems but /etc/issue is the best fall-back if that command
is unavailable or parsing fails.
September 21st, 2005 at 12:11 pm
Ah! lsb_release -a is exactly what I’m looking for. Thanks everyone.
September 21st, 2005 at 3:41 pm
/etc/issue
July 12th, 2006 at 3:19 pm
Ah, very useful discussion to have stumbled upon. Thanks loads, guys.