Yay Update Single Package: Doing It Safely Without Partial Upgrades

How to update a single package with yay on Arch Linux, the difference between AUR and repository packages, and how to avoid the partial-upgrade trap.

Yay Update Single Package: Doing It Safely Without Partial Upgrades

Yayarch readers frequently want to update just one program, perhaps a browser that has a security fix or an AUR application whose new version adds a feature they need, without waiting for a full system upgrade. Yay can certainly do this, but the right method depends on where the package comes from. Updating a single AUR package is routine and safe. Updating a single repository package is where people run into trouble. This article explains the difference and gives you a reliable method for each case.

Why Arch is cautious about single updates

Arch Linux releases libraries and the programs that use them together. When a library such as OpenSSL or ICU moves to a new version, the packages that depend on it are rebuilt and published at the same time. A full upgrade keeps everything in step.

If you refresh the package databases and then upgrade only one program, that program may arrive built against a newer library than the one on your system. It may fail to start, or worse, it may upgrade the library and break other programs that still expect the old one. The Arch Wiki calls this a partial upgrade and states plainly that it is not supported.

This is why the answer to the question depends on the package's origin.

Updating a single AUR package

AUR packages are built on your machine against the libraries you already have. Rebuilding one does not upgrade anything else, so the partial-upgrade problem does not apply in the same way. To update one AUR package to the latest version on the AUR, simply install it again.

yay -S package-name

Yay compares the installed version with the AUR version, shows you the build file diff, rebuilds the package and installs it. If the package is already up to date, yay will rebuild and reinstall it anyway. To skip packages that are current, add the --needed flag.

yay -S --needed package-name

There is one caveat. If the new version of an AUR package needs a newer repository dependency than you have installed, building against your current system may fail or produce a package that misbehaves. If you see build errors mentioning version requirements, run a full upgrade first and try again.

Updating a single development package

Packages ending in -git build from the latest upstream commit. Their AUR version number often stays the same even when the code changes, so yay -S may think nothing has changed. Rebuilding it explicitly fetches the newest commit.

yay -S package-name-git

If you only want to rebuild when there really are new commits, use the development check during an upgrade instead, as described below.

Updating a single repository package

For packages from the official repositories, the safe answer is not to update them on their own at all. Run a full upgrade instead.

yay

That may feel heavy-handed when you only wanted one program, but it is the method Arch supports. If the only thing that changed since your last upgrade is that one package, the full upgrade will be quick anyway.

If you want to install a brand new repository package, do it as part of a full upgrade so that the databases and the rest of the system move together.

yay -Syu package-name

What you should avoid is the pattern yay -Sy package-name or pacman -Sy package-name, which refreshes the databases and installs one package without upgrading the rest. That is the textbook partial upgrade.

Upgrading only AUR packages

Between full upgrades, you might want every AUR package updated without touching the repositories, for instance right after you have already run sudo pacman -Syu. The --aur flag does exactly that.

yay -Sua

You can also see what is pending first.

yay -Qua

This combination is the closest thing to a safe partial update in the yay world, because AUR packages build against your current system.

Choosing packages during a full upgrade

Sometimes the reverse is true. You want a full upgrade but would like to skip one problematic package for now. Yay's upgrade menu allows this. After it lists the available upgrades, it asks which packages to exclude, accepting numbers such as 1 2 3, ranges such as 1-3, negations such as ^4 and repository names.

Yay accompanies that prompt with a clear warning that excluding packages may cause partial upgrades and break systems. Excluding an AUR application for a day or two is usually harmless. Excluding a core library or anything it depends on is not. If in doubt, upgrade everything.

Holding a package at its current version

If you need to keep one package at a specific version for longer, perhaps because a new release has a bug that affects your work, the tidy approach is pacman's IgnorePkg option. Open /etc/pacman.conf with a text editor as root and add the package name to the IgnorePkg line. Both pacman and yay will skip it and remind you each time.

Keep ignored packages to a minimum and remove the entry once the fix arrives. Holding back applications is generally fine for short periods. Holding back libraries, the kernel or core components can cause the very breakage you were trying to avoid.

Rolling back an update

If a single update goes wrong, you may want to return to the previous version. For repository packages, pacman keeps earlier versions in its cache unless you have cleaned it. You can reinstall an older file with sudo pacman -U followed by the cached package path. For AUR packages, yay's cache folder may still contain the previous build, or you can check out an earlier commit of the package's AUR git repository and rebuild it.

Downgrading has the same compatibility considerations as upgrading. Rolling back one application is usually safe. Rolling back a library rarely is.

Rebuilding after a library change

Sometimes an AUR package breaks not because it was updated but because a library it depends on was. You will see errors about a missing shared object. The fix is to rebuild that AUR package against the new library.

yay -S --rebuild package-name

The rebuild option forces a fresh build even if the version number has not changed. Some users rebuild all AUR packages after very large library transitions, but most of the time only the package that shows the error needs attention.

A practical routine

Putting this together gives a simple pattern that keeps systems healthy while still letting you act quickly when one program needs attention.

  • Run full upgrades regularly so that individual updates are rarely needed.
  • Update a single AUR package with yay -S package-name whenever you like.
  • Treat repository packages as a set and update them with yay.
  • Use the exclusion prompt and IgnorePkg sparingly and temporarily.
  • Read build file diffs for every AUR update, however small.

A worked example

Suppose you use an AUR web browser package, and its developers publish a security fix. You last ran a full upgrade two days ago. Here is a sensible way to get the fix immediately.

First, check what yay sees.

yay -Qua

The browser appears with its new version. Because it is an AUR package built against your current libraries, rebuilding it alone is safe. Run the install command for just that package, review the diff, which should show a new version number and checksums, and let yay rebuild it.

Now suppose the security fix is instead in a browser from the official repositories. In that case, the correct move is a full upgrade with yay. Because you upgraded only two days ago, few other packages will have changed, so the upgrade will be short. You get the fix without risking a partial upgrade.

Why version numbers can be misleading

Version numbers in Arch have two parts: the upstream version and the package release number after a hyphen. A change in the release number alone, for example from 1.2-1 to 1.2-2, means the package was rebuilt, often against a new library, without the software itself changing.

This matters for single updates. A repository package with a new release number may have been rebuilt precisely because a library it uses changed. Installing it on its own, without the matching library, is exactly the partial-upgrade problem. AUR packages with a new release number usually indicate a fix to the build script, which is safe to apply on its own, but worth reviewing in the diff.

Frequently asked questions

What is the command for a yay update of a single package?

For an AUR package, use yay -S package-name. For a repository package, run a full upgrade with yay, because single repository updates are partial upgrades.

Does yay -S upgrade dependencies too?

It installs any missing dependencies and may upgrade AUR dependencies that need it. For repository dependencies, it relies on your system already being up to date.

How do I stop yay rebuilding a package that is already current?

Add --needed. Yay will skip any target that is already at the latest version.

Can I update one package without reading the diff?

You can turn off the diff menu, but it is not wise. Reviewing changes is your best protection against malicious or broken build scripts.

Why does yay keep offering the same -git package?

Run yay -Y --gendb once to refresh yay's development database, then use --devel during upgrades.

Is it safe to update the kernel on its own?

No. Kernel modules and related packages are versioned together, so update the kernel as part of a full upgrade.

Can I update a single package from a specific repository?

Pacman lets you prefix a package with its repository name, but the partial-upgrade rule still applies. For repository packages, a full upgrade remains the supported approach.

What happens if I cancel a single-package rebuild?

Cancelling during the build leaves your installed version untouched. Cancelling during installation can leave a lock file, so check no package tool is running before retrying.

Does yay -S on a repository package refresh the database?

No. Without -y, yay installs from the databases you already have. If those are old, you may install an outdated version, which is another reason to upgrade fully first.

How do I see the changes in a new AUR version before updating?

Yay shows a diff of the build files during the update. You can also print the current PKGBUILD with yay -Gp package-name and compare.

Conclusion

A yay update of a single package is safe and simple when the package comes from the AUR: run yay -S package-name and review the diff. For repository packages, the reliable answer is a full yay upgrade, because Arch's libraries move together and partial upgrades are unsupported. Combine those two rules with occasional use of -Sua, a light touch with exclusions and IgnorePkg, and you will be able to update exactly what you need without ever leaving your system half-upgraded.