How to determine which Ubuntu flavor I'm on?
Solution 1
As a general rule, you should not be writing software that cares what 'flavor' of Ubuntu you're on. The only difference between Ubuntu, Kubuntu, Xubuntu, and most of the other upstream supported versions is the desktop environment and what high-level software is installed by default. They are all Ubuntu at the core, so the lsb_release
output is correct, and once the system is installed it doesn't really matter (you can easily convert between variants with just a few apt-get
commands).
If you actually need specific software that is only installed on one variant by default, you should be checking for that software, not the variant itself (for example, if you need GNOME 3 for your software to work, you should depend on that, not on stock Ubuntu).
If you absolutely have to check for a specific variant, each one has it's own metapackage in the package manager (for Xubuntu for example, you should see a package called xubuntu-meta
in a list of installed packages). This is not a reliable way to check though because such metapackages aren't mutually exclusive (and I've seen terminal servers that have most of them installed just to let users choose their desktop environment) and can be manually installed or removed after the initial install.
As for the No LSB modules are available.
bit, you can safely ignore that if you're not using software that requires LSB compliance (and no sane software does these days). the LSB standard itself was originally intended to define a common platform for Linux distributions so that third-party software could easily chec in a distro-agnostic way if their dependencies were met. 'Modules' referred to optional subcomponents of the LSB standard. The whole thing is largely irrelevant today (except for the lsb_release
command being the only reliable way to determine the distro you're on) because it's not been updated in years and includes things like Qt 3, and it was never well supported on Ubuntu or Debian systems to begin with (because it was largely based on Red Hat).
Solution 2
Sometimes it is useful to know what variant you are using, in order to freshly reinstall from disc/USB media (e.g. match the iso version or x86/x64 arch).
these are the findings that I know:
$ dpkg -l '*buntu-desktop' | grep ^ii
ii xubuntu-desktop 2.225 amd64 Xubuntu desktop system
or
head -1 /etc/apt/sources.list
#deb cdrom:[Xubuntu 18.04 LTS _Bionic Beaver_ - Release amd64 XXXXXX
Related videos on Youtube
Comments
-
joH1 almost 2 years
I am on Xubuntu (16.04, btw) however
lsb_release -a
gives me:user@host:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.3 LTS Release: 16.04 Codename: xenial
Should it display
Xubuntu
, or is this legit output?
And if it is, how can I (by the CLI) know the exact Ubuntu distro I'm on?And what does the warning
No LSB modules are available.
mean anyway?
(It is output to stderr:user@host:~$ lsb_release -a >/dev/null No LSB modules are available.
so I'm guessing in nominal case it shouldn't be there)
-
joH1 almost 7 yearsWell, fair enough... That's a pretty thorough answer, get that rep you deserved!
-
mrc02_kr over 5 yearsThe second way doesn't actually show which version is installed. The
sources.list
file can be modified and something else can be at the first line (eg. comment) -
Tomofumi over 5 yearsyes it can be modify by someone easily, but it still provide some hints on default installation. I think even the update-manager GUI have reference to it.