Skip to content

Instantly share code, notes, and snippets.

@felipealfonsog
Last active March 30, 2024 04:59
Show Gist options
  • Save felipealfonsog/d8e73b71c0cced15eeff474e2285934d to your computer and use it in GitHub Desktop.
Save felipealfonsog/d8e73b71c0cced15eeff474e2285934d to your computer and use it in GitHub Desktop.
Script to fix invalid PGP fail and transaction fail issue in Arch Linux
#!/bin/bash
# Script to fix invalid PGP fail and transaction fail issue in Arch Linux
# Computer Science Engineer: Felipe Alfonso González
# Github: https://github.com/felipealfonsog
# Email: [email protected]
# BSD 3-Clause License
echo "Welcome to the Arch Linux PGP key reset script!"
echo "This script will reset all pacman keys to solve the problem."
read -p "Are you sure you want to proceed? (y/n): " choice
if [[ $choice =~ ^[Yy]$ ]]; then
echo "Deleting GPG files..."
sudo rm -rf /etc/pacman.d/gnupg
echo "Initializing and populating pacman keys..."
sudo pacman-key --init && sudo pacman-key --populate
echo "Refreshing keys..."
sudo pacman-key --refresh-keys
echo "PGP keyring has been reset successfully!"
echo "You can now proceed with upgrades as normal."
else
echo "Operation canceled. Exiting..."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment