0

I'm not sure what caused this to happen, but it occurred after Ubuntu attempted to install kernel updates. I could no longer boot with the newest kernel. I booted with a previous kernel, cleared some space (the reason the update failed) and I could boot again. However, now I'm left with a broken package.

Simultaneously I was attempting to install Emulation Station. I got some errors during install which prompted me to clear space, which led to the above issue.

Finally, I'm left with a broken package that is hindering me from installing any new software. libsdl2-dev is broken according to synaptic and it can't seem to repair it. I attempted to reinstall via synaptic and had no luck. The following error is from letting it attempt repair:

(Reading database ... 385577 files and directories currently installed.)
Preparing to unpack .../libsdl2-2.0-0_2.0.2+dfsg1-3ubuntu1.1_amd64.deb ...
Unpacking libsdl2-2.0-0:amd64 (2.0.2+dfsg1-3ubuntu1.1) ...
dpkg: error processing archive /var/cache/apt/archives/libsdl2-2.0-0_2.0.2+dfsg1-3ubuntu1.1_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0', which is also in package libsdl2:amd64 2.0.3+z4~20140315-8621-1ppa1precise1
Errors were encountered while processing:
 /var/cache/apt/archives/libsdl2-2.0-0_2.0.2+dfsg1-3ubuntu1.1_amd64.deb
Error in function: 
dpkg: dependency problems prevent configuration of libsdl2-dev:
 libsdl2-dev depends on libsdl2-2.0-0 (= 2.0.2+dfsg1-3ubuntu1.1); however:
  Package libsdl2-2.0-0:amd64 is not installed.

dpkg: error processing package libsdl2-dev (--configure):
 dependency problems - leaving unconfigured

I've searched Google and found no posts regarding this specific dependency/package.

  • sudo apt-get -f install yields Get:1 us.archive.ubuntu.com/ubuntu trusty-updates/universe libsdl2-2.0-0 amd64 2.0.2+dfsg1-3ubuntu1.1 [317 kB] Fetched 317 kB in 0s (1,246 kB/s) (Reading database ... 385577 files and directories currently installed.) Preparing to unpack .../libsdl2-2.0-0_2.0.2+dfsg1-3ubuntu1.1_amd64.deb ... – Steven Hafer Mar 1 '17 at 18:24
  • Unpacking libsdl2-2.0-0:amd64 (2.0.2+dfsg1-3ubuntu1.1) ... dpkg: error processing archive /var/cache/apt/archives/libsdl2-2.0-0_2.0.2+dfsg1-3ubuntu1.1_amd64.deb (--unpack): trying to overwrite '/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0', which is also in package libsdl2:amd64 2.0.3+z4~20140315-8621-1ppa1precise1 Errors were encountered while processing: /var/cache/apt/archives/libsdl2-2.0-0_2.0.2+dfsg1-3ubuntu1.1_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1) – Steven Hafer Mar 1 '17 at 18:25
  • 3
    Possible duplicate of dpkg error: "trying to overwrite file, which is also in..." – karel Mar 14 at 11:43
0

The immediate problem is written in plain language in your error message:

dpkg: error processing archive /var/cache/apt/archives/libsdl2-2.0-0_2.0.2+dfsg1-3ubuntu1.1_amd64.deb (--unpack): trying to overwrite '/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0', which is also in package libsdl2:amd64 2.0.3+z4~20140315-8621-1ppa1precise1

Okay, that actually could be plainer. Let's say it again without all the complicated filenames:

dpkg: error processing NEW_PACKAGE: trying to overwrite FILE, which is also in OLD_PACKAGE

Each file in your system can be provided by one (and only one) package at a time. When more than one package tries to provide the same file, those packages conflict.

In other words, NEW_PACKAGE and OLD_PACKAGE conflict. They both try to provide the same FILE.

The deeper problem is that you are adding PPAs and other Non-Ubuntu sources that provide conflicting packages.

Example: Your old libsdl2 is libsdl2:amd64 2.0.3+z4~20140315-8621-1ppa1precise1.

  • It's a 12.04 package on a 14.04 system (bad!)

  • It's a PPA package providing a key system service (bad!)

  • The PPA package uses a weird, nonstandard versioning that doesn't quite match either Ubuntu nor Debian (bad!)

A couple of these, and you are well on the road to a broken system and a full reinstall.

The easiest way to avoid this problem is to minimize the use of PPAs and stick to the tested, compatible Ubuntu repos.

How to fix your immediate problem:

  1. Find that PPA in your apt sources. Delete it. It's not your friend anymore.
  2. Uninstall all packages provided by that PPA.
  3. Since you changed your sources, refresh your package database (sudo apt-get update)
  4. Reinstall the removed software, this time from the Ubuntu repos (sudo apt-get install <whatever>)

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.