0

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

  • 1
    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. – Esther Jun 29 '23 at 15:04
  • Download the proper version with `apt download dpkg` – Raffa Jun 29 '23 at 15:09
  • 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. – muru Jun 30 '23 at 15:30

0 Answers0