2

In redhat-based distros, the yum tool has a distro-sync command which will synchronize packages to the current repositories. This command is useful for returning to a base state if base packages have been modified from an outside source. The docs for the command is:

distribution-synchronization or distro-sync Synchronizes the installed package set with the latest packages available, this is done by either obsoleting, upgrading or downgrading as appropriate. This will "normally" do the same thing as the upgrade command however if you have the package FOO installed at version 4, and the latest available is only version 3, then this command will downgrade FOO to version 3.

Is there an equivalent operation in Ubuntu?

2 Answers 2

2

I think you can do this by a adding a /etc/apt/preferences profile that pinned all packages to the distro/release that repo represents. The next time you run apt-get upgrade it will downgrade as necessary to satisfy the rules specified. See man apt_preferences for details.

http://wiki.debian.org/AptPreferences

The flip side of this is to prevent this from occurring to begin with by pinning the packages you have a stake in staying stable. So if they're updated by an outside source, the next apt-get upgrade will revert just that and not your entire OS.

1
  • Thanks, I will try that out. The use case that brought this up was that I installed the Unity 5.0 PPA in Precise. When 5.0 was added to precise, I wanted to track the percise repo and remove the PPA. Jan 18, 2012 at 17:07
0

No, there is no such command in the apt package system, for what I know.

The dist-upgrade command of apt-get is similar, but it do not downgrade packages. The install command could downgrade a package as in

sudo apt-get install "package"="version"

but as you see you should explicitly give the desired version number, which you can retrieve from

apt-cache policy "package"
1
  • Yes, dist-upgrade does downgrade packages. Otherwise this is correct. Aug 25, 2014 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.