How to remove dependencies installed from .deb files?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to remove dependencies installed from .deb files?
I am unable to remove dependencies installed from .deb files. For example, I downloaded the .deb files for vlc and its dependencies with the command 'sudo apt --download-only install vlc'. I can install vlc and its dependencies with 'sudo dpkg -i *.deb', and i can remove vlc with 'sudo dpkg -r vlc', but this doesn't remove its dependencies. And 'sudo apt autoremove' doesn't remove them also.
If you can verify that they are no longer needed (see deborphan) you can remove them by name.
Why install from the deb file rather than directly using apt?
Why do you WANT to remove them?
And 'sudo apt autoremove' doesn't remove them also.
It should, unless they are still needed by some other application.
Yes, this can happen with optional dependencies, called "Install Recommends" in Debian-speak.
It is possible to tell apt to not install recommends at all.
What dependencies did vlc pull in?
BTW, don't use dpkg unless absolutely necessary.
Why couldn't you just 'apt install vlc'?
If you can verify that they are no longer needed (see deborphan) you can remove them by name.
Why install from the deb file rather than directly using apt?
Why do you WANT to remove them?
deborphan doesn't list them and removing them by name is not convinient when they are many. These are the deb files:
It should, unless they are still needed by some other application.
Yes, this can happen with optional dependencies, called "Install Recommends" in Debian-speak.
It is possible to tell apt to not install recommends at all.
What dependencies did vlc pull in?
BTW, don't use dpkg unless absolutely necessary.
Why couldn't you just 'apt install vlc'?
I think when you install deb files locally they are marked as manually installed and 'apt autoremove' won't remove them.
How did you install these dependencies?
If manually, then apt doesn't see them as dependencies at all because you installed them yourself.
You have to then equally manually uninstall them.
It's possible to install offline with apt, too.
Recommended, less chance to break your system.
I want to be able to install and remove packages offline.
I don't want to have residual packages on my system.
It was a tough one to do but copy and paste this line into your terminal and type in the password once you have changed into the directory containing the packages. Most likely in /var/cache/apt/archives/ now they were installed.
Edit: and now I think since you want no unnecessary items on your system a sudo apt clean will eliminate the packages in the already mentioned cache directory freeing up that space too...
If deborphan doesn't list those lib* packages then they're still needed, perhaps not by vlc, but by some other installed package(s). You may try harder though by specifying the -n option to deborphan.
How did you install these dependencies?
If manually, then apt doesn't see them as dependencies at all because you installed them yourself.
You have to then equally manually uninstall them.
Let me guess, you deleted the original .deb's and don't know anymore?
It's in a log file, somewhere under /var/log. Not sure dpkg logs to apt's log, maybe it has its own.
It's possible to install offline with apt, too.
Recommended, less chance to break your system.
No, i didn't delete the deb files. I run 'sudo apt clean' before running 'sudo apt --download-only install vlc', than i moved the packages to a folder.
But i think i found how to install dependency automatically when i am offline. I tested that with other application - geany, because i can't do that with vlc anymore. If i run 'sudo apt install geany' it installs only two packages - geany and geany-common. So, i downloaded the packages with 'sudo apt --download-only geany', then disconnected from internet and run 'sudo apt install geany' and this installed the application. After that i removed geany with 'sudo apt remove geany' and when i run 'sudo apt autoremove' it removed geany-common also.
So, i guess if i am offline and want to install deb packages i better copy them to /var/cache/apt/archive and run 'sudo apt install packname'. This way the dependencies will be installed automatically and after that can be removed with 'apt autoremove'.
It was a tough one to do but copy and paste this line into your terminal and type in the password once you have changed into the directory containing the packages. Most likely in /var/cache/apt/archives/ now they were installed.
Edit: and now I think since you want no unnecessary items on your system a sudo apt clean will eliminate the packages in the already mentioned cache directory freeing up that space too...
This doesn't work, i already tried it. It's probably because the packages are installed with different names.
If deborphan doesn't list those lib* packages then they're still needed, perhaps not by vlc, but by some other installed package(s). You may try harder though by specifying the -n option to deborphan.
Those packages are not dependencies of anything else. You should know better than us if you need them. If you don't know what they are then you probably can remove them.
But i think i found how to install dependency automatically when i am offline. I tested that with other application - geany, because i can't do that with vlc anymore. If i run 'sudo apt install geany' it installs only two packages - geany and geany-common. So, i downloaded the packages with 'sudo apt --download-only geany', then disconnected from internet and run 'sudo apt install geany' and this installed the application. After that i removed geany with 'sudo apt remove geany' and when i run 'sudo apt autoremove' it removed geany-common also.
That's what I meant.
It has the advantage that you allow apt to take full care of your package management which is highly recommended on a Debian system.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.