I’ve tried lots of suggestions to fix this, but it is very persistent.
Ubuntu Version:
Ubuntu 22.04 LTS
Desktop Environment (if applicable):
using bash
Problem Description:
When I try to update or upgrade my system, I get:
"
dpkg-divert: error: cannot divert directories
Use --help for help about diverting files.
dpkg: error processing archive /var/cache/apt/archives/libc6_2.39-0ubuntu8_amd64.deb (–unpack):
new libc6:amd64 package pre-installation script subprocess returned error exit status 2
"
Relevant System Information:
Distributor ID:
Ubuntu
Description:
Ubuntu 22.04 LTS
Release:
22.04
Codename:
jammy
Screenshots or Error Messages:
Preparing to unpack .../libc6_2.39-0ubuntu8_amd64.deb ...
Checking for services that may need to be restarted...
Checking init scripts...
Checking for services that may need to be restarted...
Checking init scripts...
Stopping some services possibly affected by the upgrade (will be restarted later):
dpkg-divert: error: cannot divert directories
Use --help for help about diverting files.
dpkg: error processing archive /var/cache/apt/archives/libc6_2.39-0ubuntu8_amd64.deb (--unpack):
new libc6:amd64 package pre-installation script subprocess returned error exit status 2
Errors were encountered while processing:
/var/cache/apt/archives/libc6_2.39-0ubuntu8_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
This is not the 22.04 version of libc but the 24.04 one, how did you get into that situation, did you mess up your sources.list files by adding noble anywhere ?
Repos:
Active apt repos in: /etc/apt/sources.list
1: deb http://cz.archive.ubuntu.com/ubuntu/ noble main universe
No active apt repos in: /etc/apt/sources.list.d/alessandro-strada-ubuntu-ppa-yakkety.list
No active apt repos in: /etc/apt/sources.list.d/digitalocean-agent.list
Active apt repos in: /etc/apt/sources.list.d/droplet-agent.list
1: deb [signed-by=/usr/share/keyrings/droplet-agent-keyring.gpg] https://repos-droplet.digitalocean.com/apt/droplet-agent main main
No active apt repos in: /etc/apt/sources.list.d/megasync.list
No active apt repos in: /etc/apt/sources.list.d/ondrej-ubuntu-php-artful.list
No active apt repos in: /etc/apt/sources.list.d/ondrej-ubuntu-php-disco.list
No active apt repos in: /etc/apt/sources.list.d/ondrej-ubuntu-php-eoan.list
Active apt repos in: /etc/apt/sources.list.d/ookla_speedtest-cli.list
1: deb [signed-by=/etc/apt/keyrings/ookla_speedtest-cli-archive-keyring.gpg] https://packagecloud.io/ookla/speedtest-cli/ubuntu/ jammy main
2: deb-src [signed-by=/etc/apt/keyrings/ookla_speedtest-cli-archive-keyring.gpg] https://packagecloud.io/ookla/speedtest-cli/ubuntu/ jammy main
No active apt repos in: /etc/apt/sources.list.d/ubuntustudio-ppa-ubuntu-backports-eoan.list
I got into this mess, some months ago, when I tried to update my system to noble, but it failed somehow. I was trying to upgrade to 24.04, and I’d still like to do that, but I end up with this error when I do.