I am in a big problem. Everything was running ok, then I tried to install MongoDB, I was getting dpkg: unrecoverable fatal error, aborting: statoverride file contains empty line
errors and was not able to install MongoDB. By mistake, I run sudo apt remove dpkg
. After that, no Linux commands are getting run. I am worried if my WSL ubuntu 18.04
is crashed. How can I recover this issue? I don't want to lose any work files. Please help.
Edit:
When I run the command sudo apt remove dpkg
after some time, it opened a screen asking OK
or CANCEL
. I did not understand and I close the terminal directly. So, I am really not getting what exactly happened. After that, I cannot run sudo apt
like commands.
apt
is a wrapper that usesdpkg
to install packages, so if you removeddpkg
you should not expect tools that use it to work (eg.apt
,apt-get
,aptitude
etc). Restoration of backups may be best, butdpkg
should not impact other commands, just the deb package install programs won't be able to install/remove etc. (dpkg
can't download packages, soapt
and front-end tools give the simpler tools greater functionality, calling the base programs to do the work as required) – guiverc Feb 09 '21 at 04:04dpkg
package? – Varsh Feb 09 '21 at 04:24dpkg
also gives errors. Like for the commandcp /var/backups/dpkg.status.0 /var/lib/dpkg/status
givescp: cannot stat '/var/backups/dpkg.status.0': No such file or directory
– Varsh Feb 09 '21 at 05:57dpkg
and not a removeddpkg
, however the second (1 upvote currently) example better suits your condition (as it re-installs rather than fixed a corrupteddpkg
as the most upvoted answer does); but you'll of course need to adapt that (which was for a now-outdated xenial and not your bionic) – guiverc Feb 09 '21 at 06:04grep
command is needed. In my case:./configure: line 1649: grep: command not found
– Varsh Feb 09 '21 at 06:22grep
too (why I suggested backups). You can explore youapt
history (/var/log/apt/history.log
) to see what you removed, and what you need to re-install as well (or did youpurge
and notremove
? .. depends rules may have meant you removed a number of packages that neededdpkg
). FYI: It's best if you add additional details to your question (you can edit your own questions) as details are easier to read there, and more people will see it, and don't hit "Y" (or yes; esp. '-y') to do it, until you've assessed the damage of commands – guiverc Feb 09 '21 at 06:26