Remove package and installed dependencies with apt-get

Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
So I install a package
apt-get install mypackage
apt-get installs the package with dependencies, and reports that 10 megabytes were installed on my disk.
But I change my mind, so I go
apt-get remove mypackage
And apt-get announces that 166 kilobytes will be freed.
I don't want to litter my disk with leftovers, so I try
apt-get autoremove mypackage
Now apt-get wants to remove 166 megabytes from my disk.
How do I, you know, undo the last install operation, or just uninstall a single package and all its dependencies?
Alternatively, is there another package management tool that I could use (even on different distro), which would roughly treat install operations as atomic operations which can be done and undone?
apt package-management
add a comment |Â
up vote
1
down vote
favorite
So I install a package
apt-get install mypackage
apt-get installs the package with dependencies, and reports that 10 megabytes were installed on my disk.
But I change my mind, so I go
apt-get remove mypackage
And apt-get announces that 166 kilobytes will be freed.
I don't want to litter my disk with leftovers, so I try
apt-get autoremove mypackage
Now apt-get wants to remove 166 megabytes from my disk.
How do I, you know, undo the last install operation, or just uninstall a single package and all its dependencies?
Alternatively, is there another package management tool that I could use (even on different distro), which would roughly treat install operations as atomic operations which can be done and undone?
apt package-management
1
yumhashistory undo.
â Weijun Zhou
Jan 15 at 9:18
@WeijunZhou Thank you. I also discovered thatdnfalso has the ability to autoremove a specific package. I am considering switching to Fedora (I'm on Debian), but I'll try to getyumworking on Debian first.
â Rolf
Jan 15 at 9:34
dnfis just a successor ofyum.
â Weijun Zhou
Jan 15 at 9:38
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
So I install a package
apt-get install mypackage
apt-get installs the package with dependencies, and reports that 10 megabytes were installed on my disk.
But I change my mind, so I go
apt-get remove mypackage
And apt-get announces that 166 kilobytes will be freed.
I don't want to litter my disk with leftovers, so I try
apt-get autoremove mypackage
Now apt-get wants to remove 166 megabytes from my disk.
How do I, you know, undo the last install operation, or just uninstall a single package and all its dependencies?
Alternatively, is there another package management tool that I could use (even on different distro), which would roughly treat install operations as atomic operations which can be done and undone?
apt package-management
So I install a package
apt-get install mypackage
apt-get installs the package with dependencies, and reports that 10 megabytes were installed on my disk.
But I change my mind, so I go
apt-get remove mypackage
And apt-get announces that 166 kilobytes will be freed.
I don't want to litter my disk with leftovers, so I try
apt-get autoremove mypackage
Now apt-get wants to remove 166 megabytes from my disk.
How do I, you know, undo the last install operation, or just uninstall a single package and all its dependencies?
Alternatively, is there another package management tool that I could use (even on different distro), which would roughly treat install operations as atomic operations which can be done and undone?
apt package-management
edited Jan 15 at 9:59
asked Jan 15 at 9:10
Rolf
11610
11610
1
yumhashistory undo.
â Weijun Zhou
Jan 15 at 9:18
@WeijunZhou Thank you. I also discovered thatdnfalso has the ability to autoremove a specific package. I am considering switching to Fedora (I'm on Debian), but I'll try to getyumworking on Debian first.
â Rolf
Jan 15 at 9:34
dnfis just a successor ofyum.
â Weijun Zhou
Jan 15 at 9:38
add a comment |Â
1
yumhashistory undo.
â Weijun Zhou
Jan 15 at 9:18
@WeijunZhou Thank you. I also discovered thatdnfalso has the ability to autoremove a specific package. I am considering switching to Fedora (I'm on Debian), but I'll try to getyumworking on Debian first.
â Rolf
Jan 15 at 9:34
dnfis just a successor ofyum.
â Weijun Zhou
Jan 15 at 9:38
1
1
yum has history undo.â Weijun Zhou
Jan 15 at 9:18
yum has history undo.â Weijun Zhou
Jan 15 at 9:18
@WeijunZhou Thank you. I also discovered that
dnf also has the ability to autoremove a specific package. I am considering switching to Fedora (I'm on Debian), but I'll try to get yum working on Debian first.â Rolf
Jan 15 at 9:34
@WeijunZhou Thank you. I also discovered that
dnf also has the ability to autoremove a specific package. I am considering switching to Fedora (I'm on Debian), but I'll try to get yum working on Debian first.â Rolf
Jan 15 at 9:34
dnf is just a successor of yum.â Weijun Zhou
Jan 15 at 9:38
dnf is just a successor of yum.â Weijun Zhou
Jan 15 at 9:38
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
3
down vote
APT doesnâÂÂt manage package changes as transactions, so thereâÂÂs no built-in operation to undo a package installation (or any other package manipulation). However, it does log all the operations it performs, grouped by end-user request: if you look in /var/log/apt/history.log, youâÂÂll find the mypackage installation, along with a list of all the other packages which were installed automatically alongside it. You can use this to undo the installation manually.
You could also use aptitude instead, for your general package management: it effectively autoremoves by default. This wonâÂÂt help you right now though since it will want to remove the same 166MiB of packages as apt autoremove.
As pointed out by Weijun Zhou, yum and dnf do manage package changes as units which can be undone (in some circumstances). dnf history will list the transactions stored in the history, and dnf history rollback or dnf history undo can be used to roll the history back or undo a specific transaction (if possible). IâÂÂm not sure yum or dnf can be used properly instead of APT on Debian-based systems; you might need to switch to Fedora, RHEL or CentOS if you want to use those tools for all your package management.
Thank you. I think that apt should have the ability to "autoremove" a specific package. In this particular case, it would have the same effect, and would also be an acceptable solution. Indeedyumanddnfdeal with RPM packages. Debian is packaged in 'deb' packages. Trying to replace APT withyumordnfon a Debian system seems impractical.
â Rolf
Jan 15 at 9:55
A package-specificautoremovecouldnâÂÂt always be relied upon to undo a package installation, because the package installation might have pulled in a package which is of interest to some other installed package. See this question for an example where this wouldnâÂÂt work.
â Stephen Kitt
Jan 15 at 10:03
I understand what you're saying. However I'm sure it's possible, with edge cases, of course. What I'm seeing is apt-get installing suggested and recommended package, then not removing them, which is default behavior. I want to modify this behavior (in the uninstall stage) but only for a specific package.
â Rolf
Jan 15 at 11:04
1
I understand what youâÂÂre after, IâÂÂm just saying it canâÂÂt be done currently. Ifapt-get remove --autoremove mypackageonly removed autoremovable packages which were inmypackageâÂÂs dependency tree, it would give the results youâÂÂre after (or close enough), but it currently doesnâÂÂt do that. There is one way of getting what youâÂÂre after currently, but it relies on a process change rather than a tool change: never leave autoremovable packages lying around â either always remove them, or mark them as manually installed if you want to keep them.
â Stephen Kitt
Jan 15 at 12:25
add a comment |Â
up vote
0
down vote
By the way:
I found that the most reliable way to "undo" an install operation is to look at the apt log and uninstall all packages which were installed by this operation.
Therefore I created a solution to my problem. It helps with parsing the apt log and reverting operations.
This is how I would use it:
List last 10 apt operations:
sudo cat /var/log/apt/history.log |apt-history
91 apt-get install pulseaudio*
92 apt-get install gnome-control-center*
93 apt-get install pavucontrol
94 apt-get upgrade sublime-text
95 /usr/bin/unattended-upgrade
96 /usr/bin/unattended-upgrade
97 apt-get install adb
98 apt-get dist-upgrade
99 /usr/bin/unattended-upgrade
100 apt-get install qemu-system
Display details about all packages which were installed by operation #100 (the last one)
sudo cat /var/log/apt/history.log |apt-history 100 Install
seabios:amd64 (1.10.2-1, automatic), ipxe-qemu:amd64 (1.0.0+git-20161027.b991c67-1, automatic), qemu-system-mips:amd64 (1:2.8+dfsg-6+deb9u3, automatic), openbios-sparc:amd64 (1.1.git20161120-2, automatic), qemu-system-misc:amd64 (1:2.8+dfsg-6+deb9u3, automatic), qemu-system-ppc:amd64 (1:2.8+dfsg-6+deb9u3, automatic), libvdeplug2:amd64 (2.3.2+r586-2.1, automatic), qemu-system-x86:amd64 (1:2.8+dfsg-6+deb9u3, automatic), openhackware:amd64 (0.4.1+git-20140423.c559da7c-4, automatic), libspice-server1:amd64 (0.12.8-2.1+deb9u1, automatic), libxenstore3.0:amd64 (4.8.3+xsa262+shim4.10.0+comet3-1+deb9u6, automatic), qemu-utils:amd64 (1:2.8+dfsg-6+deb9u3, automatic), qemu-efi:amd64 (0~20161202.7bbe0b3e-1, automatic), qemu-system-sparc:amd64 (1:2.8+dfsg-6+deb9u3, automatic), libxen-4.8:amd64 (4.8.3+xsa262+shim4.10.0+comet3-1+deb9u6, automatic), libfdt1:amd64 (1.4.2-1, automatic), qemu-slof:amd64 (20161019+dfsg-1, automatic), qemu-system-arm:amd64 (1:2.8+dfsg-6+deb9u3, automatic), qemu-system-common:amd64 (1:2.8+dfsg-6+deb9u3, automatic), openbios-ppc:amd64 (1.1.git20161120-2, automatic), qemu-system:amd64 (1:2.8+dfsg-6+deb9u3)
Uninstall these packages and their configuration.
sudo apt-get remove --purge `sudo cat /var/log/apt/history.log |apt-history 100 Install as-apt-arguments`
Warning: to avoid unforseen consequences, only do this for the last install command and roll back one command at a time.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
APT doesnâÂÂt manage package changes as transactions, so thereâÂÂs no built-in operation to undo a package installation (or any other package manipulation). However, it does log all the operations it performs, grouped by end-user request: if you look in /var/log/apt/history.log, youâÂÂll find the mypackage installation, along with a list of all the other packages which were installed automatically alongside it. You can use this to undo the installation manually.
You could also use aptitude instead, for your general package management: it effectively autoremoves by default. This wonâÂÂt help you right now though since it will want to remove the same 166MiB of packages as apt autoremove.
As pointed out by Weijun Zhou, yum and dnf do manage package changes as units which can be undone (in some circumstances). dnf history will list the transactions stored in the history, and dnf history rollback or dnf history undo can be used to roll the history back or undo a specific transaction (if possible). IâÂÂm not sure yum or dnf can be used properly instead of APT on Debian-based systems; you might need to switch to Fedora, RHEL or CentOS if you want to use those tools for all your package management.
Thank you. I think that apt should have the ability to "autoremove" a specific package. In this particular case, it would have the same effect, and would also be an acceptable solution. Indeedyumanddnfdeal with RPM packages. Debian is packaged in 'deb' packages. Trying to replace APT withyumordnfon a Debian system seems impractical.
â Rolf
Jan 15 at 9:55
A package-specificautoremovecouldnâÂÂt always be relied upon to undo a package installation, because the package installation might have pulled in a package which is of interest to some other installed package. See this question for an example where this wouldnâÂÂt work.
â Stephen Kitt
Jan 15 at 10:03
I understand what you're saying. However I'm sure it's possible, with edge cases, of course. What I'm seeing is apt-get installing suggested and recommended package, then not removing them, which is default behavior. I want to modify this behavior (in the uninstall stage) but only for a specific package.
â Rolf
Jan 15 at 11:04
1
I understand what youâÂÂre after, IâÂÂm just saying it canâÂÂt be done currently. Ifapt-get remove --autoremove mypackageonly removed autoremovable packages which were inmypackageâÂÂs dependency tree, it would give the results youâÂÂre after (or close enough), but it currently doesnâÂÂt do that. There is one way of getting what youâÂÂre after currently, but it relies on a process change rather than a tool change: never leave autoremovable packages lying around â either always remove them, or mark them as manually installed if you want to keep them.
â Stephen Kitt
Jan 15 at 12:25
add a comment |Â
up vote
3
down vote
APT doesnâÂÂt manage package changes as transactions, so thereâÂÂs no built-in operation to undo a package installation (or any other package manipulation). However, it does log all the operations it performs, grouped by end-user request: if you look in /var/log/apt/history.log, youâÂÂll find the mypackage installation, along with a list of all the other packages which were installed automatically alongside it. You can use this to undo the installation manually.
You could also use aptitude instead, for your general package management: it effectively autoremoves by default. This wonâÂÂt help you right now though since it will want to remove the same 166MiB of packages as apt autoremove.
As pointed out by Weijun Zhou, yum and dnf do manage package changes as units which can be undone (in some circumstances). dnf history will list the transactions stored in the history, and dnf history rollback or dnf history undo can be used to roll the history back or undo a specific transaction (if possible). IâÂÂm not sure yum or dnf can be used properly instead of APT on Debian-based systems; you might need to switch to Fedora, RHEL or CentOS if you want to use those tools for all your package management.
Thank you. I think that apt should have the ability to "autoremove" a specific package. In this particular case, it would have the same effect, and would also be an acceptable solution. Indeedyumanddnfdeal with RPM packages. Debian is packaged in 'deb' packages. Trying to replace APT withyumordnfon a Debian system seems impractical.
â Rolf
Jan 15 at 9:55
A package-specificautoremovecouldnâÂÂt always be relied upon to undo a package installation, because the package installation might have pulled in a package which is of interest to some other installed package. See this question for an example where this wouldnâÂÂt work.
â Stephen Kitt
Jan 15 at 10:03
I understand what you're saying. However I'm sure it's possible, with edge cases, of course. What I'm seeing is apt-get installing suggested and recommended package, then not removing them, which is default behavior. I want to modify this behavior (in the uninstall stage) but only for a specific package.
â Rolf
Jan 15 at 11:04
1
I understand what youâÂÂre after, IâÂÂm just saying it canâÂÂt be done currently. Ifapt-get remove --autoremove mypackageonly removed autoremovable packages which were inmypackageâÂÂs dependency tree, it would give the results youâÂÂre after (or close enough), but it currently doesnâÂÂt do that. There is one way of getting what youâÂÂre after currently, but it relies on a process change rather than a tool change: never leave autoremovable packages lying around â either always remove them, or mark them as manually installed if you want to keep them.
â Stephen Kitt
Jan 15 at 12:25
add a comment |Â
up vote
3
down vote
up vote
3
down vote
APT doesnâÂÂt manage package changes as transactions, so thereâÂÂs no built-in operation to undo a package installation (or any other package manipulation). However, it does log all the operations it performs, grouped by end-user request: if you look in /var/log/apt/history.log, youâÂÂll find the mypackage installation, along with a list of all the other packages which were installed automatically alongside it. You can use this to undo the installation manually.
You could also use aptitude instead, for your general package management: it effectively autoremoves by default. This wonâÂÂt help you right now though since it will want to remove the same 166MiB of packages as apt autoremove.
As pointed out by Weijun Zhou, yum and dnf do manage package changes as units which can be undone (in some circumstances). dnf history will list the transactions stored in the history, and dnf history rollback or dnf history undo can be used to roll the history back or undo a specific transaction (if possible). IâÂÂm not sure yum or dnf can be used properly instead of APT on Debian-based systems; you might need to switch to Fedora, RHEL or CentOS if you want to use those tools for all your package management.
APT doesnâÂÂt manage package changes as transactions, so thereâÂÂs no built-in operation to undo a package installation (or any other package manipulation). However, it does log all the operations it performs, grouped by end-user request: if you look in /var/log/apt/history.log, youâÂÂll find the mypackage installation, along with a list of all the other packages which were installed automatically alongside it. You can use this to undo the installation manually.
You could also use aptitude instead, for your general package management: it effectively autoremoves by default. This wonâÂÂt help you right now though since it will want to remove the same 166MiB of packages as apt autoremove.
As pointed out by Weijun Zhou, yum and dnf do manage package changes as units which can be undone (in some circumstances). dnf history will list the transactions stored in the history, and dnf history rollback or dnf history undo can be used to roll the history back or undo a specific transaction (if possible). IâÂÂm not sure yum or dnf can be used properly instead of APT on Debian-based systems; you might need to switch to Fedora, RHEL or CentOS if you want to use those tools for all your package management.
answered Jan 15 at 9:46
Stephen Kitt
142k22308371
142k22308371
Thank you. I think that apt should have the ability to "autoremove" a specific package. In this particular case, it would have the same effect, and would also be an acceptable solution. Indeedyumanddnfdeal with RPM packages. Debian is packaged in 'deb' packages. Trying to replace APT withyumordnfon a Debian system seems impractical.
â Rolf
Jan 15 at 9:55
A package-specificautoremovecouldnâÂÂt always be relied upon to undo a package installation, because the package installation might have pulled in a package which is of interest to some other installed package. See this question for an example where this wouldnâÂÂt work.
â Stephen Kitt
Jan 15 at 10:03
I understand what you're saying. However I'm sure it's possible, with edge cases, of course. What I'm seeing is apt-get installing suggested and recommended package, then not removing them, which is default behavior. I want to modify this behavior (in the uninstall stage) but only for a specific package.
â Rolf
Jan 15 at 11:04
1
I understand what youâÂÂre after, IâÂÂm just saying it canâÂÂt be done currently. Ifapt-get remove --autoremove mypackageonly removed autoremovable packages which were inmypackageâÂÂs dependency tree, it would give the results youâÂÂre after (or close enough), but it currently doesnâÂÂt do that. There is one way of getting what youâÂÂre after currently, but it relies on a process change rather than a tool change: never leave autoremovable packages lying around â either always remove them, or mark them as manually installed if you want to keep them.
â Stephen Kitt
Jan 15 at 12:25
add a comment |Â
Thank you. I think that apt should have the ability to "autoremove" a specific package. In this particular case, it would have the same effect, and would also be an acceptable solution. Indeedyumanddnfdeal with RPM packages. Debian is packaged in 'deb' packages. Trying to replace APT withyumordnfon a Debian system seems impractical.
â Rolf
Jan 15 at 9:55
A package-specificautoremovecouldnâÂÂt always be relied upon to undo a package installation, because the package installation might have pulled in a package which is of interest to some other installed package. See this question for an example where this wouldnâÂÂt work.
â Stephen Kitt
Jan 15 at 10:03
I understand what you're saying. However I'm sure it's possible, with edge cases, of course. What I'm seeing is apt-get installing suggested and recommended package, then not removing them, which is default behavior. I want to modify this behavior (in the uninstall stage) but only for a specific package.
â Rolf
Jan 15 at 11:04
1
I understand what youâÂÂre after, IâÂÂm just saying it canâÂÂt be done currently. Ifapt-get remove --autoremove mypackageonly removed autoremovable packages which were inmypackageâÂÂs dependency tree, it would give the results youâÂÂre after (or close enough), but it currently doesnâÂÂt do that. There is one way of getting what youâÂÂre after currently, but it relies on a process change rather than a tool change: never leave autoremovable packages lying around â either always remove them, or mark them as manually installed if you want to keep them.
â Stephen Kitt
Jan 15 at 12:25
Thank you. I think that apt should have the ability to "autoremove" a specific package. In this particular case, it would have the same effect, and would also be an acceptable solution. Indeed
yum and dnf deal with RPM packages. Debian is packaged in 'deb' packages. Trying to replace APT with yum or dnf on a Debian system seems impractical.â Rolf
Jan 15 at 9:55
Thank you. I think that apt should have the ability to "autoremove" a specific package. In this particular case, it would have the same effect, and would also be an acceptable solution. Indeed
yum and dnf deal with RPM packages. Debian is packaged in 'deb' packages. Trying to replace APT with yum or dnf on a Debian system seems impractical.â Rolf
Jan 15 at 9:55
A package-specific
autoremove couldnâÂÂt always be relied upon to undo a package installation, because the package installation might have pulled in a package which is of interest to some other installed package. See this question for an example where this wouldnâÂÂt work.â Stephen Kitt
Jan 15 at 10:03
A package-specific
autoremove couldnâÂÂt always be relied upon to undo a package installation, because the package installation might have pulled in a package which is of interest to some other installed package. See this question for an example where this wouldnâÂÂt work.â Stephen Kitt
Jan 15 at 10:03
I understand what you're saying. However I'm sure it's possible, with edge cases, of course. What I'm seeing is apt-get installing suggested and recommended package, then not removing them, which is default behavior. I want to modify this behavior (in the uninstall stage) but only for a specific package.
â Rolf
Jan 15 at 11:04
I understand what you're saying. However I'm sure it's possible, with edge cases, of course. What I'm seeing is apt-get installing suggested and recommended package, then not removing them, which is default behavior. I want to modify this behavior (in the uninstall stage) but only for a specific package.
â Rolf
Jan 15 at 11:04
1
1
I understand what youâÂÂre after, IâÂÂm just saying it canâÂÂt be done currently. If
apt-get remove --autoremove mypackage only removed autoremovable packages which were in mypackageâÂÂs dependency tree, it would give the results youâÂÂre after (or close enough), but it currently doesnâÂÂt do that. There is one way of getting what youâÂÂre after currently, but it relies on a process change rather than a tool change: never leave autoremovable packages lying around â either always remove them, or mark them as manually installed if you want to keep them.â Stephen Kitt
Jan 15 at 12:25
I understand what youâÂÂre after, IâÂÂm just saying it canâÂÂt be done currently. If
apt-get remove --autoremove mypackage only removed autoremovable packages which were in mypackageâÂÂs dependency tree, it would give the results youâÂÂre after (or close enough), but it currently doesnâÂÂt do that. There is one way of getting what youâÂÂre after currently, but it relies on a process change rather than a tool change: never leave autoremovable packages lying around â either always remove them, or mark them as manually installed if you want to keep them.â Stephen Kitt
Jan 15 at 12:25
add a comment |Â
up vote
0
down vote
By the way:
I found that the most reliable way to "undo" an install operation is to look at the apt log and uninstall all packages which were installed by this operation.
Therefore I created a solution to my problem. It helps with parsing the apt log and reverting operations.
This is how I would use it:
List last 10 apt operations:
sudo cat /var/log/apt/history.log |apt-history
91 apt-get install pulseaudio*
92 apt-get install gnome-control-center*
93 apt-get install pavucontrol
94 apt-get upgrade sublime-text
95 /usr/bin/unattended-upgrade
96 /usr/bin/unattended-upgrade
97 apt-get install adb
98 apt-get dist-upgrade
99 /usr/bin/unattended-upgrade
100 apt-get install qemu-system
Display details about all packages which were installed by operation #100 (the last one)
sudo cat /var/log/apt/history.log |apt-history 100 Install
seabios:amd64 (1.10.2-1, automatic), ipxe-qemu:amd64 (1.0.0+git-20161027.b991c67-1, automatic), qemu-system-mips:amd64 (1:2.8+dfsg-6+deb9u3, automatic), openbios-sparc:amd64 (1.1.git20161120-2, automatic), qemu-system-misc:amd64 (1:2.8+dfsg-6+deb9u3, automatic), qemu-system-ppc:amd64 (1:2.8+dfsg-6+deb9u3, automatic), libvdeplug2:amd64 (2.3.2+r586-2.1, automatic), qemu-system-x86:amd64 (1:2.8+dfsg-6+deb9u3, automatic), openhackware:amd64 (0.4.1+git-20140423.c559da7c-4, automatic), libspice-server1:amd64 (0.12.8-2.1+deb9u1, automatic), libxenstore3.0:amd64 (4.8.3+xsa262+shim4.10.0+comet3-1+deb9u6, automatic), qemu-utils:amd64 (1:2.8+dfsg-6+deb9u3, automatic), qemu-efi:amd64 (0~20161202.7bbe0b3e-1, automatic), qemu-system-sparc:amd64 (1:2.8+dfsg-6+deb9u3, automatic), libxen-4.8:amd64 (4.8.3+xsa262+shim4.10.0+comet3-1+deb9u6, automatic), libfdt1:amd64 (1.4.2-1, automatic), qemu-slof:amd64 (20161019+dfsg-1, automatic), qemu-system-arm:amd64 (1:2.8+dfsg-6+deb9u3, automatic), qemu-system-common:amd64 (1:2.8+dfsg-6+deb9u3, automatic), openbios-ppc:amd64 (1.1.git20161120-2, automatic), qemu-system:amd64 (1:2.8+dfsg-6+deb9u3)
Uninstall these packages and their configuration.
sudo apt-get remove --purge `sudo cat /var/log/apt/history.log |apt-history 100 Install as-apt-arguments`
Warning: to avoid unforseen consequences, only do this for the last install command and roll back one command at a time.
add a comment |Â
up vote
0
down vote
By the way:
I found that the most reliable way to "undo" an install operation is to look at the apt log and uninstall all packages which were installed by this operation.
Therefore I created a solution to my problem. It helps with parsing the apt log and reverting operations.
This is how I would use it:
List last 10 apt operations:
sudo cat /var/log/apt/history.log |apt-history
91 apt-get install pulseaudio*
92 apt-get install gnome-control-center*
93 apt-get install pavucontrol
94 apt-get upgrade sublime-text
95 /usr/bin/unattended-upgrade
96 /usr/bin/unattended-upgrade
97 apt-get install adb
98 apt-get dist-upgrade
99 /usr/bin/unattended-upgrade
100 apt-get install qemu-system
Display details about all packages which were installed by operation #100 (the last one)
sudo cat /var/log/apt/history.log |apt-history 100 Install
seabios:amd64 (1.10.2-1, automatic), ipxe-qemu:amd64 (1.0.0+git-20161027.b991c67-1, automatic), qemu-system-mips:amd64 (1:2.8+dfsg-6+deb9u3, automatic), openbios-sparc:amd64 (1.1.git20161120-2, automatic), qemu-system-misc:amd64 (1:2.8+dfsg-6+deb9u3, automatic), qemu-system-ppc:amd64 (1:2.8+dfsg-6+deb9u3, automatic), libvdeplug2:amd64 (2.3.2+r586-2.1, automatic), qemu-system-x86:amd64 (1:2.8+dfsg-6+deb9u3, automatic), openhackware:amd64 (0.4.1+git-20140423.c559da7c-4, automatic), libspice-server1:amd64 (0.12.8-2.1+deb9u1, automatic), libxenstore3.0:amd64 (4.8.3+xsa262+shim4.10.0+comet3-1+deb9u6, automatic), qemu-utils:amd64 (1:2.8+dfsg-6+deb9u3, automatic), qemu-efi:amd64 (0~20161202.7bbe0b3e-1, automatic), qemu-system-sparc:amd64 (1:2.8+dfsg-6+deb9u3, automatic), libxen-4.8:amd64 (4.8.3+xsa262+shim4.10.0+comet3-1+deb9u6, automatic), libfdt1:amd64 (1.4.2-1, automatic), qemu-slof:amd64 (20161019+dfsg-1, automatic), qemu-system-arm:amd64 (1:2.8+dfsg-6+deb9u3, automatic), qemu-system-common:amd64 (1:2.8+dfsg-6+deb9u3, automatic), openbios-ppc:amd64 (1.1.git20161120-2, automatic), qemu-system:amd64 (1:2.8+dfsg-6+deb9u3)
Uninstall these packages and their configuration.
sudo apt-get remove --purge `sudo cat /var/log/apt/history.log |apt-history 100 Install as-apt-arguments`
Warning: to avoid unforseen consequences, only do this for the last install command and roll back one command at a time.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
By the way:
I found that the most reliable way to "undo" an install operation is to look at the apt log and uninstall all packages which were installed by this operation.
Therefore I created a solution to my problem. It helps with parsing the apt log and reverting operations.
This is how I would use it:
List last 10 apt operations:
sudo cat /var/log/apt/history.log |apt-history
91 apt-get install pulseaudio*
92 apt-get install gnome-control-center*
93 apt-get install pavucontrol
94 apt-get upgrade sublime-text
95 /usr/bin/unattended-upgrade
96 /usr/bin/unattended-upgrade
97 apt-get install adb
98 apt-get dist-upgrade
99 /usr/bin/unattended-upgrade
100 apt-get install qemu-system
Display details about all packages which were installed by operation #100 (the last one)
sudo cat /var/log/apt/history.log |apt-history 100 Install
seabios:amd64 (1.10.2-1, automatic), ipxe-qemu:amd64 (1.0.0+git-20161027.b991c67-1, automatic), qemu-system-mips:amd64 (1:2.8+dfsg-6+deb9u3, automatic), openbios-sparc:amd64 (1.1.git20161120-2, automatic), qemu-system-misc:amd64 (1:2.8+dfsg-6+deb9u3, automatic), qemu-system-ppc:amd64 (1:2.8+dfsg-6+deb9u3, automatic), libvdeplug2:amd64 (2.3.2+r586-2.1, automatic), qemu-system-x86:amd64 (1:2.8+dfsg-6+deb9u3, automatic), openhackware:amd64 (0.4.1+git-20140423.c559da7c-4, automatic), libspice-server1:amd64 (0.12.8-2.1+deb9u1, automatic), libxenstore3.0:amd64 (4.8.3+xsa262+shim4.10.0+comet3-1+deb9u6, automatic), qemu-utils:amd64 (1:2.8+dfsg-6+deb9u3, automatic), qemu-efi:amd64 (0~20161202.7bbe0b3e-1, automatic), qemu-system-sparc:amd64 (1:2.8+dfsg-6+deb9u3, automatic), libxen-4.8:amd64 (4.8.3+xsa262+shim4.10.0+comet3-1+deb9u6, automatic), libfdt1:amd64 (1.4.2-1, automatic), qemu-slof:amd64 (20161019+dfsg-1, automatic), qemu-system-arm:amd64 (1:2.8+dfsg-6+deb9u3, automatic), qemu-system-common:amd64 (1:2.8+dfsg-6+deb9u3, automatic), openbios-ppc:amd64 (1.1.git20161120-2, automatic), qemu-system:amd64 (1:2.8+dfsg-6+deb9u3)
Uninstall these packages and their configuration.
sudo apt-get remove --purge `sudo cat /var/log/apt/history.log |apt-history 100 Install as-apt-arguments`
Warning: to avoid unforseen consequences, only do this for the last install command and roll back one command at a time.
By the way:
I found that the most reliable way to "undo" an install operation is to look at the apt log and uninstall all packages which were installed by this operation.
Therefore I created a solution to my problem. It helps with parsing the apt log and reverting operations.
This is how I would use it:
List last 10 apt operations:
sudo cat /var/log/apt/history.log |apt-history
91 apt-get install pulseaudio*
92 apt-get install gnome-control-center*
93 apt-get install pavucontrol
94 apt-get upgrade sublime-text
95 /usr/bin/unattended-upgrade
96 /usr/bin/unattended-upgrade
97 apt-get install adb
98 apt-get dist-upgrade
99 /usr/bin/unattended-upgrade
100 apt-get install qemu-system
Display details about all packages which were installed by operation #100 (the last one)
sudo cat /var/log/apt/history.log |apt-history 100 Install
seabios:amd64 (1.10.2-1, automatic), ipxe-qemu:amd64 (1.0.0+git-20161027.b991c67-1, automatic), qemu-system-mips:amd64 (1:2.8+dfsg-6+deb9u3, automatic), openbios-sparc:amd64 (1.1.git20161120-2, automatic), qemu-system-misc:amd64 (1:2.8+dfsg-6+deb9u3, automatic), qemu-system-ppc:amd64 (1:2.8+dfsg-6+deb9u3, automatic), libvdeplug2:amd64 (2.3.2+r586-2.1, automatic), qemu-system-x86:amd64 (1:2.8+dfsg-6+deb9u3, automatic), openhackware:amd64 (0.4.1+git-20140423.c559da7c-4, automatic), libspice-server1:amd64 (0.12.8-2.1+deb9u1, automatic), libxenstore3.0:amd64 (4.8.3+xsa262+shim4.10.0+comet3-1+deb9u6, automatic), qemu-utils:amd64 (1:2.8+dfsg-6+deb9u3, automatic), qemu-efi:amd64 (0~20161202.7bbe0b3e-1, automatic), qemu-system-sparc:amd64 (1:2.8+dfsg-6+deb9u3, automatic), libxen-4.8:amd64 (4.8.3+xsa262+shim4.10.0+comet3-1+deb9u6, automatic), libfdt1:amd64 (1.4.2-1, automatic), qemu-slof:amd64 (20161019+dfsg-1, automatic), qemu-system-arm:amd64 (1:2.8+dfsg-6+deb9u3, automatic), qemu-system-common:amd64 (1:2.8+dfsg-6+deb9u3, automatic), openbios-ppc:amd64 (1.1.git20161120-2, automatic), qemu-system:amd64 (1:2.8+dfsg-6+deb9u3)
Uninstall these packages and their configuration.
sudo apt-get remove --purge `sudo cat /var/log/apt/history.log |apt-history 100 Install as-apt-arguments`
Warning: to avoid unforseen consequences, only do this for the last install command and roll back one command at a time.
edited May 25 at 10:40
answered May 25 at 10:03
Rolf
11610
11610
add a comment |Â
add a comment |Â
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f417198%2fremove-package-and-installed-dependencies-with-apt-get%23new-answer', 'question_page');
);
Post as a guest
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
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
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
1
yumhashistory undo.â Weijun Zhou
Jan 15 at 9:18
@WeijunZhou Thank you. I also discovered that
dnfalso has the ability to autoremove a specific package. I am considering switching to Fedora (I'm on Debian), but I'll try to getyumworking on Debian first.â Rolf
Jan 15 at 9:34
dnfis just a successor ofyum.â Weijun Zhou
Jan 15 at 9:38