I am trying to write a script which works based on the knowledge that each Linux Mint release was based on a particular Ubuntu release.

However, I do not want to install Linux Mint to verify that, but instead let the users of the script test it, if they need it.

Can I rely on the presence of /etc/debian_version, though? I am doing this in order to detect Debian and its derivatives. It works reliably on Debian and Ubuntu, but does Linux Mint have this file?

Note: I am aware of lsb_release and I am using that in order to figure out more details later on. But the existence of /etc/debian_version is a way to make assumptions about certain things before even checking for and invoking lsb_release.


As mentioned in @kirill-a's answer, /etc/debian_version should be present in any Debian derivative.

Another useful approach to find out information on the current Debian-based distribution and its "ancestry" is dpkg-vendor; for instance,

dpkg-vendor --derives-from Debian

should succeed on any Debian derivative (and on Debian itself),

dpkg-vendor --derives-from Ubuntu

should succeed on any Ubuntu derivative (and on Ubuntu itself), etc. A distribution is considered a derivative of itself as well as of its parents, so Ubuntu is a derivative of Ubuntu and of Debian.

dpkg-vendor is shipped in dpkg-dev so that needs to be installed for the command to be available, which reduces the usefulness somewhat.

| improve this answer | |
  • 1
    Wow, didn't know of that one. However, before your if (and assuming Bash) I'd always do type dpkg-vendor > /dev/null 2>&1 || { echo "No dpkg-dev!"; exit 1; }, which tests for the availability of the program. And it turns out this is part of dpkg-dev which is one of the packages that gets installed via build-essential, but it's not part of a base installation. Still, very cool idea and method. – 0xC0000022L Feb 2 '15 at 8:54
  • Note that, like /etc/debian_version, that reports information stored in the base-files package which on Mint comes straight from Ubuntu. /etc/lsb-release, /etc/issue... also come from bash-files, but the mintsystem package registers File triggers for them and overwrites them whenever they're modified by another package. – Stéphane Chazelas Feb 2 '15 at 21:46

Yes, as in any Ubuntu derivative, this file is present.

enter image description here

| improve this answer | |
  • Thanks. Well, I know that theoretically that should be the case. My question, however, was whether it is the case on Linux Mint specifically. The well-known problem is that in theory practice and theory are the same; but in practice they often divert. My uncertainty in response to your answer stems from a generic answer to a specific question. – 0xC0000022L Feb 2 '15 at 8:49
  • Awesome, this screenshot is proof enough. Thanks. – 0xC0000022L Feb 2 '15 at 8:50

I'm running Mint 19

$ lsb_release -d 
Description:    Linux Mint 19 Tara

$uname -a
Linux mymc 4.15.0-20-generic #21-Ubuntu SMP ...

$ cat /etc/debian_version

This: cat /etc/debian_version | grep -o '[0-9]'| head -1|sed -e 's/ //' should tell you what version of debian is used, but mint obscured it.

| improve this answer | |
  • 2
    Sorry, but your answer does not add anything to the existing ones and it doesn't even answer the question (apart from showing that /etc/debian_version is indeed present on your system). – TooTea Nov 2 '18 at 10:11
  • Your last paragraph is only correct for stable Debian releases; buster/sid is a perfectly valid entry for Debian and derivatives, Mint isn’t obscuring anything. – Stephen Kitt Nov 2 '18 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.