====== Purging i386 packages from an amd64 (64-bit) System & reinstall all packages ====== // Generate list of all installed packages // dpkg --get-selections > installed.txt // Deinstall all i386 packages // grep ':i386' < installed.txt.old |cut -d: -f1 | cut -f1 | xargs -n1 apt-get remove // Remove i386 architecture from DPKG Database // dpkg --remove-architecture i386 // Download all needed packages and check for install candidates // apt-get -f -o Dpkg::Options::="--force-overwrite" install --reinstall $(cut -f1 < installed.txt |grep -v ':i386') // Reinstall all but i386 packages // grep -v ':i386' < installed.txt.old | cut -d: -f1 | cut -f1 | xargs -n1 apt-get -f -o Dpkg::Options::="--force-overwrite" install --reinstall // Alternatively you can reinstall all packages if no i386 packages are installed. This is good for those that are just wanting to get the box back in shape after disaster has struck. // cut -d: -f1 < installed.txt | cut -f1 | xargs -n1 apt-get -f -o Dpkg::Options::="--force-overwrite" install --reinstall