How to fix subprocess new post-installation script returned error exit status 127 in APT

APTINTERMEDIATEMEDIUMUpdated Dec 29, 2025ยท 239 views

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
  1. Check which command is missing from the error message
  2. Reconfigure the dpkg database
  3. Identify and install the missing package
  4. Fix broken packages
apt โ€” error
update-desktop-database: not found
subprocess 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

  1. A required command is missing because its package was not installed as a dependency
  2. The post-installation script references a utility that is not in the system PATH
  3. A package dependency was removed or not properly declared in the package metadata
  4. 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"

1Check which command is missing from the error message

The error output will often show which command wasn't found. Look for the command name mentioned in the dpkg error. For example:

bash
update-desktop-database: not found

This tells you that update-desktop-database is the missing command.

2Reconfigure the dpkg database

First, try to reconfigure dpkg and complete any pending package configurations. This often resolves the issue:

bash
sudo dpkg --configure -a

This command configures all unpacked packages. If the post-install script runs again and completes successfully, the problem is resolved.

3Identify and install the missing package

If the previous step doesn't work, search for which package provides the missing command. Common mappings:

bash
# 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-support

Once you identify the package, install it:

bash
sudo apt install <package-name>
4Fix broken packages

After installing the missing dependency, fix any broken packages:

bash
sudo apt --fix-broken install

This will attempt to complete the installation of any packages that had post-installation script failures.

5Verify the installation

Confirm that the package is now properly installed and functional:

bash
apt list --installed | grep <package-name>

Also check that the post-installation script completed without errors by reviewing apt's status.

6Last resort: Remove and reinstall the problematic package

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):

bash
# 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:

bash
# 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 -a

However, 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