0

I was trying to uninstall LibreOffice from my Ubuntu 15.04 running Xfce. I typed the following command in the Terminal:

sudo apt-get --purge libre*

It took a while before I realised that the process was erasing more than I needed, since components such as dpkg, gimp, compiz, have also been removed.

Is there any way to check the extent of the damage that has been done and recover? I must say that I cannot reinstall the operating system at the moment.

Thank you.

2 Answers2

0

The command

sudo apt-get --purge libre*

does exactly nothing it is wrong

E: Command line option --purge is not understood

If you have used the next command (in my test in a bash shell it does also nothing? ...)

sudo apt-get purge libre*

use the command below to identify the purged packages for a given date, eg for 2015-08-28

awk '/Start-Date: 2015-08-28/,/End-Date: 2015-08-28/ {if ($0 ~ /Purge/) {sub(/Purge: /,"",$0); print $0}}' /var/log/apt/history.log

Check the list and reinstall the purged packages via

awk '/Start-Date: 2015-08-28/,/End-Date: 2015-08-28/ {if ($0 ~ /Purge/) {sub(/Purge: /,"",$0); print $0}}' /var/log/apt/history.log | awk '{for (i=i;i<=NF;i++) {if (i%2 == 1) {system("sudo apt-get install -y "$i)}}}'

Example

I've started the command below

sudo apt-get purge librevenge-0.0-0

I get the following output

% awk '/Start-Date: 2015-08-28/,/End-Date: 2015-08-28/ {if ($0 ~ /Purge/) {sub(/Purge: /,"",$0); print $0}}' /var/log/apt/history.log
libreoffice-pdfimport:amd64 (5.0.1~rc2-0ubuntu1~vivid1)
libmspub-0.1-1:amd64 (0.1.1-2)
libreoffice-base-core:amd64 (5.0.1~rc2-0ubuntu1~vivid1)
libreoffice:amd64 (5.0.1~rc2-0ubuntu1~vivid1)
libwpg-0.3-3:amd64 (0.3.0-3)
libreoffice-writer:amd64 (5.0.1~rc2-0ubuntu1~vivid1)
libmwaw-0.3-3:amd64 (0.3.4-1)
libvisio-0.1-1:amd64 (0.1.0-2)
libreoffice-impress:amd64 (5.0.1~rc2-0ubuntu1~vivid1)
libreoffice-help-de:amd64 (5.0.1~rc2-0ubuntu1~vivid1)
libreoffice-avmedia-backend-gstreamer:amd64 (5.0.1~rc2-0ubuntu1~vivid1)
libreoffice-base:amd64 (5.0.1~rc2-0ubuntu1~vivid1)
librevenge-0.0-0:amd64 (0.0.1-3)
libreoffice-draw:amd64 (5.0.1~rc2-0ubuntu1~vivid1)
libreoffice-core:amd64 (5.0.1~rc2-0ubuntu1~vivid1)
libreoffice-gnome:amd64 (5.0.1~rc2-0ubuntu1~vivid1)
libreoffice-sdbc-firebird:amd64 (5.0.1~rc2-0ubuntu1~vivid1)
libwps-0.3-3:amd64 (0.3.0-2)
unoconv:amd64 (0.6-6)
inkscape:amd64 (0.91-3ubuntu1)
libreoffice-report-builder-bin:amd64 (5.0.1~rc2-0ubuntu1~vivid1)
libwpd-0.10-10:amd64 (0.10.0-2)
libreoffice-help-en-us:amd64 (5.0.1~rc2-0ubuntu1~vivid1)
libreoffice-ogltrans:amd64 (5.0.1~rc2-0ubuntu1~vivid1)
python3-uno:amd64 (5.0.1~rc2-0ubuntu1~vivid1)
libabw-0.1-1:amd64 (0.1.0-2)
libe-book-0.1-1:amd64 (0.1.1-2)
libreoffice-sdbc-hsqldb:amd64 (5.0.1~rc2-0ubuntu1~vivid1)
libreoffice-gtk:amd64 (5.0.1~rc2-0ubuntu1~vivid1)
mythes-de:amd64 (20120516-2)
libcdr-0.1-1:amd64 (0.1.0-3)
libodfgen-0.1-1:amd64 (0.1.1-2)
mythes-en-us:amd64 (4.2.1-0ubuntu3)
libreoffice-base-drivers:amd64 (5.0.1~rc2-0ubuntu1~vivid1)
libfreehand-0.1-1:amd64 (0.1.0-2)
libreoffice-math:amd64 (5.0.1~rc2-0ubuntu1~vivid1)
libreoffice-calc:amd64 (5.0.1~rc2-0ubuntu1~vivid1)
A.B.
  • 90,397
  • I did use the "purge", not the "--purge" mentioned in the post. However, the awk command only reveals that libreoffice related components were removed.

    Still, when I check Ubuntu Software center history, it shows a list of over 100 different components that were removed that day.

    – Antonie George Aug 28 '15 at 18:31
  • Sorry, answer updated – A.B. Aug 28 '15 at 18:37
  • I get mostly the same. However, here is the list found in /var/log/dpkg.log regarding what components have been uninstalled on the very same day. Note that I did not uninstall anything else separately. May it be I didn't correctly understood the listed processes?

    Warning, huge list.

    http://dumptext.com/kFlf8Jtl

    – Antonie George Aug 28 '15 at 19:32
0

You could just reinstall the lost one, and type this in the terminal:

sudo apt-get install dpkg gimp compiz

and then it might work fine this way.

Michael
  • 2,499
  • 5
  • 19
  • 24