4

There is a fast way to check ubuntu version of the system:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 11.10
Release:        11.10
Codename:       oneiric

But what are the files that store this information and how can I access them? Particularly, I've got an old partition with a dead Linux lying there and I would like to check what was its Ubuntu version. lsb_release -a shows my current Linux version only...

7

You can use /etc/lsb-release for that:

~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=13.04
DISTRIB_CODENAME=raring
| improve this answer | |
  • 1
    Note that this answer is also valid for other distributions. /etc/lsb-release is common to several of the large distributions. – a CVn Nov 11 '13 at 11:57
5

You can try chrooting into that system from another Linux or LiveCD. Let's assume your dead distro is on sda2. First, mount the partition:

$ mount /dev/sda2 /mnt

Now bind folders with crucial binaries to replace possibly dead ones. mount -B mounts one directory over the other one virtually replacing its contents, but without physically touching it:

$ mount -B /bin /mnt/bin
$ mount -B /sbin /mnt/sbin
$ mount -B /usr/bin /mnt/usr/bin

Now chroot to the old distro. chroot will pretend that given directory is / (so in our case we'll have a shell running in an offline distro, working on its files except for binaries we've bound before)

$ chroot /mnt

Now any command you issue will work as if that partition is your filesystem root. lsb_release -a will be executed from your binaries, but will read from files of the dead distro.

You can use chroot for many other things. For example you can upgrade Ubuntu without booting it: just boot a LiveCD, mount Ubuntu's partition, bind crucial directories like /proc etc. (do NOT binaries - this would update LiveCD binaries) and run do-release-upgrade in the chrooted shell.

| improve this answer | |
  • This becomes a lot more complex if the other system is of a different architecture, or even a different operating system. While it provides useful information, there are drawbacks to this approach. (And you forgot libraries, which will need to be bind-mounted into the chroot jail as well.) – a CVn Nov 11 '13 at 11:59
1

Does the following warrant a re-examination of the original poser's problem for a viable solution (which is required for salvage operations)?

Unfortunately, the accepted answer to the OP does not provide the correct result.

The volume OS information extracted as follows:

ubuntu@ubuntu:/media/ubuntu/Boot18.04$ cat etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04 LTS"

ubuntu@ubuntu:/media/ubuntu/Boot18.04$ cat etc/os-release
cat: etc/os-release: No such file or directory

ubuntu@ubuntu:/media/ubuntu/Boot18.04$ cat '/media/ubuntu/Boot18.04/etc/issue' 
Ubuntu 12.04 LTS \n \l

ubuntu@ubuntu:/media/ubuntu/Boot18.04$ cat '/media/ubuntu/Boot18.04/etc/issue.net' 
Ubuntu 12.04 LTS

is inconsistent with the actual boot version which was definitely 18.04."something" . Is it possible to definitively determine the actual installed version easily? (especially given that said volume no longer boots)

(It is of course possible to install each of several OS versions and then compare binaries ... !)

The 18.04."something" volume above definitely booted but not 12.04 though it was created using a 12.04 boot volume.

To be clear, the operational 18.04.1 bootable volume that was used when extracting the information above is consistently identifiable via:

ubuntu@ubuntu:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.1 LTS
Release:    18.04
Codename:   bionic

ubuntu@ubuntu:~$ cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.1 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.1 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

ubuntu@ubuntu:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"

ubuntu@ubuntu:~$ cat /etc/issue
Ubuntu 18.04.1 LTS \n \l

ubuntu@ubuntu:~$ cat /etc/issue.net
Ubuntu 18.04.1 LTS
| improve this answer | |
  • OPs question was asked more than 6 years ago. Things change, this does not invalidate the question and answers given back then, it does mean that someone getting similar symptoms on newer software may need to post their own question rather than trying to use this one. – music2myear Dec 18 '19 at 3:48
-2

Open the Terminal (keyboard shortcut: Ctrl+Alt+T)

Enter the command

lsb_release -a 

Your version will be shown on the Description line.

| improve this answer | |
  • 5
    The OP specifically asked another way of checking than the solution you mentioned. – Teun Vink Nov 11 '13 at 9:34

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.