This error occurs when apt's package cache becomes corrupted, typically due to interrupted updates or version mismatches between 32-bit and 64-bit libc6 packages. It prevents installing any software even though the system otherwise functions normally.
The "E: Internal Error, No file name for libc6" error indicates that apt's internal package database has lost track of file metadata for the libc6 package (the core C library used by all Linux programs). This critical error prevents any package operations until resolved. This typically happens in multi-architecture systems (amd64 and i386) where the 32-bit and 64-bit versions of libc6 become desynchronized during updates. The package database can also become corrupted if: - An update was interrupted by power loss, crash, or manual termination - Disk space ran out during package installation - Manual dpkg operations went wrong - Repository metadata became inconsistent Since libc6 is essential to the entire system, apt refuses to continue until this is fixed.
Start with the simplest fixes. Clean the cache and rebuild the package list:
sudo apt-get clean
sudo apt-get update
sudo apt-get install -fIf this works, the issue was minor cache corruption. If it fails with the same error, proceed to the next steps.
If basic fixes fail, try moving and recreating the dpkg info directory:
sudo mv /var/lib/dpkg/info /var/lib/dpkg/info_old
sudo mkdir /var/lib/dpkg/info
sudo apt-get update
sudo apt-get install -fThis downloads fresh metadata for all installed packages. If successful, clean up:
sudo rm -rf /var/lib/dpkg/info_oldIf the install fails again, proceed to the next step.
If you have both amd64 and i386 packages installed, they may have version mismatches. Try removing the problematic architecture:
# Check if you have both architectures
dpkg -l | grep libc6
# If you only need amd64, remove i386
sudo dpkg --force-all -P libc6:i386
# Then try to fix
sudo apt-get update
sudo apt-get install -fIf you need both architectures, try:
sudo dpkg --configure -a
sudo apt-get install -f --no-install-recommendsAs a last resort before manual intervention, edit the libc6 postinstall script to be more forgiving:
# For amd64
sudo sed -i '1s/set -e/set +e/' /var/lib/dpkg/info/libc6:amd64.postinst
# For i386 if applicable
sudo sed -i '1s/set -e/set +e/' /var/lib/dpkg/info/libc6:i386.postinst
# Try the fix again
sudo apt-get install -fThis allows the postinstall script to continue even if errors occur. Restore it afterward:
sudo sed -i '1s/set +e/set -e/' /var/lib/dpkg/info/libc6:amd64.postinstIf automatic fixes fail, download and install libc6 manually:
# Find your distribution version
lsb_release -cs # or cat /etc/os-release
# Download matching libc6 package from packages.ubuntu.com or packages.debian.org
# For Ubuntu 22.04 example:
wget http://archive.ubuntu.com/ubuntu/pool/main/g/glibc/libc6_2.35-0ubuntu3_amd64.deb
# Install with --force-all to bypass dependency checks
sudo dpkg --force-all -i libc6_2.35-0ubuntu3_amd64.deb
# Then fix remaining issues
sudo apt-get install -fVerify the version matches your system version before installing.
As a nuclear option, completely rebuild the package database (only if other steps fail):
# Backup current state
sudo cp -r /var/lib/dpkg /var/lib/dpkg_backup
# Remove lists and rebuild
sudo rm -rf /var/lib/apt/lists/*
sudo mkdir -p /var/lib/apt/lists/partial
sudo apt-get clean
sudo apt-get update
# If still broken, try configuring all packages
sudo dpkg --configure -a
# Then attempt fix
sudo apt-get install -fIf this succeeds, you've recovered. If not, you may need to use the backup or perform a distribution upgrade.
Multi-architecture considerations: Systems with both amd64 and i386 packages are more prone to this issue. You can check your architecture status with:
dpkg --print-foreign-architecturesIf you don't actively need 32-bit packages, removing the i386 architecture eliminates a major class of version mismatch issues.
WSL-specific note: On Windows Subsystem for Linux, this error sometimes occurs during distribution upgrades. If apt-get install -f hangs while "Setting up libc6:amd64", you may need to disable initctl with:
sudo mv /usr/sbin/telinit /usr/sbin/telinit.bak
sudo ln -s /usr/bin/true /usr/sbin/telinitdpkg database corruption: If the dpkg status file itself is corrupted, you can reset it:
# Backup first
sudo cp /var/lib/dpkg/status /var/lib/dpkg/status.backup
# Rebuild from installed packages
sudo dpkg --clear-avail
sudo apt-get updateDisk space: Always ensure adequate free space before attempting repairs:
df -h /var/lib/apt/If /var is nearly full, remove old cache files:
sudo rm -rf /var/cache/apt/archives/*
sudo apt-get autocleandpkg: serious warning: files list file for package 'package-name' contains empty filename
How to fix "files list file contains empty filename" in APT
E: Sub-process /usr/bin/dpkg returned an error code (2)
How to fix "Sub-process /usr/bin/dpkg returned an error code (2)" in APT
dpkg-divert: error: rename involves overwriting 'path' with different file
How to fix dpkg-divert rename conflicts in APT
E: Sub-process /usr/bin/dpkg returned an error code (1) during kernel installation
How to fix "dpkg returned an error code (1)" in APT kernel installation
dpkg: dependency problems prevent configuration of triggers
dpkg: dependency problems prevent configuration of triggers in apt