I want to ensure something. I'm running a database full of information and manually set configuration. Now I'm trying to upgrade my Ubuntu from 16.04 to 18.04. I did "apt-get update" and "apt-get upgrade" however I'm not sure what apt-get dist-upgrade does? will it erase or overwrite any previously defined configuration?
In Ubuntu, you don't need to use
apt dist-upgrade. Best practice is to use
apt full-upgrade instead.
dist-upgrade dates back to before Ubuntu's birth.
Way back then, when migrating from Debian release to another, you had to manually edit your sources.list, then you used dist-upgrade to calculate and execute the upgrade. This was a huge improvement over the older and much more laborious methods.
When Ubuntu came along, Ubuntu users began to use dist-upgrade for an unanticipated purpose: Kernel packages change names frequently, so a plain
apt update won't work. It became commonplace to use dist-upgrade to recalculate the dependencies and pull in the new kernel packages.
There's a risk using such a big hammer for such a small nail -- if your sources changed, apt might implement large, unexpected changes to your system. Remember, that is dist-upgrade's original purpose!
Ubuntu developers closed that window years ago by adding
full-upgrade to apt, which protects your system from unexpected major changes.
dist-upgrade is a habit for many older Ubuntu users, and it rarely causes them problems -- they generally don't need to change their habits. However, newer users are encouraged to understand the difference, and to use the
full-upgrade tool that is more likely to protect their system when bad fortune strikes.
The Upgrading Docs explain
apt dist-upgrade a bit. Note that this command is not recommended. Instead,
do-release-upgrade is recommended, and specifically for servers.
apt upgrade, the system upgrades packages to the newest, known version. You can update this set of 'known versions' using
apt will only install or upgrade packages found for the distribution and releases found in the configuration. This means that Ubuntu 18.04 should only download packages for that specific version of Ubuntu.
When you do a
apt does a few things, one of which is that it updates the
apt configuration to point to the new release. This means that if you
dist-upgrade from 17.04 to 18.04,
apt will now pull 18.04 packages. These configuration files change, and need to change. Your custom repositories will likely be disabled temporarily during the upgrade.
You should search for and read notes specific to your upgrade path. Search "17.04 to 18.04 upgrade", for example. Check out the target release's Release Page for additional information. Debian and Ubuntu maintainers strive for clean upgrade paths, and put a lot of work into that, but all systems are different, and it would be hard to give a definitive answer.
The 18.04 Release docs give specific instructions.
apt will ask you to overwrite, or leave as-is, any configuration file detected to be changed during an upgrade. Typically, you will respond that you wish to keep the current version of the configuration file. However, see the note about using
do-release-upgrade instead of
apt dist-upgrade to ensure this!
Sometimes, there are major changes, such as switching from one application to another within the distribution, which may cause complications. You will need to check your upgrade path for such changes. An example of this would be changing to SystemD.