Score:1

Tried to install mono. Now apt is broken

ma flag

I tried to install mono for Ubuntu 20.04. I used these commands.

sudo apt install gnupg ca-certificates
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update

After that I ran this command sudo apt install mono-devel and got this output:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libmono-corlib4.5-cil : Depends: mono-runtime (< 6.8.0.106) but 6.12.0.122-0xamarin1+ubuntu2004b1 is to be installed
 mono-devel : Depends: libmono-cecil-private-cil (>= 6.12.0.122) but it is not going to be installed
              Depends: libmono-cecil-private-cil (< 6.12.0.123) but it is not going to be installed
              Depends: libmono-codecontracts4.0-cil (>= 1.0) but it is not going to be installed
              Depends: libmono-compilerservices-symbolwriter4.0-cil (>= 3.6.0) but it is not going to be installed
              Depends: libmono-peapi4.0a-cil (>= 3.2.8) but it is not going to be installed
              Depends: libmono-relaxng4.0-cil (>= 2.10.1) but it is not going to be installed
              Depends: libmono-system-configuration-install4.0-cil (>= 1.0) but it is not going to be installed
              Depends: libmono-system-io-compression-filesystem4.0-cil (>= 3.2.1) but it is not going to be installed
              Depends: libmono-system-runtime4.0-cil (>= 2.10.1) but it is not going to be installed
              Depends: libmono-system-servicemodel4.0a-cil (>= 3.2.3) but it is not going to be installed
              Depends: mono-mcs (= 6.12.0.122-0xamarin1+ubuntu2004b1) but it is not going to be installed
              Depends: mono-roslyn (= 6.12.0.122-0xamarin1+ubuntu2004b1) but it is not going to be installed
              Depends: mono-xbuild (= 6.12.0.122-0xamarin1+ubuntu2004b1) but it is not going to be installed
              Depends: libmono-cil-dev (= 6.12.0.122-0xamarin1+ubuntu2004b1) but it is not going to be installed
              Depends: libmono-2.0-dev (>= 6.12.0.122-0xamarin1+ubuntu2004b1) but it is not going to be installed
              Depends: libmono-2.0-dev (< 6.12.0.122-0xamarin1+ubuntu2004b1.1~) but it is not going to be installed
              Depends: ca-certificates-mono (= 6.12.0.122-0xamarin1+ubuntu2004b1) but 6.8.0.105+dfsg-3.2 is to be installed
              Recommends: mono-csharp-shell but it is not going to be installed
              Recommends: referenceassemblies-pcl but it is not going to be installed
              Recommends: msbuild but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

If I run apt --fix-broken install I get this output:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following package was automatically installed and is no longer required:
  libmono-corlib4.5-dll
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
  libmono-corlib4.5-cil
The following packages will be upgraded:
  libmono-corlib4.5-cil
1 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.
37 not fully installed or removed.
Need to get 0 B/1,257 kB of archives.
After this operation, 4,620 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
dpkg: warning: files list file for package 'mono-runtime-common' missing; assuming package has no files currently installed
(Reading database ... 310583 files and directories currently installed.)
Preparing to unpack .../libmono-corlib4.5-cil_6.12.0.122-0xamarin1+ubuntu2004b1_all.deb ...
Unpacking libmono-corlib4.5-cil (6.12.0.122-0xamarin1+ubuntu2004b1) over (6.8.0.105+dfsg-3.2) ...
dpkg: error processing archive /var/cache/apt/archives/libmono-corlib4.5-cil_6.12.0.122-0xamarin1+ubuntu2004b1_all.deb (--unpack):
 trying to overwrite '/usr/lib/mono/4.5/mscorlib.dll', which is also in package libmono-corlib4.5-dll 6.8.0.105+dfsg-3.2
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/libmono-corlib4.5-cil_6.12.0.122-0xamarin1+ubuntu2004b1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

If I run apt autoremove I get this output:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libmono-corlib4.5-cil : Depends: mono-runtime (< 6.8.0.106) but 6.12.0.122-0xamarin1+ubuntu2004b1 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

I don't actually want mono anymore and would just like it removed and this problem fixed.

David avatar
cn flag
Please do not show pictures of text. Include the text in the body of the question. Also please include in the question the actual 4 commands you ran exactly as you ran them and any results they showed.
NoahGav avatar
ma flag
@David Is this better?
Score:1
ma flag

I fixed the problem by manually deleting the directories /usr/share/libmono-corlib4.5-cil and /usr/share/libmono-corlib4.5-dll.

After that I ran the commands:

sudo apt update
sudo apt install libmono-corlib4.5-cil
sudo apt update
sudo apt --fix-broken install
sudo apt autoremove
sudo apt update
sudo apt full-upgrade
sudo rm /etc/apt/sources.list.d/mono-official-stable.list
sudo apt-key del 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
sudo apt update
sudo apt full-upgrade

This fixed all my problems.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.