This error occurs when dpkg cannot create backup copies of files before updating packages, typically due to filesystem limitations or file attribute restrictions. It usually affects /boot with FAT32 EFI partitions or files with immutable flags set.
When dpkg upgrades a package, it follows a strict safety procedure: create a hardlink backup of the old file, then replace the original with the new version. If the hardlink fails, dpkg stops and reports "unable to make backup link." This error specifically indicates that the filesystem cannot create the hardlink necessary for the safe upgrade process. The error message shows the file path that failed (e.g., ./usr/bin/sshd or a kernel module in /boot). Common scenarios: FAT32 EFI partitions don't support hardlinks at all, immutable file attributes (set with chattr +i) prevent any modifications, SELinux policies may deny link creation, or other filesystem restrictions block the operation.
Use lsattr to check for the immutable flag on the problematic file:
# If error shows file path like ./usr/bin/sshd
lsattr /usr/bin/sshd
# Output with immutable flag looks like: ----i---------If you see an 'i' in the output, the file has the immutable flag. Remove it:
sudo chattr -i /usr/bin/sshdTry the upgrade again. This resolves the issue in most cases.
List your mounted filesystems to check for /boot on FAT32:
mount | grep -E '(^/dev|/boot)'If /boot shows 'vfat' (FAT32), dpkg cannot create hardlinks. Check if a /boot/efi directory exists:
ls -ld /boot/efiModern Debian/Ubuntu systems should have /boot/efi for EFI partition mounting, with actual boot files in /boot (on ext4/btrfs). If /boot itself is mounted on FAT32, this is the root cause.
If /boot is FAT32, you need to reorganize: mount the FAT32 EFI partition at /boot/efi instead.
# Check current fstab
cat /etc/fstab
# Look for the FAT32 partition UUID/path currently at /boot
# You may need to:
# 1. Create /boot/efi directory
# 2. Move contents from /boot to /boot/efi
# 3. Update /etc/fstab to mount EFI partition at /boot/efi
# 4. Create a regular /boot directory on the main filesystemThis is a complex operation. Document the current fstab, then carefully update mount points. After changes:
sudo update-grub
sudo update-initramfs -uThis permanent fix allows dpkg to operate safely on /boot files.
If no immutable attributes or FAT32 issues, try reconfiguring dpkg:
# Stop package managers
sudo systemctl stop apt-daily-upgrade.service apt-daily.service
# Reconfigure packages
sudo dpkg --configure -a
# Try upgrade again
sudo apt update && sudo apt upgradeThis completes any interrupted package installations.
If you're on a system with SELinux or AppArmor:
# Check SELinux status
getenforce
# Check AppArmor status
sudo systemctl status apparmorIf either is enabled and you suspect they're blocking operations:
# For SELinux, check audit logs
sudo grep dpkg /var/log/audit/audit.log
# For AppArmor, check logs
sudo grep dpkg /var/log/syslogSecurity policies are rarely the culprit, but worth checking if other steps fail.
This error reveals fundamental dpkg safety mechanisms. dpkg creates hardlinks (not copies) for performance and atomicity: if the system crashes mid-upgrade, it can restore from the hardlink without data loss. This is why it's non-negotiable.
FAT32 partitions predate Linux and don't support advanced filesystem features like hardlinks. Modern systems using UEFI firmware should use /boot/efi (FAT32, small) for EFI binaries and /boot (ext4, larger) for kernel images. If your system has /boot on FAT32, you have an unusual configuration that should be reorganized.
Immutable attributes (chattr +i) exist for system protection in some setups, but they block routine updates. If you set them yourself, remove them. If they exist mysteriously, check for rootkits or file integrity monitoring systems.
For most users: check for immutable attributes first (fastest), then examine /boot. FAT32 /boot is the second most common cause.
dpkg: 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