Score:0

Accidentally remove perl5 and hundreds system packages in Ubuntu, how to restore?

ar flag

Recently i typed in terminal

sudo apt remove perl5

and press enter.

this action removed not only perl5 from ubuntu, but many other system packages, and even kernel modules. Here's what apt printed in terminal while removing is going on.

https://pastebin.com/AKUQUdwQ

System works, even after reboot, but I think that I removed some important packages. How to get system back without any backups? Manually install all removed packages?

OS details: Ubuntu 20.04.3 LTS desktop

My fear is that perl was needed by the system packages. Now i noticed that gnome-control-center and git were removed, and I manually reinstall it.

Artur Meinild avatar
vn flag
What's your evidence that you removed "important" packages? Apt should not remove anything needed by anything else than perl.
guiverc avatar
cn flag
You've provided no OS & release details, but if you remove a package, everything that relies/depends on that package will be removed also; which is why you're asked to confirm the removal of packages. Don't say "y" to accept the changes if it looks wrong. As we don't know what system you're using (desktop? server? release etc - packages match 20.04/focal - but it's best if we're told!) we don't know what is expected for your *unstated* system.
Vasiliy Platon avatar
ar flag
My fear is that perl was needed by the system packages. Now i noticed that gnome-control-center and git were removed. Added OS deatils: Ubuntu 20.04.3 LTS desktop
Score:1
cn flag

As you discover applications that are missing (like gnome-control-center and git), simply reinstall them.

Apt will automatically handle all the dependencies (including perl)

If applications are missing and you don't notice, then perhaps you don't need them anymore anyway.

This kind of huge autoremoval usually happens under any of three circumstances:

  • The user has been mucking about with apt-mark.
  • The user DIDN'T use the normal Desktop installer. The Desktop installer protects from mass autoremovals, the netinstall/minimal image does not.
  • The user changed their Desktop environment sometime in the past.
Score:0
it flag

Your entire dpkg database (located at /var/lib/dpkg) is backed up many times over at /var/backups. There should be up to 7 copies of each file in the database.

However, if I were you, the first thing I would do is back up EVERYTHING that you currently have before you do anything else (just in case things somehow end up worse. You will be using powerful commands in dangerous places.)

Vasiliy Platon avatar
ar flag
Yes, there is backups dpkg database in /var/backups. How to inflate it?
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.