130

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?

7 Answers7

315

Use:

cat /etc/apt/sources.list.d/raspi.list

If the file exists, you are using Raspberry Pi OS. An example of the content:

deb http://archive.raspberrypi.com/debian/ bookworm main
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspberrypi.com/debian/ bookworm main

Before Debian 11 (bullseye)

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"
psq
  • 103
  • 3
w5m
  • 3,251
  • 3
  • 17
  • 10
26

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
Cerin
  • 2,291
  • 8
  • 33
  • 49
23

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
rcpa0
  • 351
  • 2
  • 5
12
uname -a

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

man uname
Ghanima
  • 15,958
  • 17
  • 65
  • 125
recantha
  • 4,489
  • 21
  • 26
2

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

Arash
  • 129
  • 2
1

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)
Milliways
  • 62,573
  • 32
  • 113
  • 225
-1

open terminal and type

cat /proc/version