Linux

In thisMongoDB tutorial, I will explain how I managed to lớn resolve sầu the error“E: Sub-process /usr/bin/dpkg returned an error code (1)”.

Bạn đang xem: Linux

Sub-process /usr/bin/dpkg returned an error code (1)Reason: Sub-process /usr/bin/dpkilogam returned an error code (1)Solution: Sub-process /usr/bin/dpkg returned an error code (1)Conclusion

Sub-process /usr/bin/dpkilogam returned an error code (1)

Recently, when I was trying toinstall the MongoDB database in the ubuntu operating system (đôi mươi.04), I faced the error “Sub-process /usr/bin/dpkg returned an error code (1)“. You can see the error below:


*
Sub-process /usr/bin/dpkilogam returned an error code (1)

I properly followed the correct comm&, but still faced this error.

Don’t worry if you don’t know how to resolve sầu these issues. In the below steps, we will discuss the reason for getting the error và also resolve sầu the error.

Reason: Sub-process /usr/bin/dpkilogam returned an error code (1)

When I searched it on the website, I found many posts and blogs on this error. Most of the blogs stated that this error was triggered because of a failed software installation or the installer becomes corrupted.

So if it is damaged and you are trying any new software installation will cause this error message.

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

When I was trying lớn troubleshoot this error in the Ubuntu operating system. I found the solution for this.

The installer becomes corrupted that is the only reason we are getting errors. The key phrase in the error is /usr/bin/dpkg. Here, the dpkilogam is the package installer for Linux và it tracks software updates and dependencies.

Xem thêm: Cách Làm Súp Gà Cho Bé Trên 1 Tuổi Khiến Bé Thích Mê, Súp Gà Cho Bé

Now, follow the below steps khổng lồ fix the error dpkilogam returned an error code 1:

Open the terminalUse the below code to lớn move sầu the dpkg info file into another file

subởi vì mv /var/lib/dpkg/info /var/lib/dpkg/info_silentHere, we moved the info tệp tin into the info_silent file on the same path “/var/lib/dpkg/info_silent”. You can take any name for the new file (info_silent).

Now create a new directory info in dpkg folder, use the below command

suvị mkdir /var/lib/dpkg/infoExdễ thương the update comm& lớn download package information from all configured sourcessuvì chưng apt-get update

*
Move sầu directory & update packages
Exdễ thương the below comm& khổng lồ kiểm tra the dependencies of the packages you want & install any that are needed. sudo apt-get -f installHere, this command will install the MongoDB database và also kiểm tra the dependencies that are needed khổng lồ install.


*
Install MongoDB database
After installing all the dependencies move all the file of the info directory inlớn info_silent directory.

suvày mv /var/lib/dpkg/info/* /var/lib/dpkg/info_silentRemove the info directory, use the below commandsuvị rm -rf /var/lib/dpkg/infoNow, again move all the tệp tin of the info_silent directory into lớn the info directory.suvì mv /var/lib/dpkg/info_silent /var/lib/dpkg/infoUse the below code to lớn updates the list of available packages & their versionssubởi apt-get updateAfter updating the lists, the package manager knows about available updates for the software you have installed.Use the upgrade command lớn installs newer versions of the packages you have sầu.suvì chưng apt-get upgrade

*
Some required changes in the dpkg directory also, update & upgrade
Now we resolved the error and successfully installed the MongoDB without any error fall.Chechồng the version of MongoDB, use the below commandmongod --version
*
Installed MongoDB version v5.0.3

Conclusion

The “sub-process /usr/bin/dpkg returned an error code (1)”indicates that there is a problem with the package installer, which is generally caused by an interrupted installation process or a corrupted database.

You may also lượt thích khổng lồ read the following MongoDB tutorials.

Thus, you might have learned the cause và the solution of the error“ Sub-process /usr/bin/dpkg returned an error code (1) ”.

Sub-process /usr/bin/dpkilogam returned an error code (1)Reason: Sub-process /usr/bin/dpkilogam returned an error code (1)Solution: Sub-process /usr/bin/dpkilogam returned an error code (1)Conclusion