# E: Sub-process /usr/bin/dpkg returned an error code (1)

**Code:** `Sub-process /usr/bin/dpkg returned an error code (1)` · **Category:** Linux · **Seen on:** Linux

A package’s install/configure script failed, so dpkg aborted. The real error is a few lines above this message.

## Meaning

dpkg runs maintainer scripts (postinst etc.). They fail when a service can’t start after install (port in use, bad config), a file conflicts with another package, or disk is full. The package stays half-configured until fixed.

## Common causes

- Package’s post-install script failed (service failed to start)
- File conflict with another package (trying to overwrite)
- Disk full during unpack
- Broken previous install

## Quick fix

1. Read the lines above for the failing package and reason
2. sudo dpkg --configure -a then sudo apt -f install
3. Fix the underlying service/config error and retry

## Detailed fix by platform

### Ubuntu

1. 

```bash
sudo dpkg --configure -a
sudo apt-get -f install
sudo journalctl -xe | tail -30   # if a service failed in postinst
```


## How to diagnose

1. **Package** — Which one failed?
2. **Reason** — Message above (conflict, service, disk)
3. **Disk** — df -h

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/linux/dpkg-returned-error-code-1)
