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.
aptis a wrapper that usesdpkgto install packages, so if you removeddpkgyou should not expect tools that use it to work (eg.apt,apt-get,aptitudeetc). Restoration of backups may be best, butdpkgshould not impact other commands, just the deb package install programs won't be able to install/remove etc. (dpkgcan't download packages, soaptand 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:04dpkgpackage? – Varsh Feb 09 '21 at 04:24dpkgalso gives errors. Like for the commandcp /var/backups/dpkg.status.0 /var/lib/dpkg/statusgivescp: cannot stat '/var/backups/dpkg.status.0': No such file or directory– Varsh Feb 09 '21 at 05:57dpkgand not a removeddpkg, however the second (1 upvote currently) example better suits your condition (as it re-installs rather than fixed a corrupteddpkgas 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:04grepcommand is needed. In my case:./configure: line 1649: grep: command not found– Varsh Feb 09 '21 at 06:22greptoo (why I suggested backups). You can explore youapthistory (/var/log/apt/history.log) to see what you removed, and what you need to re-install as well (or did youpurgeand 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