Exit status 127 in dpkg post-installation scripts means a required command is not found on your system. This typically happens when a package dependency is missing or not properly installed.
Exit status 127 is a bash error code indicating "command not found." When this occurs during a package's post-installation script, it means the script is trying to run a command that doesn't exist on your system. Post-installation scripts are executed by dpkg after a package is extracted and installed. Common missing commands include: - `update-desktop-database` (from desktop-file-utils) - `update-mime` (from mime-support) - `gtk-update-icon-cache` (from libgtk2.0-bin) - `systemctl` (from systemd) - `update-info-dir` (from info) The root cause is usually that the package declaring a dependency on another utility failed to list it as a proper dependency, so the required command-providing package wasn't automatically installed.
The error output will often show which command wasn't found. Look for the command name mentioned in the dpkg error. For example:
update-desktop-database: not foundThis tells you that update-desktop-database is the missing command.
First, try to reconfigure dpkg and complete any pending package configurations. This often resolves the issue:
sudo dpkg --configure -aThis command configures all unpacked packages. If the post-install script runs again and completes successfully, the problem is resolved.
If the previous step doesn't work, search for which package provides the missing command. Common mappings:
# Find which package provides a command
apt search <command-name>
# Examples:
apt search update-desktop-database # Provides: desktop-file-utils
apt search gtk-update-icon-cache # Provides: libgtk2.0-bin
apt search update-mime # Provides: mime-supportOnce you identify the package, install it:
sudo apt install <package-name>After installing the missing dependency, fix any broken packages:
sudo apt --fix-broken installThis will attempt to complete the installation of any packages that had post-installation script failures.
Confirm that the package is now properly installed and functional:
apt list --installed | grep <package-name>Also check that the post-installation script completed without errors by reviewing apt's status.
If the previous steps don't work, completely remove and reinstall the package. Use Synaptic Package Manager and select "Mark for Complete Removal" (or use the CLI):
# Remove the package completely
sudo apt remove --purge <package-name>
# Reinstall it
sudo apt install <package-name>Since post-installation scripts only run once during installation, the script should execute cleanly the second time around.
The error message "subprocess installed post-installation script returned error exit status 127" specifically refers to a post-installation (postinst) script. Exit status 127 is Unix's standard code for "command not found," which means the script tried to execute a program that isn't in the PATH.
In rare cases where you cannot identify or install the missing dependency, you can disable the problematic post-installation script by moving it:
# Back up the problematic script
sudo mv /var/lib/dpkg/info/<package-name>.postinst /var/lib/dpkg/info/<package-name>.postinst.disabled
# Then reconfigure
sudo dpkg --configure -aHowever, this should be a last resort since the post-installation script may perform important setup. It's better to identify and install the missing dependency.
Modern post-installation scripts should declare all their dependencies properly, but legacy or third-party packages may have incomplete dependency metadata. If you encounter this repeatedly with a specific package, consider filing a bug report with the package maintainers.
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