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.
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.
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:
sudo dpkg -i package_name.debExample of incorrect syntax (missing -i):
sudo dpkg package_name.debIf 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):
sudo dpkg –i package_name.debCorrect (regular hyphen):
sudo dpkg -i package_name.debIf this is the issue, retype the command manually or copy from a plain-text source.
When using --configure, ensure proper spacing:
Incorrect (extra spaces):
sudo dpkg -- configure - aCorrect:
sudo dpkg --configure -aThis reconfigures all packages with unpacked files.
To install a .deb file:
sudo dpkg -i /path/to/package_name.debTo remove a package (keeping configuration files):
sudo dpkg -r package_nameTo remove a package completely (including configuration files):
sudo dpkg -P package_nameIf dpkg reports unmet dependencies, fix them with apt:
sudo apt-get -f installThis installs missing dependencies for packages that dpkg couldn't fully unpack or configure.
For most package management tasks, apt is easier to use than dpkg directly:
Instead of:
sudo dpkg -i package_name.debYou can use:
sudo apt install ./package_name.debOr to install from repositories:
sudo apt install package_nameapt handles dependencies automatically and provides clearer error messages.
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.
E: Could not connect to proxy server
Could not connect to proxy server
E: Package 'package:i386' has no installation candidate
How to fix "Package package:i386 has no installation candidate" in apt
E: The value 'value' is invalid for APT::Default-Release
How to fix invalid APT::Default-Release value in APT
dpkg: error: unable to create new file 'path': Permission denied
How to fix dpkg permission denied errors in APT
subprocess installed post-removal script returned error exit status 1
How to fix "subprocess installed post-removal script returned error exit status 1" in APT