1

I have a computer that is running NixOS, and has been for a number of years. Is there a way to tell when exactly the system was installed?

The first generation has been GCed ages ago, so I can't just look at the dates on the boot entries.

3

You created a filesystem for installation of the OS when you installed it.

Assuming your / is mounted on /dev/sda1

You can get the filesystem creation time, which is the same as OS installation time

sudo tune2fs -l /dev/sda1 | grep 'Filesystem created'

or

sudo dumpe2fs /dev/sda1 | grep -i 'Filesystem created'
  • 1
    That doesn't quite work on ZFS, but zfs history does show when the pool was created. – aij May 22 at 0:48
1

Another option might be the ctime of some directory, e.g. ls -lcd /nix – unless you've done something unusual in the meantime, e.g. changed permission/owner stuff on such directories.

  • I wasn't sure how reliable that was, but FWIW, in this case it does match the date I got from zfs history. – aij May 22 at 0:52
0

I understand you're asking for a specific flavour linux but you should be able to find it with running package manager -history i.e. for Redhat\Centos based below.

[xxxyyyzzz@localhost ~]$ sudo yum history

ID     | Command line             | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
    10 |                          | 2019-05-20 12:22 | Install        |   24   
     9 |                          | 2019-05-20 09:28 | Install        |    2   
     8 |                          | 2019-05-17 17:13 | Install        |   61   
     7 | install freerdp          | 2019-05-17 17:07 | I, U           |    3   
     6 | remove rdesktop          | 2019-05-17 17:07 | Removed        |    1   
     5 |                          | 2019-05-17 17:05 | Install        |    5   
     4 |                          | 2019-05-17 17:05 | Install        |    4  <
     3 |                          | 2019-05-17 17:04 | Install        |    5 ><
     2 | install rdesktop         | 2019-05-17 17:04 | Install        |    1 > 
     1 |                          | 2019-04-26 12:24 | Install        | 1632 EE

Transaction ID: 1 below shows the date of first install 2019-04-26 12:24

  • 1
    NixOS has "its own" package manager called Nix. – Vladimír Čunát May 20 at 16:13
  • This is not reliable, as the user might not have installed anything at the time of installation of OS. – GypsyCosmonaut May 21 at 5:50
  • How nix (the package manager) manages its logical package is unknown to me. However, by logic, the first transaction in yum is where OS deployed and installed (i.e. 1632 package altered as seen above). – M.N. May 27 at 23:14

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.