4

I've just run an update on my system, and I have an install error for the msbuild package.

After run sudo apt update && sudo apt upgrade && sudo apt dist-upgrade, I got this error message:

Preparing to Unpack .../msbuild_1%3a16.0+xamarinxplat.2019.05.07.15.32-0xamarin2+ubuntu1804b1_all.deb ... 
Unpacking msbuild (1:16.0+xamarinxplat.2019.05.07.15.32-0xamarin2+ubuntu1804b1) over (1:16.0+xamarinxplat.2018.09.26.17.53-0xamarin3+ubuntu1804b1) ... 
dpkg: error while processing the file /var/cache/apt/archives/msbuild_1%3a16.0+xamarinxplat.2019.05.07.15.32-0xamarin2+ubuntu1804b1_all.deb (--unpack):
  trying to overwrite '/usr/lib/mono/msbuild/15.0', which is also in the package mono-roslyn 5.20.1.19-0xamarin2+ubuntu1804b1
Errors were encountered while processing:
  /var/cache/apt/archives/msbuild_1%3a16.0+xamarinxplat.2019.05.07.15.32-0xamarin2+ubuntu1804b1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I've also try to install with sudo dpkg -i --force-depends /var/cache/apt/archives/msbuild_1%3a16.0+xamarinxplat.2019.05.07.15.32-0xamarin2+ubuntu1804b1_all.deb. Then I got almost the same error message:

(Lendo banco de dados ... 230920 ficheiros e directórios actualmente instalados.)
A preparar para desempacotar .../msbuild_1%3a16.0+xamarinxplat.2019.05.07.15.32-0xamarin2+ubuntu1804b1_all.deb ... 
A descompactar msbuild (1:16.0+xamarinxplat.2019.05.07.15.32-0xamarin2+ubuntu1804b1) sobre (1:16.0+xamarinxplat.2018.09.26.17.53-0xamarin3+ubuntu1804b1) ... 
dpkg: erro ao processar o arquivo /var/cache/apt/archives/msbuild_1%3a16.0+xamarinxplat.2019.05.07.15.32-0xamarin2+ubuntu1804b1_all.deb (--install):
  a tentar sobre-escrever '/usr/lib/mono/msbuild/15.0', que também está no pacote mono-roslyn 5.20.1.19-0xamarin2+ubuntu1804b1
Erros foram encontrados durante o processamento de:
  /var/cache/apt/archives/msbuild_1%3a16.0+xamarinxplat.2019.05.07.15.32-0xamarin2+ubuntu1804b1_all.deb
7
sudo apt-get -o Dpkg::Options::="--force-overwrite" upgrade

fixed it for me

  • Short and to the point. Thanks. Fixed my problem :) – Sune Trudslev Jul 17 at 4:26
  • i get this error: text dpkg: warning: unable to delete old directory '/usr/lib/mono/xbuild/15.0/SolutionFile/ImportAfter': Directory not empty dpkg: warning: unable to delete old directory '/usr/lib/mono/xbuild/15.0/SolutionFile': Directory not empty dpkg: warning: unable to delete old directory '/usr/lib/mono/xbuild/15.0/Microsoft.Common.targets/ImportBefore': Directory not empty – Patrik Laszlo Jul 17 at 5:21
  • @PatrikLaszlo if it doesn't stop the upgrade from completing i'd ignore it – askcompu Jul 17 at 12:51
1

for me it worked in 2 steps:

apt upgrade -y
sudo apt-get -o Dpkg::Options::="--force-overwrite" upgrade
sudo dpkg -i --force-depends /var/cache/apt/archives/msbuild_1%3a16.0+xamarinxplat.2019.05.07.15.32-0xamarin2+ubuntu1804b1_all.deb
1

This happened to me on Both on Ubuntu and Debian 10.

This command fixed the issue for me:

sudo apt-get -o Dpkg::Options::="--force-overwrite" -f install

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.