How to fix dpkg: error: unable to make backup link of './path' before installing new version in APT
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.
Quick fix
Fixes dpkg: error: unable to make backup link of './path' before installing new version
# If error shows file path like ./usr/bin/sshd
lsattr /usr/bin/sshd
# Output with immutable flag looks like: ----i---------- Check if files have immutable attributes
- Check filesystem mount status and FAT32 /boot partition
- Fix FAT32 /boot configuration (if applicable)
- Force dpkg to reconfigure packages
# If error shows file path like ./usr/bin/sshdlsattr /usr/bin/sshd# Output with immutable flag looks like: ----i---------dpkg: error: unable to make backup link of './path' before installing new version
What this error means
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.
Typical symptoms
- apt upgrade or apt install fails with this dpkg error
- Specific error message shows file path that cannot be backed up
- Error appears when updating kernel packages or critical system binaries
- Previous upgrades worked, but new packages trigger the error
- All package manager operations fail until the underlying issue is resolved
Common causes
- FAT32 EFI partition mounted at /boot lacks hardlink support needed by dpkg
- Files have immutable attribute set with chattr +i, preventing any modification
- SELinux or AppArmor security policies denying link creation
- Read-only filesystem or partition mounted as read-only
- Filesystem corruption or special file attributes from previous operations
How to fix "dpkg: error: unable to make backup link of './path' before installing new version"
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.
Advanced notes
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.
Frequently asked questions
- What does "dpkg: error: unable to make backup link of './path' before installing" mean?
- 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. " This error specifically indicates that the filesystem cannot create the hardlink necessary for the safe upgrade process. /usr/bin/sshd or a kernel module in /boot).
- How do I fix "dpkg: error: unable to make backup link of './path' before installing"?
- 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.
- What causes "dpkg: error: unable to make backup link of './path' before installing"?
- FAT32 EFI partition mounted at /boot lacks hardlink support needed by dpkg Files have immutable attribute set with chattr +i, preventing any modification SELinux or AppArmor security policies denying link creation
- Is the "dpkg: error: unable to make backup link of './path' before installing" error serious?
- Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.
Official resources & further reading
- ๐APT Official Documentation
- ๐ฌHowtoForge: Debian/Ubuntu unable to make backup link(Stack Overflow)
- ๐ฌDebian Forums: dpkg error unable to make backup link(Stack Overflow)
- ๐