Solution to the error "E: Sub-process /usr/bin/dpkg returned an error code (1)" during the installation program

Today when I used the command to install the program in the terminal, the following error message appeared.

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

In this case, whatever program is installed will eventually report this error. The specific error screenshot is shown in the figure below.
Insert image description here
To solve this problem, first use the following command to enter the corresponding directory.

cd /var/lib/dpkg/

The files contained in this directory are shown below.
Insert image description here
First use the following command to rename the original info file in the folder.

sudo mv info info_temp

The execution process is shown in the figure below.
Insert image description here
Then use the following command to create a new folder named info.

sudo mkdir info

Then use the following command to update apt-get.

sudo apt-get update

Update the information printed by apt-get as shown below.
Insert image description here
Then use the command below to force a repair.

sudo apt-get -f install

The information printed during the repair process is shown in the figure below.
Insert image description here
At this time, check the newly created info folder. A file named format has been generated in it, as shown in the figure below.
Insert image description here
Use the following command to move the files generated under info to the original folder, which is under info_temp.

sudo mv info/* info_temp/

Then use the following command to delete the newly created folder info.

sudo rm -rf info

Then use the following command to change the name of the original folder back to info.

sudo mv info_temp info

Now that all the operations have been completed, let’s try installing the program again.
The results are shown below.
Insert image description here
There is no error message "E: Sub-process /usr/bin/dpkg returned an error code (1)", and the problem has been solved!
Summary of instructions to resolve this error:

cd /var/lib/dpkg/
sudo mv info info_temp
sudo mkdir info
sudo apt-get update
sudo apt-get -f install
sudo mv info/* info_temp/
sudo rm -rf info
sudo mv info_temp info

The above is the solution to the installation program error "E: Sub-process /usr/bin/dpkg returned an error code (1)"!

Guess you like

Origin blog.csdn.net/weixin_42570192/article/details/132725294