Many of us like to keep the extra Kubuntu PPAs (updates, backports) enabled to receive the freshest that the Kubuntu team and KDE have to offer. Occasionally, though, this can create situations in which a package goes "orphan." Once this happens, then depending on how version numbers are tracked, dist-upgrade may not be able to replace them.
Most recently, this happened to me shortly after the 13.10 release. The Kubuntu updates PPA was pulling in and publishing nightly builds from KDE's Git repository. Because I had that PPA enabled, apt-get dist-upgrade dutifully installed each package. At some point the PPA stopped publishing builds, and much of my KDE went "orphan." In other words, the currently installed packages were neither from the official 13.10 release nor from a PPA. You can tell this happens with the help of apt-cache:
The clue here is that the installed version, indicated with ***, is no longer linked to any of the official pockets (saucy, saucy-updates, saucy-security, saucy-backports) or to any current PPA, but instead only to the list of locally-installed packages (as shown in red). Understanding how to fix this requires some knowledge of Debian packaging, so keep reading.
Normally, without any updates or PPA replacements installed, the output of the above would be:
The three-digit number in front of the two possible installation choices indicates the priority of a package. By default, packages in all pockets and PPAs (but not backports) are set to priority 500. This means that APT relies only on the version number to decide whether to upgrade a package. Once a package is installed (or upgraded), APT also adds an entry to the file /var/lib/dpkg/status to keep track of what's installed. The priority is set to 100, which is the convention for installed packages.
When a package is upgraded from a pocket or PPA, the cache policy display appears like so:
Here, the installed version is from saucy-updates and the list of locally-installed packages indicates the same. Compare the pair of red lines in this output to the single red line in the first cache output above.
Now, imagine that eventually a new version of kde-workspace appears in saucy-updates. Its priority will be 500, which is defined as "causes a version to be installed unless there is a version available belonging to the target release or the installed version is more recent" (from man apt_preferences). The installed version, remember, is 4.11.2+git20131021+bzr48600+pkg833~ubuntu13.10.1. It's certainly possible to envision a state where the APT somehow interprets the version number in saucy-updates to be "less" than the installed version -- and, indeed, if this were to happen, the new version of kde-workspace will not be installed.
The way to fix this is to downgrade the affected packages to the official versions. To do this, we need to elevate their priority to something greater than 1000, according to the previously-mentioned man page: "causes a version to be installed even if this constitutes a downgrade of the package." Through the magic of APT pinning, we can make this happen.
Step 1. In a command window, run:
Enter the following:
Remember to substitute the name of the release for RELEASE in each of the lines above. That's the first word of the two-word release name: precise, quantal, raring, saucy, etc. Press Ctrl+X to save the file and exit the editor.
Step 2. Now, run:
APT will update its package cache, solve dependencies, and perform a downgrade of the "orphaned" packages to the most recent versions in the official pockets.
After the downgrade completes, delete the file:
Step 3. Disable the Kubuntu PPAs, at least for now, so that you don't find yourself back in this state again. You might have one or two such files: kubuntu-ppa-ppa-release.list and kubuntu-ppa-backports-release.list (where release is, of course, some release name). Type the following:
Place a # in front of each line to comment it out. Press Ctrl+X to save. If you have only one .list file, nano will exit. If you have two .list files, nano will open the next one. Comment the lines in this file. Press Ctrl+X once more to save and exit.
Step 4. Clean up the downloads and update the cache once more (to reset priorities to the default of 500):
Finally, for good measure, reboot.
Most recently, this happened to me shortly after the 13.10 release. The Kubuntu updates PPA was pulling in and publishing nightly builds from KDE's Git repository. Because I had that PPA enabled, apt-get dist-upgrade dutifully installed each package. At some point the PPA stopped publishing builds, and much of my KDE went "orphan." In other words, the currently installed packages were neither from the official 13.10 release nor from a PPA. You can tell this happens with the help of apt-cache:
Code:
steve@t520:~$ [B]apt-cache policy kde-workspace[/B] kde-workspace: Installed: 4.11.2+git20131021+bzr48600+pkg833~ubuntu13.10.1 Candidate: 4.11.2+git20131021+bzr48600+pkg833~ubuntu13.10.1 Version table: *** 4.11.2+git20131021+bzr48600+pkg833~ubuntu13.10.1 [COLOR="#FF0000"]100 /var/lib/dpkg/status[/COLOR] 4:4.11.2-0ubuntu1 0 500 http://mirror.anl.gov/ubuntu/ saucy/universe amd64 Packages 100 /var/lib/dpkg/status
Normally, without any updates or PPA replacements installed, the output of the above would be:
Code:
steve@t520:~$ [B]apt-cache policy kde-workspace[/B] kde-workspace: Installed: 4:4.11.2-0ubuntu1 Candidate: 4:4.11.2-0ubuntu1 Version table: *** 4:4.11.2-0ubuntu1 0 500 [url]http://mirror.anl.gov/ubuntu/[/url] saucy/universe amd64 Packages 100 /var/lib/dpkg/status
When a package is upgraded from a pocket or PPA, the cache policy display appears like so:
Code:
steve@t520:~$ [B]apt-cache policy distro-info-data[/B] distro-info-data: Installed: 0.16ubuntu0.1 Candidate: 0.16ubuntu0.1 Version table: *** 0.16ubuntu0.1 0 [COLOR="#FF0000"]500 http://mirror.anl.gov/ubuntu/ saucy-updates/main amd64 Packages 100 /var/lib/dpkg/status[/COLOR] 0.16 0 500 http://mirror.anl.gov/ubuntu/ saucy/main amd64 Packages
Now, imagine that eventually a new version of kde-workspace appears in saucy-updates. Its priority will be 500, which is defined as "causes a version to be installed unless there is a version available belonging to the target release or the installed version is more recent" (from man apt_preferences). The installed version, remember, is 4.11.2+git20131021+bzr48600+pkg833~ubuntu13.10.1. It's certainly possible to envision a state where the APT somehow interprets the version number in saucy-updates to be "less" than the installed version -- and, indeed, if this were to happen, the new version of kde-workspace will not be installed.
The way to fix this is to downgrade the affected packages to the official versions. To do this, we need to elevate their priority to something greater than 1000, according to the previously-mentioned man page: "causes a version to be installed even if this constitutes a downgrade of the package." Through the magic of APT pinning, we can make this happen.
Step 1. In a command window, run:
Code:
sudo nano /etc/apt/preferences.d/return-to-release
Code:
Package: * Pin: release o=Ubuntu, a=[i]RELEASE[/i] Pin-Priority: 1001 Package: * Pin: release o=Ubuntu, a=[i]RELEASE[/i]-updates Pin-Priority: 1001 Package: * Pin: release o=Ubuntu, a=[i]RELEASE[/i]-security Pin-Priority: 1001
Step 2. Now, run:
Code:
sudo apt-get update && sudo apt-get dist-upgrade
After the downgrade completes, delete the file:
Code:
sudo rm /etc/apt/preferences.d/return-to-release
Step 3. Disable the Kubuntu PPAs, at least for now, so that you don't find yourself back in this state again. You might have one or two such files: kubuntu-ppa-ppa-release.list and kubuntu-ppa-backports-release.list (where release is, of course, some release name). Type the following:
Code:
sudo nano /etc/apt/sources.list.d/kubuntu-ppa*.list
Step 4. Clean up the downloads and update the cache once more (to reset priorities to the default of 500):
Code:
sudo apt-get clean sudo apt-get update
Comment