I have had mono-complete and mono-devel installed on my Ubuntu Server 18.10 for a couple months now to run some applications that depend on it. I am using Mono Prior to things breaking, I did a standard sudo apt update, saw many mono packages in the list to upgrade, then did a sudo apt upgrade. It went normally for most the install and then the terminal kept spitting out errors and errors and errors. The almost-endless errors would be printed out over and over for several seconds regardless of what I tried to do:

sudo apt upgrade
sudo apt --fix-broken install
sudo apt remove mono-complete mono-devel
sudo apt autoremove

Can't seem to upgrade or remove. If upgrading is impossible, I'd tried to remove and try a reinstall but removing failed too.

In the error it mentions not being able to find gdb or lldb. I then attempted to manually make and install gdb because I can't use apt... trying to do so will ask you to run sudo apt --fix-broken install which spits out the same errors. Installing gdb-8.2 is successful. The errors printed out change slightly and contain references to gdb (because now it's installed) but still haven't gotten anywhere.

  • How did mono break in the first place?
  • Why is trying to remove packages producing errors?
  • What's the best course of action to fix this situation? I'd rather not have to reinstall Ubuntu Server and set everything back up.

For what's being printed out in the error (before gdb install):

Aborted (core dumped)
E: installing Assembly /usr/share/cli-common/policies.d/libgtk2.0-cil/policy.2.8.gtk-sharp.dll failed
E: Installation of policy.2.8.gtk-sharp with /usr/share/cli-common/runtimes.d/mono failed
* Installing 1 assembly from policy.2.8.pango-sharp into Mono

41308000-41338000 rwxp 00000000 00:00 0
55b153398000-55b1537e1000 r-xp 00000000 08:02 3159129                    /usr/bin/mono-sgen

... cutting some of this out ...

7fb557c3b000-7fb557c88000 r--p 00000000 08:02 3160431                    /usr/lib/mono/gac/Mono.Security/
Memory around native instruction pointer (0x7fb5556e2c8f):
0x7fb5556e2c7f  20 48 09 d6 41 0f b6 53 05 48 c1 e2 28 48 09 f2   H..A..S.H..(H..
0x7fb5556e2c8f  66 41 0f 38 32 4b 06 66 0f 6f 05 b2 82 49 00 66  fA.82K.f.o...I.f
0x7fb5556e2c9f  0f 38 00 c8 66 48 0f 7e c8 66 48 0f 3a 16 ce 01  .8..fH.~.fH.:...
0x7fb5556e2caf  48 09 c6 48 09 d6 41 0f b6 c2 41 0f b6 53 09 48  H..H..A...A..S.H

Native stacktrace:

    /usr/bin/mono(+0x129f8d) [0x55b1534c1f8d]
    /usr/bin/mono(+0x12a295) [0x55b1534c2295]
    /usr/bin/mono(+0xbfd2f) [0x55b153457d2f]
    /usr/bin/mono(+0x414e8) [0x55b1533d94e8]
    /lib/x86_64-linux-gnu/libpthread.so.0(+0x12dd0) [0x7fb558343dd0]
    /usr/lib/mono/aot-cache/amd64/mscorlib.dll.so(+0x123c8f) [0x7fb5556e2c8f]

Waiting for dumping threads to resume

Debug info from gdb:

mono_gdb_render_native_backtraces not supported on this platform, unable to find gdb or lldb

Got a SIGILL while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.

Aborted (core dumped)
E: installing Assembly /usr/share/cli-common/policies.d/libgtk2.0-cil/policy.2.8.pango-sharp.dll failed
E: Installation of policy.2.8.pango-sharp with /usr/share/cli-common/runtimes.d/mono failed
^[[1mdpkg:^[[0m error processing package mono-gac (--configure):
installed mono-gac package post-installation script subprocess returned error exit status 29

8 Answers 8


I'm not 100% certain that these commands in this order will solve the problem every time but this is what happened and I was able to successfully reinstall Mono to get the applications that depend on it running again.

sudo apt remove mono-complete mono-devel

Some packages should be removed (gets to about ~15-25%) before errors start spitting out and you can't run this again.

sudo apt autoremove

Some packages should be removed before errors start spitting out and you can't run this again.

sudo apt remove mono-gac mono-runtime-common

Some packages should be removed before errors start spitting out and you can't run this again.

sudo apt autoremove

The rest of the Mono packages should remove completely this time without errors.

There must be certain package(s) that are the cause of the errors in the prior commands and when it's removed, the errors stop happening and the rest can be removed without issue.

Finally, reinstall Mono.

  • 1
    But I can't run apt remove because it says dpkg was interrupted and I must manually run sudo dpkg --configure -a, but this command just causes the above errors. Jul 27, 2019 at 2:40
  • crucial for me (on 18.04.1-Ubuntu) was sudo dpkg --force-all -P ca-certificates-mono and since sudo apt --fix-broken install nor any other 'fix' recipes did not work i removed everything mono in above fashion. In particular things like sudo dpkg --force-all -P mono-common mono-devel and sudo dpkg --force-all -P mono-4.0-gac mono-gac after that update, upgrade, and any fixing in style '--fix-broken install' and 'autoremove' cleaned the rest. Final score: $ mono --version Mono JIT compiler version (tarball Fri Aug 9 16:23:57 UTC 2019) ....
    – user309383
    Aug 13, 2019 at 13:37

Okay, if you're desperate enough to try anything just shy of what seems to be, sadly, an all too common resolution -- wiping the hard drive and reinstalling the OS from scratch...

I somehow managed to fix my ship. I'm not certain how and I'm not certain why, but this is the last few things I tried that for some reason produced a positive result:

sudo dpkg --remove --force-remove-reinstreq mono-complete  

It quickly returned to command prompt with no messages. Did it actually do anything? Who knows. ¯\(ツ)

sudo dpkg --remove --force-remove-reinstreq mono-devel  

It quickly returned to command prompt with no messages. Did it actually do anything? Who knows. ¯\(ツ)

sudo dpkg --remove --force-remove-reinstreq mono-gac  

It said it could not remove it due to dependencies

sudo dpkg --remove --force-remove-reinstreq mono-runtime-common  

It said it could not remove it due to dependencies

I then tried using Synaptic Package Manager to remove mono-devel. It was marked as not installed (see above) but offered COMPLETE removal. Selected that and applied. It produced a boatload of now-familiar dpkg errors and failed.

I tried using it to remove mono-runtime-common and it, too, produced a load of now-familiar dpkg errors and failed.

I then ran,

sudo apt-get purge mono-gac  

and for some reason THIS time it kinda, sorta worked. It uninstalled a load of stuff, but errored out on a lot of things. Yay, at least it made SOME sort of progress.

sudo apt-get update  
sudo apt-get upgrade  

now only showed three items that I was previously not able to upgrade because Mono had imploded. I was now able to successfully upgrade them.

I then then followed the Mono install instructions for ubuntu 18.04 at https://www.mono-project.com/download/stable/#download-lin
However, at Step 2, instead of installing mono-devel I installed mono-complete

It installed without errors and precompiled some stuff. After a reboot 2 of my 3 Mono-based apps were back up and running. The third I just had to do an in-place reinstall and it too came back after a reboot.

I sincerely hope you can manage to glean some help out of the above nonsense and here's to otherwise happy holidays, a great new year and other such stuff. :)

  • The results of apt policy mono-complete mono-devel show that I have both installed on 18.04 and mono is working on 18.04, so I suspect that there is a package management issue in the question. mono-complete and mono-devel packages are still available in the default repositories for 18.10 and 19.04.
    – karel
    Dec 25, 2018 at 7:37
  • Thanks for the response but I'm not sure if I am able to try any of these suggestions after what I tried last night. I'll note that when I originally ran sudo apt remove mono-complete mono-devel and sudo apt autoremove, some packages had been removed before errors started spitting out. Last night I ran sudo apt remove mono-gac mono-runtime-common and more packages we're removed before errors spat out. Then, suprisingly, when I ran sudo apt autoremove afterwards there were no errors, the rest of the packages were removed, and I think mono was successfully and completely uninstalled. Dec 25, 2018 at 16:41
  • However, reinstalling mono is the next step and I hope it goes smoothly so that I can get those applications running again. Dec 25, 2018 at 16:42
  • I'm not sure if it's one or several packages that are the cause, but whatever was removed before the errors starting spitting out on the second apt remove must have fixed the problem. It would be handy to know what package(s) were the specific cause to fix it again in the future. However, I don't know how easily this issue is reproducible. Dec 25, 2018 at 16:53
  • Yup, re-installation of mono was successful and my applications are running normally again! Dec 25, 2018 at 17:28

I had the same issue on my linux mint box 18.3 Sylvia. Had to use timeshift to reinstall the system. All I have done so far is to remove the mono ppa from the repository and, for the time being, I am able to update/upgrade the packages. I wait for the new mono fix to re-activate the repository. I know it is not a fix for the problem but, at least, it is a way to overcome the issue waiting for the real geeks to sort it out.

  • Thanks for the response! I hadn't heard of or used timeshift before but I'll take a look. I think I was able to successfully uninstall mono from my system last night. Is this the tool you we're referring to?. It is the server version though so command line only. I don't immediately see that you can use it through CLI. Dec 25, 2018 at 16:47

When you get those sgen errors you can try to rebuild the "ahead of time" cache. It will re-compile local arch native version of librairies. Worked great for me.

# as root
mono --aot /usr/lib/mono/4.5/mscorlib.dll
for i in /usr/lib/mono/gac/*/*/*.dll; do mono --aot $i; done

I had a similar problem. In my case mono-devel depended on mono-roslyn and for some reason mono-roslyn depends on mono-devel. So removing packages independently didn't work, but this did:

sudo dpkg --remove --force-remove-reinstreq mono-roslyn mono-devel

Here's what worked for me. I'm putting it together from my Bash history, so it might be incomplete.

First, I removed the package lists.

sudo rm /etc/apt/sources.list.d/mono-official-vs.list
sudo rm /etc/apt/sources.list.d/mono-official-vs.list.save 

After that, I ran the following:

sudo dpkg --configure -a

This spit out a list of mono dependencies that were problematic, ending with a message like this (the packages you see may vary):

Errors were encountered while processing:

Next, I removed these with sudo dpkg --purge --force-all (packages...)

sudo dpkg --purge --force-all mono-runtime libmono-i18n4.0-cil  libmono-i18n-west4.0-cil libmono-corlib4.5-cil

Then I ran the following:

sudo apt-get autoremove

This command spit out a massive list of mono-related dependencies with problems.

I continued running sudo dpkg --purge --force-all (packages...) with packages listed, then would run sudo apt-get autoremove again and more packages with errors would come up. I kept repeating this until sudo apt-get autoremove had no more errors.

After that, I ran sudo apt clean.


For anyone new that comes here where nothing works this got it working for me.

dpkg --list|grep mono|awk '{ print $2 }'|xargs sudo dpkg --force-all -P 
apt --fix-broken install

I ran in a similar situation after upgrading Mono on Ubuntu 21.10 when I tried to install and work with Pinta (an image manipulation app).

After updating from Mono 6.8 to recent 6.12 I was unable to apt update, apt install, apt autoremove or apt --fix-broken install.

The following remove command helped me removing all mono-related packages:

sudo apt remove mono-runtime ca-certificates-mono mono* libmono* libglib2.0-cil libgtk2.0-cil

Please take care removing the last two libraries - I did not run into issues so far but I don't know if there will be any side effects.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.