Ubuntu – Is the result of upgrade for system files different than a full clean install

package-managementupgrade

I recently have migrated from Scientific Linux (SL), a RHEL derivative distro, to Ubuntu LTS. This was necessitated by there being no SL 8, and I have been posting to the SL list (a much more freeform approach than used by Canonical for these lists) my observations on Ubuntu LTS versus SL (both "enterprise" or "stable production" distros — not enthusiast semi-beta distros). One significant difference was an upgrade from 18.04 LTS to 20.04.1 LTS — this was done in place, without any requirement to reformat the system drive (assuming that there was adequate storage space, and there was). For a similar major release upgrade on SL, one has to reformat — thus, I would remove the drive containing SL major release N, install a new drive, install SL major release N+1, and then copy back from the removed disk any non-system directories, such as /opt, /usr/local, and much of /home . This procedure is not needed with an Ubuntu LTS major release upgrade. However, there was a claim made on the SL list that the "Debian philosophy" of upgrade-in-place leaves a system that contains SYSTEM (not non-system) executables that are not the same as would be from a fresh install of the "upgraded" Ubuntu system. That is, the system files of 20.04.1 LTS after upgrade would not be the same as if 20.04.1 were installed on a new drive. Is this correct? Does the Ubuntu (Debian) upgrade-in-place leave system "junk" about? I am not referring to configuration files in, say, /etc that have specific configurations for specific utilities — I need these to be retained in so far as the functionality is available in the upgraded major release. I have read

Is a clean install better than upgrading?

I am not asking for an opinion — I am asking for detailed information as to the specifics of the differences between a clean install of LTS major release N versus an upgrade-in-place of LTS major release N-1 to N. I assume that there will be an URL or other documentation to answer this question, in addition to the responses that (hopefully) will be posted.

Best Answer

The Debian (dist-upgrade) and Ubuntu (release-upgrade) methods of migrating-to-the-next-release-without-formatting should not leave extraneous files scattered about your filesystem.

Debian has spent 25 years ruthlessly improving package quality, and it's very good. The Debian Archive Admins will reject and delete packages that fail to meet standards or make systems unstable. The standard for deb packages is that the package manager should remove all traces of a package, returning the system to a state similar to before the package was originally installed.

Generally, if you discover "junk" files left behind, that's a bug -- please file a bug report!

Also, if you discover a package that leaves cruft behind, please file a bug report.

There are several exceptions to the expectation of clean removal:

  • Your data in /home, which the package manager will never, ever delete.
  • System configs and settings in /etc. (use --purge to delete these)
  • Temporary files created by running applications, like PID files in /run, lockfiles in /var, and temporary files (mostly) in /tmp. These should be cleaned up by the application upon exit. If not, please file a bug report.
  • Persistent files created or modified by applications, like logfiles or caches in /var. Some will be deleted upon uninstall (caches), others won't (logfiles). If you have manually modified or added your own customizations, the package manager might not remove your file(s).
  • Packages from somewhere that's not in the official Debian Archives or Ubuntu Repositories may-or-may-not meet the standards, and might indeed leave cruft laying about. You likely know better than to install random debs from the big, dirty internet already.
Related Question