I tried fixing a broken autodl irssi installation on a rented dedicated server running Ubuntu 18.04.1 LTS (GNU/Linux 4.9.0-15-amd64 x86_64) and Swizzin Box by removing and reinstalling the box autodl package.
removing autodl gave :-
SUCCESS autodl removed
ERROR dpkg database is locked by apt-get. Please try again latertrying to reinstall it gave :-
INFO Installing autodl
E: Unable to correct problems, you have held broken packages.
ERROR The simulation check resulted in an error. Please consult the log.the log shows
Reading package lists...
Building dependency tree...
Reading state information...
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies: pkg-config : Depends: libdpkg-perl but it is not installedrunning 'apt --fix-broken install' gives :-
0 upgraded, 0 newly installed, 1 to remove and 107 not upgraded.
After this operation, 193 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 87206 files and directories currently installed.)
Removing pkg-config (0.29-4+b1) ...
Can't locate Dpkg/Arch.pm in @INC (you may need to install the Dpkg::Arch module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/share/pkg-config-dpkghook line 14.
BEGIN failed--compilation aborted at /usr/share/pkg-config-dpkghook line 14.
dpkg: error processing package pkg-config (--remove): subprocess installed pre-removal script returned error exit status 2
Errors were encountered while processing: pkg-config
E: Sub-process /usr/bin/dpkg returned an error code (1)Does anyone have any suggestions how I can resolve this issue?
31 Answer
Try sudo apt --fix-broken install libdpkg-pearl. Also, look to see if you have any pinned packages: run apt policy, and check for anything interesting. In this case, 'interesting' includes any third-party repositories: if the line doesn't include "ubuntu.com", its suspicious.
There are cases where third-party repositories (those that aren't from Canonical) are needed, such as for proprietary software that can't be redistributed or when the latest upstream version of software is a hard requirement. However, these repositories MUST be designed specifically to work with the base installation of whatever OS you have, and should not contain extraneous packages. You should absolutely never attempt to gain compatibility by adding references to another operating system: for instance, by adding Debian Stretch as a package source for a Ubuntu Bionic release. Lots of bizarre package conflicts and unexpected replacements can occur.
I wasn't able to recreate this situation in a chroot: apt --fix-broken install worked even after some aggressive removals. Aptitude may be able to give you more info, but I doubt you'll be able to get it running, given you're current package mess. A pastebin of dpkg --list would be the next bit of debugging information.