I encountered an error “Sub-Process /usr/bin/dpkg returned an error code (1)” while installing a Single sign-on package called Gluu Server. Below is the snapshot of the error.
# apt-get install gluu-server-3.1.3 Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: gluu-server-3.1.3 ...... Setting up gluu-server-3.1.3 (1.8~trusty+Ub14.04) ... update-rc.d: /etc/init.d/gluu-server-3.1.3: file does not exist dpkg: error processing package gluu-server-3.1.3 (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: gluu-server-3.1.3 E: Sub-process /usr/bin/dpkg returned an error code (1)
So how to fix this issue? Here we go,
How to fix Sub-Process /usr/bin/dpkg returned an error code (1) while installing Gluu Server
It’s one of the common error thrown by
dpkg package manager.
Step 1: First thing a package manager does is configure package database, which contains installed packages information. If a package installation is interrupted, then this database may have become corrupt. So let’s reconfigure the package database.
Re-configure Package Database
Execute the below command to repair and reconfigure the package database:
# sudo dpkg --configure -a
Step 2: Some of the packages may be cached, because of which the installation may be interrupted.
Execute the below command to install a package forcefully:
# sudo apt-get install -f <package-name>
Step 3: Remove unwanted packages installed previously which might be affecting the package installation.
Auto-remove unwanted packages
Execute the below command to remove unwanted packages installed previously. This is a safe command which will clean cache for unused packages.
That’s it. Now the package installed without any problem.
# apt-get install gluu-server-3.1.3