2

So my question is simple, I often flash a couple of different OSes to try in different Rpi's and often don't label the actual SD cards to distinguish then from each other. So days later I end up mixing them up. It's especially kinda hard to write on a microSD card.

I stumbled upon this which offers a few suggestions, but I was wondering if it wasn't possible to just examine the flashed files to determine what OS and version I have in there. For example for an Ubuntu SD card I created, I can clearly see find a README.diskdefines which tells me.

enter image description here

Is there any default files on a raspbian image-flashed SD card that identifies this?

2 Answers 2

3

/etc/os-release should be on Linux distributions. This may be a link to /usr/lib/os-release

Current Raspbian shows:-

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"

/etc/rpi-issue will show when the image was created (at least for Raspbian), but does not change with upgrades.

4
  • Sweet. this is exactly what I was looking for. Thanks! Aug 2, 2017 at 4:49
  • This would only appear to work on Linux, is there a way to do this from only what can be seen in /boot partition (which would work across all OS's)? Perhaps instead of labeling the SD card adding a file to the /boot partition. Aug 2, 2017 at 5:11
  • @SteveRobillard the OP was (implicitly) about mounting on a Linux system. AFAIK there is no means of getting any useful info from the boot partition. There is issue.txt, and I make use of the dates of kernel files, but this only tells you when last updated, and not even the kernel version.
    – Milliways
    Aug 2, 2017 at 5:20
  • When you make a the SD card couldn't you rename the volume to be something meaningful? Or is the name "boot' required.
    – PaulF8080
    Aug 10, 2017 at 0:47
1

The content of /etc/rpi-issue will give you the precise git commit of the pi-gen repo that was used to create the image. It is unfortunate that you have to be able to mount/read the EXT volume in order to see it. I have created an issue for that.

Here is how you can use that file. I have a device deployed 2,300 miles away that is experiencing an issue, but I am still able to SSH in. The content of /etc/rpi-issue is:

Raspberry Pi reference 2017-04-10
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, acc4f56597e75225b93be3e1e20504a40565a9b9, stage2

I can take that hash and use it for browse the state of the source code at the time this image was created. To do this I put that hash at the end of this URL:

to get this URL:

I can also go to https://github.com/RPi-Distro/pi-gen/releases to see if the first 6 digits of the hash acc4f5 matches a release that is ready to download.

screenshot of github

Hey look it does! That means I can probably find a copy of the image at http://downloads.raspberrypi.org/raspbian_lite/images/ I can now download that image and run it on a local device and experiment with possible solutions. My day now looks like

Apollo 13 screenshot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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