/
Depends on
- dh-python (pybuild-plugin-pyproject)
- pytest (python3-pytest)
- python-apt (python3-apt)
- python3-defaults (python3)
- debhelper-compat, pandoc, python3-poetry-core
README (full)
apt-suggest-auto
Over time, packages installed as dependencies of manually-installed packages accumulate as "manually installed" in the APT database, preventing autoremoval when they are no longer needed. apt-suggest-auto identifies such packages by simulating the effect of marking each one as automatically installed and checking whether it would become eligible for autoremoval. Only packages that remain required by other installed packages are suggested for reclassification. It serves as a modern replacement for debfoster and deborphan.
Features
- Identifies Manually Installed Packages: Scans the APT cache for packages currently marked as manually installed.
- Safe Simulation: Simulates marking each package as auto-installed and rejects any that would become eligible for autoremoval.
- Prevents Accidental Autoremoval: Only suggests packages that remain required by other installed packages.
- Optional Application: The
--applyflag commits the changes, marking the identified packages as automatically installed. - Scripting Friendly Output: The
--rawflag outputs a plain list of markable packages, one per line. - APT Configuration Options: The
-oflag passes APT configuration options, e.g.-o Dir::State::status=/path/to/status.
Installation
From Debian package
sudo dpkg -i apt-suggest-auto_0.1_all.deb
From source
git clone https://salsa.debian.org/lucas/apt-suggest-auto.git
cd apt-suggest-auto
sudo dpkg-buildpackage -us -uc -b
sudo dpkg -i ../apt-suggest-auto_0.1_all.deb
Usage
Simulation (Default)
By default, the tool performs a simulation and lists packages that can be safely marked as automatic, without making any changes.
apt-suggest-auto
Example output:
Found X manually installed packages.
Simulating changes to identify safely markable packages...
Successfully identified Y packages that can be safely marked as automatic:
- package-name-1
- package-name-2
- ...
Need to keep Z packages as manual to prevent their autoremoval:
- package-name-A
- package-name-B
- ...
*** This was a simulation. No actual changes were made to your system. ***
Applying Changes
To mark the identified packages as automatically installed, use the --apply flag. This requires root privileges.
sudo apt-suggest-auto --apply
Raw Output for Scripting
To get a plain list of packages that can be safely marked as automatic, use the --raw flag:
apt-suggest-auto --raw
Example output:
package-name-1
package-name-2
...
This can be piped to other commands:
apt-suggest-auto --raw | xargs echo "Packages to mark auto: "
APT Configuration Options
Pass APT configuration options with -o:
apt-suggest-auto -o Dir::State::status=/path/to/status
Can be used multiple times:
apt-suggest-auto -o APT::Get::Assume-Yes=true -o Dir::State::status=/path/to/status
Contributing
Contributions are welcome! Please feel free to open issues or submit merge requests on the Salsa repository.
License
This project is licensed under the GPL-2.0-or-later License.
| dir | apt_suggest_auto/ |
| dir | debian/ |
| dir | tests/ |
| file | LICENSE |
| file | README.md |
| file | incant.yaml |
| file | pyproject.toml |