Linux remove unused packages

Remove unused packages

I have installed some rpm package on my Fedora 17. Some packages had a lot of dependencies. I have removed some packages but I forgot remove unused dependencies with yum remove. How can I do that now?

5 Answers 5

If you install a package with yum install , say pdftk , it will pull in a lot of dependencies:

Installed: pdftk.x86_64 0:1.44-10.fc18 Dependency Installed: bouncycastle.noarch 0:1.46-6.fc18 itext-core.noarch 0:2.1.7-14.fc18 libgcj.x86_64 0:4.7.2-8.fc18 bouncycastle-mail.noarch 0:1.46-6.fc18 java-1.5.0-gcj.x86_64 0:1.5.0.0-40.fc18 sinjdoc.x86_64 0:0.5-13.fc18 bouncycastle-tsp.noarch 0:1.46-5.fc18 java_cup.noarch 1:0.11a-10.fc18 itext.x86_64 0:2.1.7-14.fc18 javamail.noarch 0:1.4.3-12.fc18 Complete! 

yum remove pdftk will remove only that package and not all the dependencies.

But you can look at all the ‘transactions’ (install, remove etc.):

$ sudo yum history list pdftk ID | Command line | Date and time | Action(s) | Altered ------------------------------------------------------------------------------- 88 | install pdftk | 2012-12-14 13:35 | Install | 11 

And then you can undo that transaction:

$ sudo yum history undo 88 Undoing transaction 88, from Fri Dec 14 13:35:34 2012 Dep-Install bouncycastle-1.46-6.fc18.noarch @fedora Dep-Install bouncycastle-mail-1.46-6.fc18.noarch @fedora Dep-Install bouncycastle-tsp-1.46-5.fc18.noarch @fedora Dep-Install itext-2.1.7-14.fc18.x86_64 @fedora Dep-Install itext-core-2.1.7-14.fc18.noarch @fedora Dep-Install java-1.5.0-gcj-1.5.0.0-40.fc18.x86_64 @fedora Dep-Install java_cup-1:0.11a-10.fc18.noarch @fedora Dep-Install javamail-1.4.3-12.fc18.noarch @fedora Dep-Install libgcj-4.7.2-8.fc18.x86_64 @fedora Install pdftk-1.44-10.fc18.x86_64 @fedora Dep-Install sinjdoc-0.5-13.fc18.x86_64 @fedora . Complete! 

Источник

Remove unused packages in Ubuntu? [4 Methods]

One of the most common operations when using an operating system is the package installation process. In this process, package(s) are installed, but sometimes unused packages remain in the system. These packages can sometimes cause problems in package dependencies.

In this article, we will share information about removing unused packages on Ubuntu, which is a Debian based distribution.

Different methods to remove unused packages in Ubuntu

To delete unused packages in Ubuntu can be done with apt package manager and packages installed with this package manager. Let’s explain what to do with apt, then how to remove unused packages using a few packages. Finally, let’s delete unused packages with a useful script.

Method -1- Using apt parameters

While apt-get is used as the package manager in old ubuntu distributions, apt is used in new version Ubuntu. The package manager’s parameters are used to remove unused packages. Let’s look at the parameters of apt in order.

autoremove

The autoremove parameter is used to remove packages that are automatically installed to meet the dependencies of other packages. These packages are no longer needed because their dependencies have changed or the package(s) that need them have been removed.

root@foc-ubuntu21:/# apt autoremove Reading package lists. Done Building dependency tree. Done Reading state information. Done 0 upgraded, 0 newly installed, 0 to remove and 248 not upgraded.

After the command, unused packages are listed and deleted after confirmation.

Читайте также:  Nvidia 340 linux mint

clean

The clean cleans the local repository of imported package files. Removes everything but the lock file from the /var/cache/apt/archives/ and /var/cache/apt/archives/partial/ directories.

root@foc-ubuntu21:/# apt clean

autoclean

The autoclean cleans the local repository of received package files like the clean parameter. The difference is that it only removes package files that are no longer downloadable and largely useless.

root@foc-ubuntu21:/# apt autoclean Reading package lists. Done Building dependency tree. Done Reading state information. Done 

Method -2- Using the popcon-largest-unused command

The popcon-largest-unused command, which comes with the popularity-contest package, lists the unused packages.

First, install it on the system:

root@foc-ubuntu21:/# apt install popularity-contest -y

When you want to run the post-installation command, you will receive the following warning. In the same warning, you will be shown what you need to do:

root@foc-ubuntu21:/# popcon-largest-unused warning: Missing required file /var/log/popularity-contest. info: Run 'popularity-contest > /var/log/popularity-contest' to generate it. 

Then run the following command:

root@foc-ubuntu21:/# popularity-contest > /var/log/popularity-contest

Now get a list from most used package to least used:

root@foc-ubuntu21:/# popcon-largest-unused
. 32 libencode-locale-perl 31 libhtml-tagset-perl 31 libfile-listing-perl 30 libwacom-bin 30 gkbd-capplet 29 libhttp-date-perl 27 perl-openssl-defaults 27 liblwp-protocol-https-perl 25 libextutils-pkgconfig-perl 22 tcl 19 libnet-smtp-ssl-perl

Now remove the least used package:

root@foc-ubuntu21:/# apt remove libnet-smtp-ssl-perl Reading package lists. Done Building dependency tree. Done Reading state information. Done The following package was automatically installed and is no longer required: libauthen-sasl-perl Use 'sudo apt autoremove' to remove it. The following packages will be REMOVED: libmailtools-perl libnet-smtp-ssl-perl 0 upgraded, 0 newly installed, 2 to remove and 248 not upgraded. After this operation, 248 kB disk space will be freed. Do you want to continue? [Y/n]

With your approval, the package is removed from the system. You can see that the package was installed automatically and is no longer needed.

Method -3- Using the deborphan command

The deborphan, finds packages that don’t have packages linked to the package typed after the command.

Run the following command for installation:

root@foc-ubuntu21:/# apt install deborphan -y
Usage: deborphan [OPTIONS] [PACKAGE].
root@foc-ubuntu21:/# deborphan -a main/admin deborphan main/web firefox-locale-en main/perl libauthen-sasl-perl main/kernel linux-generic-hwe-20.04 main/misc popularity-contest main/python python3-cffi-backend main/utils shim-signed main/metapackages ubuntu-minimal main/metapackages ubuntu-standard

The -a parameter checks all packages. It is best used with —priority (if used at all). This option means —show-section.

root@foc-ubuntu21:/# apt remove firefox-locale-en Reading package lists. Done Building dependency tree. Done Reading state information. Done The following package was automatically installed and is no longer required: libauthen-sasl-perl Use 'sudo apt autoremove' to remove it. The following packages will be REMOVED: firefox-locale-en 0 upgraded, 0 newly installed, 1 to remove and 247 not upgraded. After this operation, 1.169 kB disk space will be freed. Do you want to continue? [Y/n]

After your confirmation, the package will be deleted. After the deletion, the system will not have any problems, because it was not used anyway.

Читайте также:  Install snort on linux

Method -4- Using unusedpkg (Bash Script)

This script is maintained by a third party owner on GitHub. Please make sure you test it thoroughly or go through the script before using it.

There is a bash script called unusedpkg, we will download this script and use. Download the file with the following command:

foc@foc-ubuntu21:~$ wget https://github.com/epinna/Unusedpkg/archive/refs/heads/master.zip --2022-11-28 14:31:20-- https://github.com/epinna/Unusedpkg/archive/refs/heads/master.zip . HTTP request sent, awaiting response. 200 OK Length: unspecified [application/zip] Saving to: ‘master.zip’ master.zip [ ] 26,30K --.-KB/s in 0,09s 2022-11-28 14:31:21 (281 KB/s) - ‘master.zip’ saved [26928] 

Then extract the downloaded zip file and enter the directory:

foc@foc-ubuntu21:~$ unzip master.zip && cd Unusedpkg-master

Give unusedpkg file execute permission:

foc@foc-ubuntu21:~/Unusedpkg-master$ chmod +x unusedpkg
foc@foc-ubuntu21:~/Unusedpkg-master$ ./unusedpkg * UnusedPkg 1.0 Find unused packages in your Linux system. Database /home/foc/.unusedpkg/pkglist doesn't exist (first run?). Automatically executing './unusedpkg update'. 1476 packages available. [18%] gir1.2-javascriptcoregtk-4.0:amd64 [21%] gnome-shell-extension-appindicator . [79%] network-manager-config-connectivity-ubuntu [90%] speech-dispatcher-audio-plugins:amd64 Database update done. WARNING: The reported idle days may be wrong. Before removing packages, check timestamps with 'unusedpkg info ' or check the timestamps with 'ls -alu'. See README for more info. Minimum packages size: 1MB IDLE DAYS SIZE PACKAGE NAME 2497 3MB tzdata 1057 1MB printer-driver-m2300w 1029 2MB x11-apps 913 2MB printer-driver-foo2zjs-common . 

UnusedPkg is a tool to find unused packages in Ubuntu operating system (All Debian based operating systems) sorted by their idle time. The packet with the largest idle time is at the beginning of the queue.
After this output, you can perform the deletion by looking at the dependencies of the relevant package.

For example, you can delete the printer-driver-foo2zjs-common package like this:

foc@foc-ubuntu21:~$ sudo apt remove printer-driver-foo2zjs-common Reading package lists. Done Building dependency tree. Done Reading state information. Done The following packages were automatically installed and are no longer required: dc mscompress Use 'sudo apt autoremove' to remove them. The following packages will be REMOVED: printer-driver-foo2zjs printer-driver-foo2zjs-common 0 upgraded, 0 newly installed, 2 to remove and 249 not upgraded. After this operation, 3.339 kB disk space will be freed. Do you want to continue? [Y/n]

If you approve, the package will be deleted.

Summary

We explained how to delete unused packages on Ubuntu with the apt package manager, popcon-largest-unused and deborphan command.

You can get the parameters of the Deborphan package, and information about the popcon-largest-unused command from the popularity-contest package’s man page.

If it is about the apt command, you can use the local manual page:

root@foc-ubuntu21:/# man apt apt - command-line interface DESCRIPTION apt provides a high-level commandline interface for the package management system. It is intended as an end user interface and enables some options better suited for interactive usage by default compared to more specialized APT tools like apt-get(8) and apt- cache(8). . 

References

Didn’t find what you were looking for? Perform a quick search across GoLinuxCloud

Читайте также:  Посмотреть тип оперативной памяти linux

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can either use the comments section or contact me form.

Thank You for your support!!

Источник

how do I eliminate unused packages in version 15.04

When upgrading to version 15.04 from 14.10 there was a «clean up» time period where I received a query to eliminate 18 unused or unnecessary packages. Can anyone show me where I can make sure that I don’t have any superfluous unused packages?

3 Answers 3

First you should know our systems is not that smart !! A system can’t know which package is needed by you or not. Ubuntu can’t remove any package that were installed by the user himself, instead it offers you to delete the packages that were downloaded as dependencies for other packages and not used anymore, which means those packages were installed by the system itself and not by the user.

 autoremove autoremove is used to remove packages that were automatically installed to satisfy dependencies for other packages and are now no longer needed. 

So running sudo apt-get autoremove will uninstall the unused packages which were used as dependencies for other packages.

A system can show you the Important or required packages so those is not supposed to be removed.

Install aptitude if you don’t have it:

sudo apt-get install aptitude 

Now you can search for packages considered required:

aptitude search '~prequired' 
aptitude search '~pimportant' 

How To know The unused packages in Ubuntu

There is a bash script for a tool called unusedpkg, this can test since when you didn’t use the packages so you can determine what to delete.

Download the script. Extract the zipped folder then give permission to the script

Now you can run it from dir containing the script

* UnusedPkg 0.6 Find unused packages in your Linux system. WARNING: Idle days may be wrong. Before delete anything, check package timestamps using 'unusedpkg info ', or manually with 'ls -alu'. View README for infos. Minimum packages size: 1MB IDLE DAYS SIZE PACKAGE NAME 1 year and 6 months (553 days) 8MB 0ad 1 year and 6 months (553 days) 2MB gnect 1 year and 6 months (553 days) 1MB libgvc5 1 year and 6 months (553 days) 8MB locales 

Источник

Оцените статью
Adblock
detector