11

Today my Ubuntu updated Mono to 4.2.1.102. It will not allow a certain program I absolutely need to run. How can I down-grade it to 4.0.5.1? I have tried...

sudo apt-get install mono-complete=4.0.5.1

That doesn't work.

Buford T. Justice
  • 213
  • 1
  • 2
  • 6

2 Answers2

19

Edit your /etc/apt/sources.list.d/mono-xamarin.list and change:

deb http://download.mono-project.com/repo/debian wheezy main

to:

deb http://download.mono-project.com/repo/debian wheezy/snapshots/4.0.5.1 main

That will pin it to version 4.0.5.1.

FYI: Make sure that you do not have any alpha/beta repos for mono in any of your /etc/apt/sources/list.d/xxxxx.list files.

Basic Steps to Downgrade:

sudo apt-get remove mono-complete
# Edit your mono-xamarin.list and pin it to the version of your choice.
sudo apt-get update
sudo apt-get install mono-complete

Accessing older releases If for some reason you want to pin an older version of Mono rather than updating to the latest, you can modify the Debian repository to “wheezy/snapshots/X.XX.X” instead of “wheezy”. For example, “wheezy/snapshots/3.10.0” will lock you to that version.

These snapshots will cease receiving updates as soon as the next major Mono version gets uploaded - for example, as soon as Mono 3.12 gets uploaded, 3.10 will never receive updates.

On RPM distributions, force the package version in your package manager - all older versions are published in the YUM metadata and should be available.

Ref: http://www.mono-project.com/docs/getting-started/install/linux/#accessing-older-releases

Ref: Versions available:

http://download.mono-project.com/repo/debian/pool/main/m/mono/

SushiHangover
  • 73,120
  • 10
  • 106
  • 165
  • 1
    I thought it was going to work there, but I keep getting... W: Conflicting distribution: download.mono-project.com wheezy/snapshots/4.0.5.1 InRelease (expected wheezy/snapshots but got wheezy) – Buford T. Justice Nov 17 '15 at 23:08
  • 2
    'deb download.mono-project.com/repo/debian wheezy/snapshots/4.0.5.1 main' needs to be 'deb download.mono-project.com/repo/debian wheezy/snapshots/4.0.5.1/. main' to make it work. Adding '/.' makes it work for whatever reason. – Buford T. Justice Nov 18 '15 at 07:57
  • 1
    Related bug: https://bugzilla.xamarin.com/show_bug.cgi?id=24902, sometimes the adding of `/.` doesn't seem to work so you should try `wheezy/snapshots 4.0.5.1/main`. – Gerhard Burger Apr 18 '16 at 14:50
  • Thanks for the info/bug link – SushiHangover Apr 18 '16 at 14:51
  • They made that URL as hard as possible to get right! It's not even browsable! – Dagrooms Sep 27 '17 at 20:41
  • I've tried all combinations mentioned here for the deb line and none of them work for me on ubuntu xenial: `deb "https://download.mono-project.com/repo/ubuntu" xenial/snapshots/5.0.1.1 main`, `deb "https://download.mono-project.com/repo/ubuntu" xenial/snapshots/5.0.1.1/. main`, `deb "https://download.mono-project.com/repo/ubuntu" xenial/snapshots 5.0.1.1/main` – carlin.scott Oct 24 '17 at 19:27
  • @carlin.scott Are you including those quotation marks when you edit the `mono-xamarin.list`? `5.0.1.1` exists in the debian pool, so `deb http://download.mono-project.com/repo/debian xenial/snapshots/5.0.1.1 main` – SushiHangover Oct 24 '17 at 19:42
  • @SushiHangover The quotes were there before I made changes to the list file and removing them has no impact. I even copy/pasted your proposed line and it resulted in no mono-devel packages being found. – carlin.scott Oct 24 '17 at 23:59
  • When I try this on Ubuntu 18.04 I get the error `(expected bionic/snapshots/5.12 but got bionic)` – Aaron Franke Oct 08 '18 at 07:59
1

If, like me, you followed the official guide: https://www.mono-project.com/download/stable/ then you would have added an apt key and created /etc/apt/sources.list.d/mono-official-stable.list You can keep the key, but remove the file above using sudo rm -r /etc/apt/sources.list.d/mono-official-stable.list Then make sure you follow the best answer above by editing the mono-xamarin.list file for the version you want and remove the version of mono you have. Then apt update, then install mono-complete. An easy way to know you are correctly downloading and compiling a different version is that apt will prompt you asking if you want to download the files, and the size will be different.

Hope this helps someone, this last step made it work for me. My system is Ubuntu 18.04.