Uninstall old versions of Libreoffice in ubuntu 22

I’ve checked current answers to this question but none are working for me. I have Ubuntu 22.04 with 3 versions of Libreoffice on my computer. I want to delete the older 2 but can’t seem to get rid of them.

I’ve tried the options shown in ‘Ask Libreoffice’ but none of them work for me. For example, here are error messages I got when I ran sudo dpkg -P libreoffice*
dpkg: warning: ignoring request to remove libreoffice_icon.jpeg which isn’t installed

I also got these error messages when I tried to run sudo apt-get remove --purge libreoffice*:
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
E: Unable to locate package libreoffice_icon.jpeg
E: Couldn’t find any package by glob 'libreoffice_icon.jpeg’
E: Couldn’t find any package by regex 'libreoffice_icon.jpeg’

I also tried to run:

dpkg --list | awk '/ii/&&/libreoffice7.3/||/libobasis7.1/{print $2}' | sudo xargs apt purge

which gave me this result:

**Reading package lists... Done**
**Building dependency tree... Done**
**Reading state information... Done**
**The following packages were automatically installed and are no longer required:**
**  libflashrom1 libftdi1-2 libllvm13 libmozjs-91-0**
**Use 'sudo apt autoremove' to remove them.**
**The following packages will be REMOVED:**
**  libobasis7.3-base* libobasis7.3-calc* libobasis7.3-core* libobasis7.3-draw***
**  libobasis7.3-en-us* libobasis7.3-extension-beanshell-script-provider***
**  libobasis7.3-extension-javascript-script-provider***
**  libobasis7.3-extension-mediawiki-publisher***
**  libobasis7.3-extension-nlpsolver* libobasis7.3-extension-pdf-import***
**  libobasis7.3-extension-report-builder* libobasis7.3-firebird***
**  libobasis7.3-gnome-integration* libobasis7.3-graphicfilter***
**  libobasis7.3-images* libobasis7.3-impress* libobasis7.3-kde-integration***
**  libobasis7.3-librelogo* libobasis7.3-libreofficekit-data* libobasis7.3-math***
**  libobasis7.3-ogltrans* libobasis7.3-onlineupdate***
**  libobasis7.3-ooolinguistic* libobasis7.3-postgresql-sdbc***
**  libobasis7.3-python-script-provider* libobasis7.3-pyuno***
**  libobasis7.3-writer* libobasis7.3-xsltfilter* libreoffice7.3***
**  libreoffice7.3-base* libreoffice7.3-calc* libreoffice7.3-debian-menus***
**  libreoffice7.3-dict-en* libreoffice7.3-dict-es* libreoffice7.3-dict-fr***
**  libreoffice7.3-draw* libreoffice7.3-en-us* libreoffice7.3-impress***
**  libreoffice7.3-math* libreoffice7.3-ure* libreoffice7.3-writer***
**0 to upgrade, 0 to newly install, 41 to remove and 0 not to upgrade.**
**After this operation, 618 MB disk space will be freed.**
**Do you want to continue? [Y/n] Abort.**

However, after all this, I still have the old versions installed. How do I get rid of them?

Alan

and why did you press n instead y ??

1 Like

Indeed. “n” is short for “no”, “y” for “yes”.
If you decline apt won’t remove the packages.

OK I tried similar Command, and it aborts immediately without any chance to hit y or n

Weird. I never used ubuntu to be honest (I use debian) but the following should work:

sudo apt-get purge libreoffice* --yes

Appending “–yes” will automatically execute the command, without prompting for “[Y/n]”.

Thanks for your suggestions. I did not get an opportunity to insert Y or N. When I tried the solution suggest by TheSmallest, I got this:
[sudo] password for asharpham:
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
E: Unable to locate package libreoffice_icon.jpeg
E: Couldn’t find any package by glob ‘libreoffice_icon.jpeg’
E: Couldn’t find any package by regex ‘libreoffice_icon.jpeg’

Any other suggestions?

Alan

What the heck did you install 3 versions of LibreOffice?! I would say that a proper install is to have one version installed via repos or via ppa, the other ones in parallel.
In this case it would be pretty easy to de-install the “main” LibreOffice and to delete the parallel installed ones.
.
What I would do:
De-install and erase every instance of LO (see: https://computingforgeeks.com/uninstall-libreoffice-on-ubuntu/?expand_article=1) and then install from anew. Bare in mind that LO’s user profiles are not touched by this.
.
Cheers

I guess I thought the original version of Libreoffice I had would be ‘overwritten’ by the new version. Alas, this was not the case. So when I ‘upgraded’ to a newer version, it left the old version on the computer. So now I have the job of getting rid of the old versions. I don’t mind getting rid of all the versions and reinstalling the latest one. I tried the suggestion found at https://computingforgeeks.com/uninstall-libreoffice-on-ubuntu/?expand_article=1 but I still get the error around ‘libreoffice_icon.jpeg’ that I’ve mentioned before. So where to from here?

Probably your installation somehow is corrupt. If I were you: Let the installed LO versions remain as they are and install a version in parallel. Work on this version until you think you should update. Then install a new one. (You may erase the old version ore even use it further.)… (Link for installing in parallel see above.) - Don’t waste your time anymore in searching for a clean deleting of the installed LO versions (sigh).
Cheers

Such a pity. I can’t see how anything is corrupt as the program works perfectly in any of its iterations. I guess it’s one of the down sides of Linux. On my Windows laptop, updating the software automatically replaces the old version. But that’s a work machine and I don’t want Windows infecting my personal computer! :roll_eyes:
Alan

No…it is one of the down sides of $user who mixed up different ways to install LO from different sources without knowing what.

thats it solved better on debian-based:

sudo apt-get update && sudo apt-get upgrade

does the same service for any software from your distro.

@asharpham.
STEP 1: Remove snap version of libreoffice
I don’t use snap, but if you do you have to run the following:
sudo snap remove libreoffice

STEP 2: Remove flatpak version of libreoffice
flatpak uninstall org.libreoffice.LibreOffice

STEP 3: Remove apt version of libreoffice
You already said this didn’t work. Maybe it works after step one and two though.
sudo apt-get purge libreoffice* --yes

STEP 4: Remove everything related to libreoffice on your device
Please verify the files first with this method. If you created files that contain “libreoffice” or “soffice” you might want to keep them.
find and list soffice (doesn’t remove anything yet)
sudo find / -name soffice 2>/dev/null
find and list libreoffice (doesn’t remove anything yet)
sudo find / -name libreoffice 2>/dev/null

delete those files
E.g. you can savely delete the following:

/usr/bin/soffice
/home/user/.config/libreoffice
/usr/share/libreoffice
/usr/share/doc/libreoffice
/usr/bin/libreoffice

etc.
Those two shouldn’t be deleted as far as I know:

/usr/share/bash-completion/completions/libreoffice
/usr/share/fonts/truetype/libreoffice

They provide completion for the terminal (e.g. type “libre” and hit TAB to autocomplete to libreoffice) and deleting fonts could break the appearance of some things.
Delete files and folders that you don’t need
EDIT: Be very carefull with “sudo rm -r”! If you e.g. do “sudo rm -r /” you break your system entirely and need to reinstall your OS!
sudo rm -r /path/to/file
e.g. sudo rm -r /home/user/.config/libreoffice

STEP 5
Do step 1 to 3 again. There should be no errors except for something along the lines “libreoffice isn’t installed”

STEP 6
Install libreoffice again. It’s best to install libreoffice with apt in my opinion. Check if everything works.

Hope that helps!

1 Like

Thanks. I tried Step 1 but that didn’t do anything. I didn’t try things like flatpak because I don’t have those versions. I tried apt-get again but got the same ‘libreoffice_icon.jpg’ error.

By the way, for those thinking I installed Libreoffice from alternate places, I always download from the official Libreoffice site.

Exactly that is also an alternative installation, past the normal installation via “sudo apt-get install libreoffice”!
This is not wrong, but also leaves untouched all versions previously installed this way.
You will find these versions as separate subdirectories of /opt/... and you can safely remove the complete subfolder.

Thanks for everyone’s answer. I managed to remove libreoffice 7.2 & 7.3 but now how do I remove them from ‘Show Applications’?

Those are .desktop files. You will find them in /usr/share/applications or $HOME/.local/share/applications. Delete all files containing “libreoffice” in those folders.

E.g. I have the following inside of /usr/share/applications:

libreoffice-base.desktop
libreoffice-calc.desktop
libreoffice-draw.desktop
libreoffice-impress.desktop
libreoffice-math.desktop
libreoffice-startcenter.desktop
libreoffice-writer.desktop
libreoffice-xsltfilter.desktop

Thanks. I found these but I can’t delete them. When I highlight them and press the Delete button, the computer just beeps at me and does nothing. When I right click one of them, select properties and click Permissions, it tells me I am not the owner and can’t change permissions. There is no other user of my computer so I’m not sure why ‘I am not the owner’.

no you are NOT the owner, until your sudo:

sudo rm -f $(ls /usr/share/applications/libreoffice-*.desktop)
1 Like

A Complete Guide to Linux File Ownership and Groups

Yes, it’s not quite as straightforward as opening Files and clicking Delete. One would think I should know all this after years of using Ubuntu! Thanks so much guys for helping me out. It seems to be done but I’ll let you know after I reboot as there still seems to be one Libreoffice7.3.7.2 item lurking in my ‘Show Applications’ list.

1 Like