0

I accidently run the autoremove command and now my chrome, terminal, my software updater and many more apps are GONE. What should I do now and how do I install them? Please help me.

DK Bose
  • 42,548
  • 23
  • 127
  • 221

1 Answers1

0

Find out which packages were removed by sudo apt autoremove with the help of the logfiles /var/log/apt/history*:

cd /var/log/apt
zgrep autoremove history.log*

Output should be similar to

history.log.3.gz:Commandline: apt autoremove
history.log.5.gz:Commandline: apt autoremove
history.log.5.gz:Commandline: apt autoremove
history.log.6.gz:Commandline: apt autoremove
history.log.6.gz:Commandline: apt autoremove
history.log.8.gz:Commandline: apt autoremove

This means the file history.log.8.gz (and the others) contains details about the apt autoremove command. Now do

zless history.log.8.gz

Find the "offending" section; type /autoremove to search for it or simply hit PgDn a few times until you find it. The logfile won't be that large. You should find a section similar to this one:

Start-Date: 2018-06-08  21:34:40
Commandline: apt autoremove
Requested-By: pduck (1001)
Remove: linux-image-4.13.0-39-generic:amd64 (4.13.0-39.44), linux-signed-image-4.13.0-39-generic:amd64 (4.13.0-39.44), linux-signed-image-4.13.0-38-generic:amd64 (4.13.0-38.43), linux-image-extra-4.13.0-38-generic:amd64 (4.13.0-38.43), linux-image-extra-4.13.0-39-generic:amd64 (4.13.0-39.44), libisns0:amd64 (0.97-2), linux-headers-4.13.0-38:amd64 (4.13.0-38.43), linux-headers-4.13.0-39:amd64 (4.13.0-39.44), linux-headers-4.13.0-39-generic:amd64 (4.13.0-39.44), linux-headers-4.13.0-38-generic:amd64 (4.13.0-38.43), linux-image-4.13.0-38-generic:amd64 (4.13.0-38.43)
End-Date: 2018-06-08  21:35:08

This means user pduck issued apt autoremove at 2018-06-08 21:34:40 and the listed packages were removed. The command completed at 2018-06-08 21:35:08. Note that this example doesn't show an "offending" process, it's just for illustration. You need to find the autoremove command in your logfiles that removed the packages you are talking about.

You can also issue

zgrep -A2 autoremove history.log*

to include two lines after the matching line (autoremove), i.e. also show the Remove:... lines. Maybe that's easier for identifying the "offending" section.

Now that you have a list of removed packages you can reinstall them via apt install.

PerlDuck
  • 13,335