How to fix The following packages were automatically installed and are no longer required in APT

APTBEGINNERLOWUpdated Oct 7, 2026ยท 335 views

When you remove packages from Debian/Ubuntu systems, their dependencies may become orphaned. APT warns you about these unused packages that can be safely removed to free up disk space.

Quick fix

Fixes The following packages were automatically installed and are no longer required

sudo apt autoremove --dry-run
  1. Preview packages before removal
  2. Remove orphaned packages
  3. Purge configuration files (optional)
  4. Prevent removal of specific packages
apt โ€” error
sudo apt autoremove --dry-run
The following packages were automatically installed and are no longer required

What this error means

This message appears after updating or removing packages in Debian/Ubuntu systems. APT automatically installs dependencies when you install a package, but when you remove the main package, those dependencies may no longer be needed. APT identifies these orphaned packages and warns you about them, allowing you to reclaim disk space by removing them safely.

Typical symptoms

  • Message appears in terminal after apt remove or apt upgrade operations
  • List of package names displayed after the main operation completes
  • System continues to function normally despite the warning
  • Disk space not being reclaimed even after removing main packages

Common causes

  1. Main package was removed or upgraded without its dependencies
  2. Dependency packages are not required by any other installed software
  3. Long-term system maintenance without periodic cleanup
  4. Installation and removal of multiple packages over time

How to fix "The following packages were automatically installed and are no longer required"

1Preview packages before removal

Use the --dry-run flag to see which packages will be removed without actually removing them. This is the safest approach to verify you're not removing anything important:

bash
sudo apt autoremove --dry-run

Review the list of packages carefully to ensure none of them are critical for your system.

2Remove orphaned packages

Once you've reviewed the list and confirmed it's safe, execute the autoremove command to remove the unused packages and free up disk space:

bash
sudo apt autoremove

You may be prompted to confirm the removal. Press 'y' and Enter to proceed.

3Purge configuration files (optional)

If you want to also remove configuration files associated with the removed packages, use the --purge flag:

bash
sudo apt autoremove --purge

This is optional but recommended for a complete cleanup.

4Prevent removal of specific packages

If APT marks a package as auto-removable but you want to keep it, mark it as manually installed:

bash
sudo apt-mark manual package-name

This prevents the package from being removed in future autoremove operations.

5View automatically installed packages

To see all packages currently marked as automatically installed on your system:

bash
apt-mark showauto

You can pipe this to grep to filter for specific packages if needed.

Advanced notes

APT tracks package installation status in /var/lib/apt/extended_states. When a package is marked as 'Auto', it means APT installed it as a dependency and not by explicit user request. Running 'apt autoremove' periodically (especially after major system updates) helps maintain a clean system and recovers disk space. The command is safe because APT only removes packages that are not depended upon by any other installed package, protecting your system stability. Some systems like Debian testing may have different behavior, and you should always review what will be removed before confirming.

Frequently asked questions

What does "The following packages were automatically installed and are no longer" mean?
This message appears after updating or removing packages in Debian/Ubuntu systems. APT automatically installs dependencies when you install a package, but when you remove the main package, those dependencies may no longer be needed. APT identifies these orphaned packages and warns you about them, allowing you to reclaim disk space by removing them safely.
How do I fix "The following packages were automatically installed and are no longer"?
When you remove packages from Debian/Ubuntu systems, their dependencies may become orphaned. APT warns you about these unused packages that can be safely removed to free up disk space.
What causes "The following packages were automatically installed and are no longer"?
Main package was removed or upgraded without its dependencies Dependency packages are not required by any other installed software Long-term system maintenance without periodic cleanup
Is the "The following packages were automatically installed and are no longer" error serious?
It is a low-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading