How to fix subprocess new post-installation script returned error exit status 127 in APT
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.
Quick fix
Fixes 127
update-desktop-database: not found- Check which command is missing from the error message
- Reconfigure the dpkg database
- Identify and install the missing package
- Fix broken packages
update-desktop-database: not foundsubprocess new post-installation script returned error exit status 127
What this error means
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.
Typical symptoms
- Installation appears to complete but dpkg reports an error with exit status 127
- Package installation fails with 'Errors were encountered while processing' message
- apt or aptitude reports broken packages after installation
- Specific error message shows the missing command name (e.g., 'update-desktop-database: not found')
- Post-installation script errors appear but the package files may still be partially installed
Common causes
- A required command is missing because its package was not installed as a dependency
- The post-installation script references a utility that is not in the system PATH
- A package dependency was removed or not properly declared in the package metadata
- The system is missing a language interpreter or runtime the post-install script requires
How to fix "subprocess new post-installation script returned error exit status 127"
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.
Advanced notes
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.
Frequently asked questions
- What does "127" mean?
- " 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. 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.
- How do I fix "127"?
- 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.
- What causes "127"?
- A required command is missing because its package was not installed as a dependency The post-installation script references a utility that is not in the system PATH A package dependency was removed or not properly declared in the package metadata
- Is the "127" error serious?
- It is a medium-severity error โ more of a blocker than a risk. The steps above resolve it.
Official resources & further reading
- ๐APT Official Documentation
- ๐ฌZorin Forum: dpkg post-installation script error 127 solutions(Stack Overflow)
- ๐ฌLinux Mint Forums: dpkg error exit status 127 discussion(Stack Overflow)
- ๐Debian dpkg documentation and reference(Official Docs)