By Mike Hermary
Hello,
I am newish to server management and have noticed ‘autoremove’ notices when updating packages using the command line. I have run ‘sudo apt autoremove’ once or twice, but have noticed that some packages that are still needed have been removed. I usually notice this when something breaks in a WordPress or Joomla site that I manage. When this happens, I just re-install the package and everything seems to be good.
I am sure there is a better way to review all installed packages (sudo apt list --installed) and safely remove those that are outdated and are absolutely not needed anymore.
Any help or tips are greatly appreciated.
Cheers,
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi @mikehermary,
The packages that are outdated can be resolved by running the commands:
$ apt update
$ apt upgrade
Once this has run, all you need to do is as said execute the command:
$ apt autoremove
Here is what I received when I did this:
$ apt autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED: grub-pc-bin libdumbnet1 libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python python-minimal python-pyicu python2.7 python2.7-minimal python3-lib2to3
0 upgraded, 0 newly installed, 11 to remove and 0 not upgraded.
After this operation, 21.7 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 127785 files and directories currently installed.)
Removing grub-pc-bin (2.02-2ubuntu8.23) ...
Removing libdumbnet1:amd64 (1.12-7build1) ...
Removing python-pyicu (1.9.8-0ubuntu1) ...
Removing python (2.7.15~rc1-1) ...
Removing libpython-stdlib:amd64 (2.7.15~rc1-1) ...
Removing python2.7 (2.7.17-1~18.04ubuntu1.6) ...
Removing libpython2.7-stdlib:amd64 (2.7.17-1~18.04ubuntu1.6) ...
Removing python-minimal (2.7.15~rc1-1) ...
Removing python2.7-minimal (2.7.17-1~18.04ubuntu1.6) ...
Unlinking and removing bytecode for runtime python2.7
Removing libpython2.7-minimal:amd64 (2.7.17-1~18.04ubuntu1.6) ...
Removing python3-lib2to3 (3.6.9-1~18.04) ...
Processing triggers for libc-bin (2.27-3ubuntu1.4) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Then when I run $ apt upgrade here is what I see:
$ apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.