Last active
November 7, 2023 15:05
-
-
Save PsychedelicShayna/6751158f6c2675a5b83a46f1bfe2e2c8 to your computer and use it in GitHub Desktop.
Fixes pacman GPG problems (e.g: "no pulic key") by rebuilding /etc/pacman.d/gnupg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
## Sometimes pacman enters a corrupted state where it cannot | |
## download any packages due to no public key being present | |
## to self-sign the archlinux certificates. | |
## | |
## This script fixes and reconstructs /etc/.pacman.d/gnugp | |
## Tested exclusively on Arco Linux; the results may be | |
## unpredictable on a non-Arco/Arch distro, e.g. | |
## Endeavor, Manjaro, etc.. | |
## | |
## On Arco you're fine though. | |
echo "You should be running this script as root." | |
sudo echo "Fixing..." | |
sudo rm -r /etc/pacman.d/gnupg | |
sudo pacman-key --init | |
sudo pacman-key --populate archlinux | |
sudo pacman-key -S archlinux-keyring | |
sudo pacman -S archlinux-keyring | |
sudo pacman -Sy | |
echo "THIS IS ENTIRELY OPTIONAL" | |
echo "If you want Pacman even fresher, you can clear your cache and unused repositories." | |
echo "Feel free to say no; this is not crucial, but it may help." | |
sudo pacman -Scc | |
echo "Running pacman-key --refresh-keys may take a little while." | |
echo "Have patience, don't interrupt the process." | |
sudo pacman-key --refresh-keys |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment