1

I have a raspberry pi but I do not recall when I set it up. I am trying to find this out. I have tried the suggestion in the following question:

https://unix.stackexchange.com/questions/9971/how-do-i-find-how-long-ago-a-linux-system-was-installed

(summarized as sudo tune2fs -l /dev/mmcblk0p2|grep 'Filesystem created' ).

This only shows when the raspbian image was created by the foundation.

John Smith
  • 1,251
  • 3
  • 17
  • 27
  • 2
    Just out of curiosity why is this important? – Steve Robillard Jan 06 '17 at 01:03
  • @SteveRobillard I don't understand the purpose of your question so I cannot answer it. – John Smith Jan 06 '17 at 01:26
  • 1
    Why do you need to know the date the system was setup? What value des this have? How are you planning to use this date? – Steve Robillard Jan 06 '17 at 01:30
  • That command shows when the disk (SD card in this case) was formatted and assumes the system was installed right after that. If that is not what you are after, then you need to clarify what you mean by "when I set it up". – SiKing Jan 06 '17 at 15:54
  • 1
    @SiKing . The command seems to show when the disk image was created at the raspberry pi foundation. I have several machines which I created over a time period and they all have the same date because they were built from the same disk image. – John Smith Jan 06 '17 at 16:30
  • What model Pi are you using? How specific does the date need to be? Is the Pi connected to the network? If so how? – Steve Robillard Jan 06 '17 at 17:20
  • @SiKing "Filesystem" and "disk" are not the same thing, nor is formatting them, but either way here the information will not refer to when the image was burnt to the SD card. Any date associated with the device formatting (I don't think MBR's store that, so this is even if) would belong to the image. Likewise, any date associated with the creation of filesystems inside partitions inside the image. http://raspberrypi.stackexchange.com/a/51100/5538 – goldilocks Jan 06 '17 at 17:48

2 Answers2

2

Find /var/log/syslog. This file has likely been rolled over, and the old versions will have suffixes that are either plain numbers or dates. Find the oldest one by modification time:

ls -l /var/log/syslog.*

Start skimming it from the beginning. Because the Pi doesn't have a clock, the first dates you will find will be Dec. 1969. The first realistic date will be the first one the OS was aware of.

Note that depending how old the installation is, the oldest archived logs may have been purged.

goldilocks
  • 58,859
  • 17
  • 112
  • 227
2

The most effective way I have found is using the command

passwd -S

This works if you only changed your password on the day it was setup.

John Smith
  • 1,251
  • 3
  • 17
  • 27