How to fix E: Unable to locate package --install in APT

APTBEGINNERLOWUpdated Dec 29, 2025ยท 165 views

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.

Quick fix

Fixes E: Unable to locate package --install

apt install <package-name>
  1. Verify the correct apt install syntax
  2. Check your command history for incorrect patterns
  3. Re-run with correct syntax
  4. Verify the package exists (if still getting errors)
apt โ€” error
apt install <package-name>
E: Unable to locate package --install

What this error means

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.

Typical symptoms

  • Running apt command results in 'E: Unable to locate package --install' error
  • The --install flag appears as a package name in the error message
  • Command structure looks unusual or has flags in wrong order
  • Works fine when command syntax is corrected

Common causes

  1. Using incorrect syntax like 'apt --install package' instead of 'apt install package'
  2. Misplaced command flags or arguments in wrong order
  3. Copying command examples incorrectly or truncating them mid-way
  4. Accidentally wrapping the command in quotes or shell constructs that treat flags as literals

How to fix "E: Unable to locate package --install"

1Verify the correct apt install syntax

The correct syntax for apt install is:

bash
apt install <package-name>

If you're running as a non-root user, use sudo:

bash
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.

2Check your command history for incorrect patterns

Review what you actually typed by checking your shell history:

bash
history | grep apt

Look 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

3Re-run with correct syntax

Once you've identified the correct package name you want to install, run:

bash
sudo apt update
sudo apt install correct-package-name

For example, to install curl:

bash
sudo apt install curl

NOT:

bash
sudo apt --install curl    # Wrong!
sudo apt install --install # Wrong!
4Verify the package exists (if still getting errors)

If the error persists after fixing syntax, search for the correct package name:

bash
apt search package-keyword

This will show available packages matching your keyword. For instance:

bash
apt search curl

Then install using the exact package name shown in the search results:

bash
sudo apt install curl

This is helpful when you're not sure of the exact package name or if it's available in your system's repositories.

Advanced notes

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.

Frequently asked questions

What does "E: Unable to locate package --install" mean?
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.
How do I fix "E: Unable to locate package --install"?
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.
What causes "E: Unable to locate package --install"?
Using incorrect syntax like 'apt --install package' instead of 'apt install package' Misplaced command flags or arguments in wrong order Copying command examples incorrectly or truncating them mid-way
Is the "E: Unable to locate package --install" error serious?
It is a low-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading