How to fix dpkg: error: need an action option in APT

APTINTERMEDIATEMEDIUMUpdated Apr 15, 2026· 246 views

This error occurs when running dpkg without specifying an action flag like -i, -r, -P, or --configure. dpkg requires an explicit action to know whether you want to install, remove, purge, or configure a package.

Quick fix

Fixes dpkg: error: need an action option

sudo dpkg -i package_name.deb
  1. Verify the dpkg action flag is present
  2. Check for incorrect dash characters
  3. Fix spacing issues in --configure commands
  4. Install or remove a package correctly
apt — error
sudo dpkg -i package_name.deb
dpkg: error: need an action option

What this error means

The dpkg command is a Debian package manager that requires you to specify exactly one action option when running it. An action option tells dpkg what to do with the package (install, remove, purge, or configure). When you omit this action, dpkg cannot determine the operation you intend and displays this error. This typically happens when you either forget the action flag entirely, use an incorrect flag, or accidentally use a different dash character (like an en-dash) instead of a regular hyphen.

Typical symptoms

  • Commands like 'dpkg package.deb' fail with 'need an action option' error
  • Copying and pasting dpkg commands from websites results in this error
  • dpkg --configure commands fail when missing -a or package name
  • Package installation fails when -i flag is omitted

Common causes

  1. Running dpkg without specifying an action flag (-i, -r, -P, --configure, etc.)
  2. Using a different dash character (en-dash or em-dash) instead of a regular hyphen when copy-pasting commands
  3. Incorrect spacing in dpkg --configure commands (e.g., 'dpkg -- configure - a' instead of 'dpkg --configure -a')
  4. Typos in the action flag name

How to fix "dpkg: error: need an action option"

1Verify the dpkg action flag is present

Check your command to ensure it includes one of the valid action options:

- -i or --install: Install a package
- -r or --remove: Remove a package (keeps config files)
- -P or --purge: Remove a package and its config files
- --configure: Reconfigure an installed package
- -l or --list: List installed packages
- -s or --status: Show package status

Example of correct syntax:

bash
sudo dpkg -i package_name.deb

Example of incorrect syntax (missing -i):

bash
sudo dpkg package_name.deb
2Check for incorrect dash characters

If you copied the command from a website, the dash character may have been replaced. Copy-paste sometimes converts regular hyphens (-) to en-dashes (–) or em-dashes (—).

Incorrect (en-dash):

bash
sudo dpkg –i package_name.deb

Correct (regular hyphen):

bash
sudo dpkg -i package_name.deb

If this is the issue, retype the command manually or copy from a plain-text source.

3Fix spacing issues in --configure commands

When using --configure, ensure proper spacing:

Incorrect (extra spaces):

bash
sudo dpkg -- configure - a

Correct:

bash
sudo dpkg --configure -a

This reconfigures all packages with unpacked files.

4Install or remove a package correctly

To install a .deb file:

bash
sudo dpkg -i /path/to/package_name.deb

To remove a package (keeping configuration files):

bash
sudo dpkg -r package_name

To remove a package completely (including configuration files):

bash
sudo dpkg -P package_name
5Fix broken package dependencies

If dpkg reports unmet dependencies, fix them with apt:

bash
sudo apt-get -f install

This installs missing dependencies for packages that dpkg couldn't fully unpack or configure.

6Use apt as a user-friendly alternative

For most package management tasks, apt is easier to use than dpkg directly:

Instead of:

bash
sudo dpkg -i package_name.deb

You can use:

bash
sudo apt install ./package_name.deb

Or to install from repositories:

bash
sudo apt install package_name

apt handles dependencies automatically and provides clearer error messages.

Advanced notes

dpkg enforces exactly one action option per invocation. Unlike some commands where options are optional, dpkg's action is mandatory. The action tells the entire processing flow what to do. Some advanced actions include: -L (list files in package), -c (list contents of archive), -S (search for file in packages), and --audit (check for broken installations). When using dpkg directly, always start with the action flag. For reconfiguring all packages, 'sudo dpkg --configure -a' is often used after fixing dependency issues with apt. When bootstrapping systems or in broken states, dpkg is necessary, but for day-to-day package management, apt is recommended.

Frequently asked questions

What does "dpkg: error: need an action option" mean?
The dpkg command is a Debian package manager that requires you to specify exactly one action option when running it. An action option tells dpkg what to do with the package (install, remove, purge, or configure). When you omit this action, dpkg cannot determine the operation you intend and displays this error.
How do I fix "dpkg: error: need an action option"?
This error occurs when running dpkg without specifying an action flag like -i, -r, -P, or --configure. dpkg requires an explicit action to know whether you want to install, remove, purge, or configure a package.
What causes "dpkg: error: need an action option"?
Running dpkg without specifying an action flag (-i, -r, -P, --configure, etc.) Using a different dash character (en-dash or em-dash) instead of a regular hyphen when copy-pasting commands Incorrect spacing in dpkg --configure commands (e.g., 'dpkg -- configure - a' instead of 'dpkg --configure -a')
Is the "dpkg: error: need an action option" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading