Score:0

Having issues with 'apt' [apt --fix-broken install]

nl flag

Over the past couple of days, I have been trying to install Fail2Ban on my Ubuntu server. I am continuously having problems installing. I have tried so many routes to fix this, but with no success. Each time I try to install the program, I get an error / suggestion that I need to fix the broken install. When I follow the instructions to fix it, I get an error. The code below is what I am getting.

root@ubuntu-s-2vcpu-2gb-nyc1-01:~# sudo apt install fail2ban
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libc6-dev : Depends: libc-dev-bin (= 2.31-0ubuntu9.7) but 2.31-0ubuntu9.2 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
root@ubuntu-s-2vcpu-2gb-nyc1-01:~# apt --fix-broken install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  python3-acme python3-certbot python3-configargparse python3-future python3-icu python3-josepy python3-mock
  python3-parsedatetime python3-pbr python3-pyparsing python3-requests-toolbelt python3-rfc3339 python3-tz
  python3-zope.component python3-zope.event python3-zope.hookable
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
  libc-dev-bin
The following packages will be upgraded:
  libc-dev-bin
1 upgraded, 0 newly installed, 0 to remove and 49 not upgraded.
1 not fully installed or removed.
Need to get 0 B/71.6 kB of archives.
After this operation, 1024 B of additional disk space will be used.
Do you want to continue? [Y/n] 
(Reading database ... 135346 files and directories currently installed.)
Preparing to unpack .../libc-dev-bin_2.31-0ubuntu9.7_amd64.deb ...
Unpacking libc-dev-bin (2.31-0ubuntu9.7) over (2.31-0ubuntu9.2) ...
dpkg: error processing archive /var/cache/apt/archives/libc-dev-bin_2.31-0ubuntu9.7_amd64.deb (--unpack):
 unable to create '/usr/bin/gencat.dpkg-new' (while processing './usr/bin/gencat'): Operation not permitted
Errors were encountered while processing:
 /var/cache/apt/archives/libc-dev-bin_2.31-0ubuntu9.7_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
guiverc avatar
cn flag
Lubuntu is a desktop release; but you mention *server* in your question? Why the Lubuntu desktop tag if it's a server?
guiverc avatar
cn flag
Check your sources; two repositories provide `libc-dev-bin | 2.31-0ubuntu9.7 | focal-updates | amd64, arm64, armhf, i386, ppc64el, riscv64, s390x` (-updates & -security).. ie. read the output of `sudo apt update` & look for warnings, missing lines etc.
Score:0
cn flag

This issue has happened to me multiple time. These are the things that fix it most of the time :

  • First and foremost, sudo apt update; sudo apt upgrade; sudo apt autoremove
  • Disable your antivirus, if you have one (Yes, I use an antivirus on Ubuntu)
  • Tedious, but installing all the dependencies manually from pkgs.org
nl flag
Thank you for the response. I have done the your suggestion and I get this result... *The following packages have unmet dependencies: libc6-dev : Depends: libc-dev-bin (= 2.31-0ubuntu9.7) but 2.31-0ubuntu9.2 is installed*
The Cool Man avatar
cn flag
Install the right version of the dependency : `sudo apt install libc-dev-bin=2.31-0ubuntu9.7` If that doesn't work, try installing a DEB from [pkgs.org](https://www.pkgs.org), aka: https://ubuntu.pkgs.org/20.04/ubuntu-updates-main-amd64/libc-dev-bin_2.31-0ubuntu9.7_amd64.deb.html asumming you're on PC/Laptop
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.