How can I determine which OS image I am running?

  • I have been given a pre-installed SD card. It boots fine, and I know it is running some version of Raspbian. Can I determine exactly which release it is running?

    A note to all answeres: Gnu/Linux may be the favourite OS. But the Rasperry Pi supports other OS like BSD, Plan 9, RISC OS too.

    @ott--...and Windows 10 IOT.

    @PaulFleming Win 10 IoT? Not really. Not a real OS. You can't do anything on it. You can only run apps created separately (i.e. on a different device/platform) in Visual Studio.

  • recantha

    recantha Correct answer

    7 years ago
    uname -a
    

    will give you the kernel version etc. There are some other parameters you could try as well - to see them:

    man uname
    

    The question was about the distro version, not the kernel version, so this answer is really not useful.

    I can't help it if he chose to accept the wrong answer. Perhaps it gave him what he needed.

    **uname -a** displays `Linux raspberrypi 4.4.32-v7+ #924 SMP Tue Nov 15 18:11:28 GMT 2016 armv7l GNU/Linux`. However, I need to know if the Pi is running Debian 7 or Debian 8.

    Need to know Jessie vs Stretch...

    See correct answer, below: `cat /etc/os-release`, thanks to @w5m

  • Open Terminal and type:

    cat /etc/os-release
    

    This results in the following output on my Raspberry Pi 2...

    PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
    NAME="Raspbian GNU/Linux"
    VERSION_ID="8"
    VERSION="8 (jessie)"
    ID=raspbian
    ID_LIKE=debian
    HOME_URL="http://www.raspbian.org/"
    SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
    BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
    

    This answer clearly displayed what version of Raspbian I am running, unlike the chosen answer.

    this should be the accepted answer!

    This worked on *Stretch* on a Pi 2 too. When I ran it tonight on a Virtualbox VM running the latest Raspbian Desktop *Stretch* (the PC version) it gives **Debian** for `PRETTY_NAME`, `ID` and the `*URL` values :-( . I'm unsure, seems like an oversight by Raspbian maintainers to me.

    this should be the correct answer thank you for this post UPVOTE!

  • Do not look at uname -a. That just shows kernel version. To find the distribution version, run:

    sudo apt-get install lsb-release
    lsb_release -a
    

    My RPi shows:

    No LSB modules are available.
    Distributor ID: Debian
    Description:    Debian GNU/Linux 7.8 (wheezy)
    Release:    7.8
    Codename:   wheezy
    

    This is the right answer.

    I don't think this is a good answer. Install another app just to give what you can get for free with `cat /etc/os-release` or `cat /etc/*-release` is not good

    It is *an* answer and is perfectly valid for the Raspbian distro which is derived from Debian which aims for compliance with the Linux Standards Base.

    It may be the right answer but not the most useful one.

  • https://github.com/RPi-Distro/pi-gen/releases lists releases of Raspbian since 2016-05-10.

    To find your Raspbian distribution image release date (not the /etc/os-release information such as VERSION="8 (jessie)") on a running system:

    $ cat /etc/rpi-issue
    Raspberry Pi reference 2016-05-10
    Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, c32099002b4c44243e87d8cc90303237eb5ce06a, stage4
    

    Note if you did 'apt-get {dist-,}upgrade' or rpi-update, you will have updated some files since you first installed that distribution image.

    [The original poster asked back in 2013, before the github URL existed, but this answer may help some users in 2016.]

    Update: Instead of actually running Raspbian on that mysterious Raspbian SD card, you could also mount the SD card in a Linux or Windows desktop SD reader to read the /issue.txt file directly. /issue.txt exists in the root directory of the SD card's FAT16 partition. From Ubuntu 16.04.1, I see the following on a second SD card I have:

    Raspberry Pi reference 2016-09-23
    Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 62406bad92ed23728f46711b3539c04c37dfb62c, stage4
    

    This file is present even on the *Raspbian Desktop* PC ISO image, and since it's generated by `pi-gen` it seems it's automatically updated, unlike `/etc/os-release` which it appears is manually edited, and was overlooked on the latest PC image of Raspbian.

    +1 because this gives the exact release - there are several different releases of e.g. Jessie

  • Almost what Cerin wrote. Just lsb_release -a and you don't need to install the LSB module to see the raspbian description

    When I try this I get: `-bash: lsb_release: command not found` but this goes away when I install the lsb-release package.

  • The following script is one I use to collect relevant details. (It is called about)

    You can run this or the individual commands

    #! /bin/sh
    if [ -e /etc/rpi-issue ]; then
     echo "- Original Installation"
     cat /etc/rpi-issue
    fi
    if [ -e /usr/bin/lsb_release ]; then
     echo "- Current OS"
     lsb_release -irdc
    fi
    echo "- Kernel"
    uname -r
    echo "- Model"
    cat /proc/device-tree/model && echo
    echo "- hostname"
    hostname
    echo "- Firmware"
    /opt/vc/bin/vcgencmd version
    

    The output on my Pi3A+ shows

    - Original Installation
    Raspberry Pi reference 2018-11-13
    Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 7e0c786c641ba15990b5662f092c106beed40c9f, stage4
    - Current OS
    Distributor ID: Raspbian
    Description:    Raspbian GNU/Linux 9.6 (stretch)
    Release:    9.6
    Codename:   stretch
    - Kernel
    4.14.79-v7+
    - Model
    Raspberry Pi 3 Model A Plus Rev 1.0
    - hostname
    MilliwaysPi3A
    - Firmware
    Nov  4 2018 16:31:07 
    Copyright (c) 2012 Broadcom
    version ed5baf9520a3c4ca82ba38594b898f0c0446da66 (clean) (release)
    Filesystem created:       Tue Jan  1 12:09:51 2019
    

    It should produce a meaningful output on most Linux distributions, e.g. Ubuntu MATE

    - Current OS
    Distributor ID: Ubuntu
    Description:    Ubuntu 16.04.5 LTS
    Release:    16.04
    Codename:   xenial
    - Kernel
    4.4.38-v7+
    - Model
    Raspberry Pi 2 Model B Rev 1.1
    - hostname
    PiUbuntu
    - Firmware
    Dec  9 2016 15:11:26 
    Copyright (c) 2012 Broadcom
    version 2e557d8dac70add28597c3b449cb52c34588d818 (clean) (release)
    
  • open terminal and type

    cat /proc/version

    That will only show kernel version, not distribution version.

License under CC-BY-SA with attribution


Content dated before 6/26/2020 9:53 AM