How to tell if current version was upgraded or a fresh install

I have a number of installation of ubuntu 16.04. Some of them were upgraded from a previous version. Some of them were fresh installs.

Some of my installations have problems that that I don't experience of some of the others.

I'm trying to identify if the problems that I experience are because of problems with the upgrade and if the fresh installs are functioning better.

If the fresh installs are functioning better in every instance, I might perform fresh installs on some of the computers that I experience problem.

Thanks in advance for anyone who knows how to test if the running OS was installed initially as the version running.


A clean install of Ubuntu 16.04 should have no files in directory /var/log/dist-upgrade. So you could test for the existence of main.log there to determine if the installation was a clean install or an upgrade, eg using bash

if [ -f /var/log/dist-upgrade/main.log ]
then echo upgrade
else echo clean install
fi

For more info refer to DebuggingUpdateManager