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)
What I’ve Tried:
‘’’
sudo apt --fix-broken install
sudo apt --fix-broken install
sudo apt-get update && sudo apt-get upgrade
sudo dpkg --configure -a
sudo apt install --reinstall libtirpc3 libc-bin libc6 libtirpc3t6
sudo apt-get dist-upgrade
sudo for file in $(LANG=C dpkg-divert --list | grep -oP ‘(?<=local diversion of )[^\s]+’); do dpkg-divert --local --no-rename --remove “${file}” || : ; divert_to="/tmp/$(echo “${file}” | sed 's|/||g’)" ; dpkg-divert --add --local --no-rename --divert “${_divert_to}” “${file}” || : ; done
sudo apt-get autoclean
sudo apt-get clean
sudo dpkg-divert --rename /usr/include/linux
sudo apt install build-essential
sudo apt install libc6_2.39-0ubuntu8_amd64.deb
‘’’