Quantcast
Viewing latest article 2
Browse Latest Browse All 5

Answer by Theodore R. Smith for Pacman: error: duplicated database entry

I tried @Schooled and @maulinglawns answers but both basically bricked my system.

The reason is that source was running linux-5.4.71 and dest was running linux-5.4.72, released just a day apart.

When rsync --delete ran, it deleted all of the kernel modules on dest/lib/5.4.72/, which basically led to a bricked system that was incapable of mounting critical file systems, among other things.

After restoring from my btrfs snapshot (thank God!!), I figured out the following solution:

# From https://github.com/hopeseekr/BashScripts/blob/master/arch-pacman-dupe-cleaner# Copyright © 2020 Theodore R. Smith <theodore@phpexperts.pro># GPG: 4BF8 2613 1C34 87AC D28F  2AD8 EB24 A91D D612 5690# License: Creative Commons Attribution v4.0 International# @see https://unix.stackexchange.com/a/615578/15780# 0. Login as root.sudo -s# 1. Remove the latest dupes from your Pacman DB.pacman -Syu 2>&1 | grep "duplicated database entry" > /tmp/dupesfor latest in $(for dupe in $(cat /tmp/dupes | awk '{print $5}'); do    ls /var/lib/pacman/local/$dupe* -d | tail -n1; done); do    rm -rvf $latest;donerm /tmp/dupes# 2. Remove system of dupe files.pacman -Syu 2>&1 > /tmp/update-dupescat /tmp/update-dupes | grep "exists in file system" | awk '{print $2}' | xargs rm -vf# 3. Reinstall everything (this will restore anything deleted in #2.).pacman -Syu

Since this is quite a lot, I have added it to my BashScripts repository as arch-pacman-dupe-cleaner.


Viewing latest article 2
Browse Latest Browse All 5

Trending Articles