The reason for not running pacman -Sy
is to avoid installing packages from different package database updates.
Example: It's 5 days later when you've forgotten you ran pacman -Sy
and run pacman -S nvidia
that you're likely to break something
source The bash script checkupdates, included with the pacman-contrib package, provides a safe way to check for upgrades to installed packages without running a system update at the same time.
see: System maintenance
checkupdates
provides a way to do this without requiring root or messing up your /var/lib/pacman database.
Here's a minimal version of checkupdates
:
TMPPATH="${TMPDIR:-/tmp}/checkup-db-${USER}"
DBPATH="$(pacman-conf DBPath)"
mkdir -p "$TMPPATH"
ln -s "$DBPATH/local" "$TMPPATH" &>/dev/null
fakeroot -- pacman -Sy --dbpath "$TMPPATH" --logfile /dev/null &>/dev/null
pacman -Qu --dbpath "$TMPPATH" 2>/dev/null
It works by:
- Creating a temporary folder for your database.
- Symlinking your
/var/lib/pacman/local
. - Running
pacman -Sy
on your temporary folder. - Querying via
pacman -Qu
on your temporary folder.