How do I revert all packages to their official versions?
I've installed a number of packages from PPAs, and I would like to revert to official versions now. Many of the PPAs no longer exist in /etc/apt/sources.list.d
, so ppa-purge
will not work on them.
What is the most straight-forward way for that?
ppa purge
add a comment |
I've installed a number of packages from PPAs, and I would like to revert to official versions now. Many of the PPAs no longer exist in /etc/apt/sources.list.d
, so ppa-purge
will not work on them.
What is the most straight-forward way for that?
ppa purge
add a comment |
I've installed a number of packages from PPAs, and I would like to revert to official versions now. Many of the PPAs no longer exist in /etc/apt/sources.list.d
, so ppa-purge
will not work on them.
What is the most straight-forward way for that?
ppa purge
I've installed a number of packages from PPAs, and I would like to revert to official versions now. Many of the PPAs no longer exist in /etc/apt/sources.list.d
, so ppa-purge
will not work on them.
What is the most straight-forward way for that?
ppa purge
ppa purge
edited Mar 14 '12 at 10:24
Bruno Pereira
59.7k26179206
59.7k26179206
asked Mar 14 '12 at 10:15
eudoxoseudoxos
604821
604821
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Well you can remove and reinstall the packages
ppa-purge
is probably still your best bet for a clean escape. Just re-adding the PPA the package came from and then using ppa-purge
to kill it. I'm not sure how many PPAs you have installed but if it's fewer than 10, I'd be looking at doing this.
If you think that method is too soft I've just written some bash
-porn to help identify package versions whose installation source now only exists locally in /var/lib/dpkg/status
. This is not the same as "orphaned" packages.
for p in `dpkg-query --showformat='${Package} ' -W`; do
if [[ $(apt-cache policy $p | grep -Pzo "*** [^n]+s+100") ]]; then
echo $p;
fi;
done
I'm not sure if this is perfect yet but give it a go. Note it's only going to print out the names of the packages. You're going to have to manually uninstall/reinstall each package.
To do that, first look at what is available for that package by running apt-cache policy <package>
and you'll see a list of package versions (including the /var/lib/dpkg/status
version). Find the nearest external one and run:
sudo apt-get install <package>=<version>
You might need to add a --reinstall
after the install
but see how it goes.
1
@Jokerdino That is subtly (but importantly) different. That only finds orphaned packages, that is, packages which have no current viable installation repository so it will only show things you've installed from a PPA that don't exist elsewhere. For things where you upgrade the current packages (eg if you used xorg-edgers to upgrade the whole X system) those packages aren't counted.
– Oli♦
Jul 20 '12 at 11:52
Sorry. I just noticed that and removed my comment (but it was too late.. :/). For reference to others who might want to follow the conversation, I linked to this answer.
– jokerdino♦
Jul 20 '12 at 11:53
As per the official statement, ppa-purge was removed from ubuntu because, all of its functionality can be done by apt-get. How can I do this with apt-get.
– rafee
Dec 27 '13 at 10:42
@rafee Why do you thinkppa-purge
was removed? It's in the repos for Trusty as well as every other supported release.
– Oli♦
Dec 27 '13 at 10:44
Its removed from default installation & it requires aptitude as dependency.
– rafee
Dec 27 '13 at 14:30
|
show 1 more comment
I've written a more complete script that will recognize packages whose current version is not from a PPA, and they have an alternative PPA-available version. After it runs, it prints a ready-to-run command that will downgrade such packages to their PPA versions.
https://gist.github.com/peci1/2d7859857fdad73ee8443f5ecd5ee5a3
#!/usr/bin/env bash
# BSD 3-clause license, copyright Martin Pecka @ 2019
# This script outputs a command that will revert all packages from non-PPA versions to their latest PPA version.
# This may be handy i.e. for finding packages for which you installed a newer version from a .deb file, or after
# incompletely removing a PPA.
export LC_ALL=C
command=""
for p in `dpkg-query --showformat='${Package} ' -W`; do
if [[ $(apt-cache policy $p | grep -Pzo "*** [^n]+s+100") ]]; then
versions=$(apt-cache policy $p | tr "n" "r" | grep -Po '(?<=r )[ *]{3} [^r]+ [0-9]+rs+[0-9]+' | sed 's/ [0-9]+rs+([0-9]+)/ 1/g' | tr "r" "n")
installable_versions=$(echo "${versions}" | grep -v " 100$")
version_to_install=$(echo "${installable_versions}" | head -n1 | grep -Po "s+K.*(?= [0-9]+$)")
if [[ ! -z "${version_to_install}" ]]; then
echo "${p}=${version_to_install}"
command="${command} ${p}=${version_to_install}"
else
echo "${p}: no PPA version"
fi
fi;
done
echo "To revert packages to their latest PPA version, call the following command as root. Please, carefully go through the list of changes apt-get will present to you!"
echo "apt-get install ${command}"
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f112865%2fhow-do-i-revert-all-packages-to-their-official-versions%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Well you can remove and reinstall the packages
ppa-purge
is probably still your best bet for a clean escape. Just re-adding the PPA the package came from and then using ppa-purge
to kill it. I'm not sure how many PPAs you have installed but if it's fewer than 10, I'd be looking at doing this.
If you think that method is too soft I've just written some bash
-porn to help identify package versions whose installation source now only exists locally in /var/lib/dpkg/status
. This is not the same as "orphaned" packages.
for p in `dpkg-query --showformat='${Package} ' -W`; do
if [[ $(apt-cache policy $p | grep -Pzo "*** [^n]+s+100") ]]; then
echo $p;
fi;
done
I'm not sure if this is perfect yet but give it a go. Note it's only going to print out the names of the packages. You're going to have to manually uninstall/reinstall each package.
To do that, first look at what is available for that package by running apt-cache policy <package>
and you'll see a list of package versions (including the /var/lib/dpkg/status
version). Find the nearest external one and run:
sudo apt-get install <package>=<version>
You might need to add a --reinstall
after the install
but see how it goes.
1
@Jokerdino That is subtly (but importantly) different. That only finds orphaned packages, that is, packages which have no current viable installation repository so it will only show things you've installed from a PPA that don't exist elsewhere. For things where you upgrade the current packages (eg if you used xorg-edgers to upgrade the whole X system) those packages aren't counted.
– Oli♦
Jul 20 '12 at 11:52
Sorry. I just noticed that and removed my comment (but it was too late.. :/). For reference to others who might want to follow the conversation, I linked to this answer.
– jokerdino♦
Jul 20 '12 at 11:53
As per the official statement, ppa-purge was removed from ubuntu because, all of its functionality can be done by apt-get. How can I do this with apt-get.
– rafee
Dec 27 '13 at 10:42
@rafee Why do you thinkppa-purge
was removed? It's in the repos for Trusty as well as every other supported release.
– Oli♦
Dec 27 '13 at 10:44
Its removed from default installation & it requires aptitude as dependency.
– rafee
Dec 27 '13 at 14:30
|
show 1 more comment
Well you can remove and reinstall the packages
ppa-purge
is probably still your best bet for a clean escape. Just re-adding the PPA the package came from and then using ppa-purge
to kill it. I'm not sure how many PPAs you have installed but if it's fewer than 10, I'd be looking at doing this.
If you think that method is too soft I've just written some bash
-porn to help identify package versions whose installation source now only exists locally in /var/lib/dpkg/status
. This is not the same as "orphaned" packages.
for p in `dpkg-query --showformat='${Package} ' -W`; do
if [[ $(apt-cache policy $p | grep -Pzo "*** [^n]+s+100") ]]; then
echo $p;
fi;
done
I'm not sure if this is perfect yet but give it a go. Note it's only going to print out the names of the packages. You're going to have to manually uninstall/reinstall each package.
To do that, first look at what is available for that package by running apt-cache policy <package>
and you'll see a list of package versions (including the /var/lib/dpkg/status
version). Find the nearest external one and run:
sudo apt-get install <package>=<version>
You might need to add a --reinstall
after the install
but see how it goes.
1
@Jokerdino That is subtly (but importantly) different. That only finds orphaned packages, that is, packages which have no current viable installation repository so it will only show things you've installed from a PPA that don't exist elsewhere. For things where you upgrade the current packages (eg if you used xorg-edgers to upgrade the whole X system) those packages aren't counted.
– Oli♦
Jul 20 '12 at 11:52
Sorry. I just noticed that and removed my comment (but it was too late.. :/). For reference to others who might want to follow the conversation, I linked to this answer.
– jokerdino♦
Jul 20 '12 at 11:53
As per the official statement, ppa-purge was removed from ubuntu because, all of its functionality can be done by apt-get. How can I do this with apt-get.
– rafee
Dec 27 '13 at 10:42
@rafee Why do you thinkppa-purge
was removed? It's in the repos for Trusty as well as every other supported release.
– Oli♦
Dec 27 '13 at 10:44
Its removed from default installation & it requires aptitude as dependency.
– rafee
Dec 27 '13 at 14:30
|
show 1 more comment
Well you can remove and reinstall the packages
ppa-purge
is probably still your best bet for a clean escape. Just re-adding the PPA the package came from and then using ppa-purge
to kill it. I'm not sure how many PPAs you have installed but if it's fewer than 10, I'd be looking at doing this.
If you think that method is too soft I've just written some bash
-porn to help identify package versions whose installation source now only exists locally in /var/lib/dpkg/status
. This is not the same as "orphaned" packages.
for p in `dpkg-query --showformat='${Package} ' -W`; do
if [[ $(apt-cache policy $p | grep -Pzo "*** [^n]+s+100") ]]; then
echo $p;
fi;
done
I'm not sure if this is perfect yet but give it a go. Note it's only going to print out the names of the packages. You're going to have to manually uninstall/reinstall each package.
To do that, first look at what is available for that package by running apt-cache policy <package>
and you'll see a list of package versions (including the /var/lib/dpkg/status
version). Find the nearest external one and run:
sudo apt-get install <package>=<version>
You might need to add a --reinstall
after the install
but see how it goes.
Well you can remove and reinstall the packages
ppa-purge
is probably still your best bet for a clean escape. Just re-adding the PPA the package came from and then using ppa-purge
to kill it. I'm not sure how many PPAs you have installed but if it's fewer than 10, I'd be looking at doing this.
If you think that method is too soft I've just written some bash
-porn to help identify package versions whose installation source now only exists locally in /var/lib/dpkg/status
. This is not the same as "orphaned" packages.
for p in `dpkg-query --showformat='${Package} ' -W`; do
if [[ $(apt-cache policy $p | grep -Pzo "*** [^n]+s+100") ]]; then
echo $p;
fi;
done
I'm not sure if this is perfect yet but give it a go. Note it's only going to print out the names of the packages. You're going to have to manually uninstall/reinstall each package.
To do that, first look at what is available for that package by running apt-cache policy <package>
and you'll see a list of package versions (including the /var/lib/dpkg/status
version). Find the nearest external one and run:
sudo apt-get install <package>=<version>
You might need to add a --reinstall
after the install
but see how it goes.
answered Mar 14 '12 at 11:15
Oli♦Oli
221k86559762
221k86559762
1
@Jokerdino That is subtly (but importantly) different. That only finds orphaned packages, that is, packages which have no current viable installation repository so it will only show things you've installed from a PPA that don't exist elsewhere. For things where you upgrade the current packages (eg if you used xorg-edgers to upgrade the whole X system) those packages aren't counted.
– Oli♦
Jul 20 '12 at 11:52
Sorry. I just noticed that and removed my comment (but it was too late.. :/). For reference to others who might want to follow the conversation, I linked to this answer.
– jokerdino♦
Jul 20 '12 at 11:53
As per the official statement, ppa-purge was removed from ubuntu because, all of its functionality can be done by apt-get. How can I do this with apt-get.
– rafee
Dec 27 '13 at 10:42
@rafee Why do you thinkppa-purge
was removed? It's in the repos for Trusty as well as every other supported release.
– Oli♦
Dec 27 '13 at 10:44
Its removed from default installation & it requires aptitude as dependency.
– rafee
Dec 27 '13 at 14:30
|
show 1 more comment
1
@Jokerdino That is subtly (but importantly) different. That only finds orphaned packages, that is, packages which have no current viable installation repository so it will only show things you've installed from a PPA that don't exist elsewhere. For things where you upgrade the current packages (eg if you used xorg-edgers to upgrade the whole X system) those packages aren't counted.
– Oli♦
Jul 20 '12 at 11:52
Sorry. I just noticed that and removed my comment (but it was too late.. :/). For reference to others who might want to follow the conversation, I linked to this answer.
– jokerdino♦
Jul 20 '12 at 11:53
As per the official statement, ppa-purge was removed from ubuntu because, all of its functionality can be done by apt-get. How can I do this with apt-get.
– rafee
Dec 27 '13 at 10:42
@rafee Why do you thinkppa-purge
was removed? It's in the repos for Trusty as well as every other supported release.
– Oli♦
Dec 27 '13 at 10:44
Its removed from default installation & it requires aptitude as dependency.
– rafee
Dec 27 '13 at 14:30
1
1
@Jokerdino That is subtly (but importantly) different. That only finds orphaned packages, that is, packages which have no current viable installation repository so it will only show things you've installed from a PPA that don't exist elsewhere. For things where you upgrade the current packages (eg if you used xorg-edgers to upgrade the whole X system) those packages aren't counted.
– Oli♦
Jul 20 '12 at 11:52
@Jokerdino That is subtly (but importantly) different. That only finds orphaned packages, that is, packages which have no current viable installation repository so it will only show things you've installed from a PPA that don't exist elsewhere. For things where you upgrade the current packages (eg if you used xorg-edgers to upgrade the whole X system) those packages aren't counted.
– Oli♦
Jul 20 '12 at 11:52
Sorry. I just noticed that and removed my comment (but it was too late.. :/). For reference to others who might want to follow the conversation, I linked to this answer.
– jokerdino♦
Jul 20 '12 at 11:53
Sorry. I just noticed that and removed my comment (but it was too late.. :/). For reference to others who might want to follow the conversation, I linked to this answer.
– jokerdino♦
Jul 20 '12 at 11:53
As per the official statement, ppa-purge was removed from ubuntu because, all of its functionality can be done by apt-get. How can I do this with apt-get.
– rafee
Dec 27 '13 at 10:42
As per the official statement, ppa-purge was removed from ubuntu because, all of its functionality can be done by apt-get. How can I do this with apt-get.
– rafee
Dec 27 '13 at 10:42
@rafee Why do you think
ppa-purge
was removed? It's in the repos for Trusty as well as every other supported release.– Oli♦
Dec 27 '13 at 10:44
@rafee Why do you think
ppa-purge
was removed? It's in the repos for Trusty as well as every other supported release.– Oli♦
Dec 27 '13 at 10:44
Its removed from default installation & it requires aptitude as dependency.
– rafee
Dec 27 '13 at 14:30
Its removed from default installation & it requires aptitude as dependency.
– rafee
Dec 27 '13 at 14:30
|
show 1 more comment
I've written a more complete script that will recognize packages whose current version is not from a PPA, and they have an alternative PPA-available version. After it runs, it prints a ready-to-run command that will downgrade such packages to their PPA versions.
https://gist.github.com/peci1/2d7859857fdad73ee8443f5ecd5ee5a3
#!/usr/bin/env bash
# BSD 3-clause license, copyright Martin Pecka @ 2019
# This script outputs a command that will revert all packages from non-PPA versions to their latest PPA version.
# This may be handy i.e. for finding packages for which you installed a newer version from a .deb file, or after
# incompletely removing a PPA.
export LC_ALL=C
command=""
for p in `dpkg-query --showformat='${Package} ' -W`; do
if [[ $(apt-cache policy $p | grep -Pzo "*** [^n]+s+100") ]]; then
versions=$(apt-cache policy $p | tr "n" "r" | grep -Po '(?<=r )[ *]{3} [^r]+ [0-9]+rs+[0-9]+' | sed 's/ [0-9]+rs+([0-9]+)/ 1/g' | tr "r" "n")
installable_versions=$(echo "${versions}" | grep -v " 100$")
version_to_install=$(echo "${installable_versions}" | head -n1 | grep -Po "s+K.*(?= [0-9]+$)")
if [[ ! -z "${version_to_install}" ]]; then
echo "${p}=${version_to_install}"
command="${command} ${p}=${version_to_install}"
else
echo "${p}: no PPA version"
fi
fi;
done
echo "To revert packages to their latest PPA version, call the following command as root. Please, carefully go through the list of changes apt-get will present to you!"
echo "apt-get install ${command}"
add a comment |
I've written a more complete script that will recognize packages whose current version is not from a PPA, and they have an alternative PPA-available version. After it runs, it prints a ready-to-run command that will downgrade such packages to their PPA versions.
https://gist.github.com/peci1/2d7859857fdad73ee8443f5ecd5ee5a3
#!/usr/bin/env bash
# BSD 3-clause license, copyright Martin Pecka @ 2019
# This script outputs a command that will revert all packages from non-PPA versions to their latest PPA version.
# This may be handy i.e. for finding packages for which you installed a newer version from a .deb file, or after
# incompletely removing a PPA.
export LC_ALL=C
command=""
for p in `dpkg-query --showformat='${Package} ' -W`; do
if [[ $(apt-cache policy $p | grep -Pzo "*** [^n]+s+100") ]]; then
versions=$(apt-cache policy $p | tr "n" "r" | grep -Po '(?<=r )[ *]{3} [^r]+ [0-9]+rs+[0-9]+' | sed 's/ [0-9]+rs+([0-9]+)/ 1/g' | tr "r" "n")
installable_versions=$(echo "${versions}" | grep -v " 100$")
version_to_install=$(echo "${installable_versions}" | head -n1 | grep -Po "s+K.*(?= [0-9]+$)")
if [[ ! -z "${version_to_install}" ]]; then
echo "${p}=${version_to_install}"
command="${command} ${p}=${version_to_install}"
else
echo "${p}: no PPA version"
fi
fi;
done
echo "To revert packages to their latest PPA version, call the following command as root. Please, carefully go through the list of changes apt-get will present to you!"
echo "apt-get install ${command}"
add a comment |
I've written a more complete script that will recognize packages whose current version is not from a PPA, and they have an alternative PPA-available version. After it runs, it prints a ready-to-run command that will downgrade such packages to their PPA versions.
https://gist.github.com/peci1/2d7859857fdad73ee8443f5ecd5ee5a3
#!/usr/bin/env bash
# BSD 3-clause license, copyright Martin Pecka @ 2019
# This script outputs a command that will revert all packages from non-PPA versions to their latest PPA version.
# This may be handy i.e. for finding packages for which you installed a newer version from a .deb file, or after
# incompletely removing a PPA.
export LC_ALL=C
command=""
for p in `dpkg-query --showformat='${Package} ' -W`; do
if [[ $(apt-cache policy $p | grep -Pzo "*** [^n]+s+100") ]]; then
versions=$(apt-cache policy $p | tr "n" "r" | grep -Po '(?<=r )[ *]{3} [^r]+ [0-9]+rs+[0-9]+' | sed 's/ [0-9]+rs+([0-9]+)/ 1/g' | tr "r" "n")
installable_versions=$(echo "${versions}" | grep -v " 100$")
version_to_install=$(echo "${installable_versions}" | head -n1 | grep -Po "s+K.*(?= [0-9]+$)")
if [[ ! -z "${version_to_install}" ]]; then
echo "${p}=${version_to_install}"
command="${command} ${p}=${version_to_install}"
else
echo "${p}: no PPA version"
fi
fi;
done
echo "To revert packages to their latest PPA version, call the following command as root. Please, carefully go through the list of changes apt-get will present to you!"
echo "apt-get install ${command}"
I've written a more complete script that will recognize packages whose current version is not from a PPA, and they have an alternative PPA-available version. After it runs, it prints a ready-to-run command that will downgrade such packages to their PPA versions.
https://gist.github.com/peci1/2d7859857fdad73ee8443f5ecd5ee5a3
#!/usr/bin/env bash
# BSD 3-clause license, copyright Martin Pecka @ 2019
# This script outputs a command that will revert all packages from non-PPA versions to their latest PPA version.
# This may be handy i.e. for finding packages for which you installed a newer version from a .deb file, or after
# incompletely removing a PPA.
export LC_ALL=C
command=""
for p in `dpkg-query --showformat='${Package} ' -W`; do
if [[ $(apt-cache policy $p | grep -Pzo "*** [^n]+s+100") ]]; then
versions=$(apt-cache policy $p | tr "n" "r" | grep -Po '(?<=r )[ *]{3} [^r]+ [0-9]+rs+[0-9]+' | sed 's/ [0-9]+rs+([0-9]+)/ 1/g' | tr "r" "n")
installable_versions=$(echo "${versions}" | grep -v " 100$")
version_to_install=$(echo "${installable_versions}" | head -n1 | grep -Po "s+K.*(?= [0-9]+$)")
if [[ ! -z "${version_to_install}" ]]; then
echo "${p}=${version_to_install}"
command="${command} ${p}=${version_to_install}"
else
echo "${p}: no PPA version"
fi
fi;
done
echo "To revert packages to their latest PPA version, call the following command as root. Please, carefully go through the list of changes apt-get will present to you!"
echo "apt-get install ${command}"
answered Jan 7 at 12:58
Martin PeckaMartin Pecka
14011
14011
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f112865%2fhow-do-i-revert-all-packages-to-their-official-versions%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown