apt treats "--install" as a package name instead of a command flag when placed after "apt". This is a syntax error caused by incorrect command ordering or quoting issues.
The "Unable to locate package --install" error occurs when you try to install a package using apt but place the "--install" flag in the wrong position or when apt interprets it as a literal package name to search for in the repository. In apt, the correct syntax is "apt install <package-name>". However, some users accidentally write commands like "apt --install package" or accidentally quote or structure the command incorrectly, causing apt to search for a package literally named "--install" which doesn't exist in any repository. This is purely a command syntax issue, not a problem with package repositories or system configuration.
The correct syntax for apt install is:
apt install <package-name>If you're running as a non-root user, use sudo:
sudo apt install <package-name>The package name comes AFTER the "install" keyword. Make sure you're not accidentally putting "--install" where the package name should be.
Review what you actually typed by checking your shell history:
history | grep aptLook for patterns like:
- apt --install package-name (wrong order)
- apt -install package-name (missing second dash)
- apt install --install package-name (duplicated flags)
- apt install --install (no package name)
Correct any of these patterns by reordering to: apt install package-name
Once you've identified the correct package name you want to install, run:
sudo apt update
sudo apt install correct-package-nameFor example, to install curl:
sudo apt install curlNOT:
sudo apt --install curl # Wrong!
sudo apt install --install # Wrong!If the error persists after fixing syntax, search for the correct package name:
apt search package-keywordThis will show available packages matching your keyword. For instance:
apt search curlThen install using the exact package name shown in the search results:
sudo apt install curlThis is helpful when you're not sure of the exact package name or if it's available in your system's repositories.
This error is a syntax/user error, not a system or repository configuration issue. It's different from the general "Unable to locate package" error which can result from outdated package caches, missing repositories, or genuinely unavailable packages. The "--install" variant specifically indicates the flag was passed as if it were a package name, which only happens with incorrect command syntax. No advanced troubleshooting (like adding PPAs or updating sources) will fix this - only correcting the command structure will resolve it.
E: Cannot set to hold: package 'package-name' is not installed
How to fix "Cannot set to hold" error when package is not installed in APT
debconf: unable to initialize frontend: Dialog
How to fix "debconf: unable to initialize frontend: Dialog" in APT
E: Could not connect to proxy server
Could not connect to proxy server
dpkg: serious warning: files list file for package 'package-name' contains empty filename
How to fix "files list file contains empty filename" in APT
E: Package 'package:i386' has no installation candidate
How to fix "Package package:i386 has no installation candidate" in apt