Score:0

I have unknowingly deleted the dpkg binary file from /usr/bin

ls flag

I deleted the dpkg binary file using sudo rm /usr/bin/dpkg now I am encountering problems you can assume what kind. Later I found out that it was a very impotent file. I am a new ubuntu user in the learning stage. I did not know what I was doing. I refered to this Accidentally deleted /usr/bin/dpkg post but when I tried the solution I get

Could not exec dpkg!
E: Sub-process /usr/bin/dpkg returned an error code (100)

I was able to fix this when I changed the file permissions

sudo chmod a+x /usr/bin/dpkg

Now when running

sudo apt-get install --reinstall dpkg

I get a number of errors including

`File "/usr/lib/update-notifier/package-data-downloader", line 29, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

`dpkg: error processing package update-notifier-common (--configure):
 installed update-notifier-common package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of update-notifier:
 update-notifier depends on update-notifier-common (= 3.192.30.17); however:
  Package update-notifier-common is not configured yet.

dpkg: error processing package update-notifier (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                          No apport report written because the error message indicates its a followup error from a previous failure.
                                                    dpkg: dependency problems prevent configuration of update-manager:
 update-manager depends on update-notifier; however:
  Package update-notifier is not configured yet.

dpkg: error processing package update-manager (--configure):
 dependency problems - leaving unconfigured
Processing triggers for man-db (2.9.1-1) ...
Errors were encountered while processing:
 update-notifier-common
 update-notifier
 update-manager

And at last

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

Please help

Esther avatar
es flag
you need to get the correct version of dpkg for your OS version. Look up which version of dpkg comes with your Ubuntu version, and substitute that in the commands in the linked question.
Raffa avatar
jp flag
Download the proper version with `apt download dpkg`
muru avatar
us flag
Looks like deleting the dpkg binary is not the only thing you did to your system. To really answer this, we need to know what exactly were you doing. Or you can just reinstall the system.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.