libdvd-pkg: `apt-get check` failed, you may have broken packages. Aborting

Solution 1:

One thing I did to fix this was after installing libdvd-pkg, run the following command to complete the setup:

sudo dpkg-reconfigure libdvd-pkg

If this problem persist, you can select not to do "automatic" updates.

Solution 2:

@devguy's answer echoes /usr/share/doc/libdvd-pkg/README.Debian:

dpkg-reconfigure libdvd-pkg may be used to build and install libdvdcss* package(s).

For background, take a quick look at the installed package to see how it works and where/why the problem occurs: The package installs the debian source packaging for a libdvdcss package, and from the postinst script, downloads the .orig.tar.gz source from videolan.org, and builds and installs binary packages. Most of the work is done in the /usr/lib/libdvd-pkg/b-i_libdvdcss.sh script and in the Debian source package in /usr/share/libdvd-pkg/debian/. The failure appears to be deliberately triggered before the source package build, since apt-get check will always fail when an apt-get install is running:

E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?

The author's reason for deliberately triggering the failure when installing via apt-get is described in this bug report just a little more clearly than in README.Debian:

Trouble is that libdvd-pkg hooks into APT post-invoke handler and run commands that normally never run on that stage. Therefore there is a risk and potential to break APT operations and cause system-wide effect...

I assume the reason to build libdvdcss.so from source is to skirt some legal or other issue surrounding distributing binaries. However, reading through the bug report, it's not clear why the package builds and installs a Debian package from source, and nesting the package installs (i.e. installing the libdvdcss package during the install of the libdvd-pkg package) is the root problem here. Alternative means of building and installing libdvdcss.so from source that could skirt this issue aren't discussed anywhere I've found.

Again, until the package's issues can be cleaned up, it appears @devguy's answer is the best interim workaround:

# Install base files; .postinst fails; libdvdcss package NOT installed
sudo apt-get install libdvd-pkg
# Re-run .postinst; libdvdcss package successfully builds and installs
sudo dpkg-reconfigure libdvd-pkg