12

I've been trying to remove mono completely from my Ubuntu 12.04 installation.

I have seen a few other posts with:

sudo apt-get purge mono-runtime  
sudo apt-get purge mono-complete  
sudo apt-get purge libmono* libgdiplus cli-common libglitz-glx1 libglitz1

I've run all those and done sudo apt-get update but when I type mono -V it's still there.

I'm trying to remove it completely to re install again with the latest beta build Mono JIT compiler version 2.10.8 (tarball Wed Oct 2 16:46:11 CEST 2013) Is the version I have currently but NEED the latest beta build.

7
  • Can you run whereis mono and tell me the output please? Jul 6, 2015 at 2:27
  • mono: /usr/lib/mono /usr/local/bin/mono /usr/local/etc/mono /usr/local/lib/mono @Grammargeek
    – Lero
    Jul 6, 2015 at 2:28
  • How about dpkg --list | grep mono? Jul 6, 2015 at 2:30
  • ii fonts-tlwg-mono 1:0.4.17-1ubuntu1 Thai TlwgMono font ii monodoc-manual 4.0.2.5-0xamarin1 compiled XML documentation from the Mono project ii ubuntu-mono 0.0.40 Ubuntu Mono Icon theme @Grammargeek
    – Lero
    Jul 6, 2015 at 2:30
  • Those naughty naughty mono contributers. Try sudo rm -rf usr/lib/mono /usr/local/bin/mono /usr/local/etc/mono /usr/local/lib/mono (BACK IT UP FIRST!) Jul 6, 2015 at 2:34

3 Answers 3

42
sudo apt remove --purge --auto-remove mono-runtime

This will then completely remove mono from your system to correct the issue.

4

Ok simply run sudo rm -rf usr/lib/mono /usr/local/bin/mono /usr/local/etc/mono /usr/local/lib/mono in terminal.

2
  • 5
    I know this answer is old, but I'd like to point out that after issuing above commands, /etc/ca-certificates/update.d/mono-keystore is running dry, because it does not find the mono cert-sync binary. Manually messing around with rm is rarely a good idea... I would recommend apt list --installed '*mono*' first and then remove the unwanted packages (not ALL the listed, because that would remove ubuntu-mono icon theme) that are listed there. If that doesn't catch everything, move on with Lino Barreca's answer below.
    – UniversE
    Mar 5, 2020 at 9:54
  • another way to list mono* packages apt list --installed | grep ^mono Oct 13, 2021 at 3:16
2

This is how I did on my 16.04
Before someone starts raging and telling me there was a better, faster and more concise way to do that: Yes, I know. I took the "long way" to analyze the results of each step and triple check what I was doing.

  1. be su:
    sudo -i
  2. list all the packages from the mono repository (into file pkg1):
    grep ^Package: /var/lib/apt/lists/download.mono-project.com*_Packages > pkg1
  3. extract just the package names (into file pkg2):
    sed -e 's/^.*Package: //' pkg1 > pkg2
  4. (optional but I wanted to do that anyway) remove duplicate package names from different architectures and put definitive list of packages to search for and remove in pkg3:
    awk '!seen[$0]++' pkg2 > pkg3
  5. (optional, for check) count the lines in the files (one line = one package) to see what happened:
    wc -l pkg1 and wc -l pkg2 and wc -l pkg3
  6. remove packages listed in pkg3:
    apt purge $(cat pkg3)
  7. cleanup and exit su:
    rm pkg1 pkg2 pkg3 and logout

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .