Ubuntu – Are apt-get repositories hardcoded to a specific release

accessibilityaptmaintenanceusability

From the usability point of view, I do not understand why on each release upgrade you have to manually patch all the URLs of apt in order to make them point to the newer distribution.

Why is not possible for apt to auto-detect the current and use it, so when you upgrade there is no need to upgrade the urls anymore?

Best Answer

I do not understand why on each release upgrade you have to manually patch all the URLs of apt in order to make them point to the newer distribution.

You do not have to do this. (Not typically, anyway.) Actually, in Ubuntu, manually changing release names in sources.list is not a supported way to upgrade, and may often not work.

When the package manager checks to see what package versions are available to be installed or upgraded to, /etc/apt/sources.list and any configuration files in /etc/apt/sources.list.d are consulted to discover which software sources are configured. This includes but is not limited to information about what release is installed, and occasionally (though not usually!) it even makes sense to have software sources configured for releases other than the one you are running.

When you upgrade to a newer Ubuntu release using a supported method (such as the Software Updater / Update Manager or the do-release-upgrade command), the release names in sources.list are changed automatically. Some software sources, such as PPAs, may instead be disabled.

One of the reasons Ubuntu's package manager doesn't just check which release is installed and use that information dynamically to determine what software sources to use, is that there is no one thing that is the release you are running. Normally, which Ubuntu release you're using (e.g., 14.04) is well defined. But during a release upgrade, and under some other circumstances (some pathological and others proper), you may have a mixture of different releases.

In order for Ubuntu to get the point in a release upgrade where you are really, truly, and definitively running the next release (i.e., the release upgrade target), or even to the point where commonly used indicators like the contents of /etc/lsb-release would indicate the target release, it must first change what software sources are configured (to those of the target release) and upgrade, install, and remove packages to reflect what is provided by those software sources.

Related Question