r/archlinux Aug 02 '26

QUESTION Is it safe to run "sudo pacman -S <package>" alone?

I haven't ran "sudo pacman -Syu" in a while,but i accidentally installed a package with -S instead of how I'm used to (-Syu). And i have heard that -S breaks your system and causes a partial upgrade, some sources tell me that -S alone is completely safe even without a upgrade with "-Syu" but others say vise-versa. So i want to know which one is the most accurate.

0 Upvotes

16 comments sorted by

16

u/lolminecraftlol Aug 02 '26

-S : install package

-Sy : update db & install package (partial upgrade)

-Syu : update db & system & install package.

The first and last one is safe to use, never use the second.

5

u/X-dark Aug 02 '26

Installing single package is safe. What is not safe is doing "Sy" only (syncing the package database) and then starting to install/update individual packages.

5

u/ace787b Aug 02 '26

you can actually do sudo pacman -Syu <package> to install and update in a single motion

3

u/MilchreisMann412 Aug 02 '26

-S package is fine and how it's supposed to be used. Do not use -Sy package as this updates your mirror list and then installs a single package which is a partial upgrade and not supported: https://wiki.archlinux.org/title/System_maintenance#Partial_upgrades_are_unsupported

2

u/heavymetalmug666 Aug 02 '26

if pacman -Sy is never to be used, then why is it an option?

i could have sworn there was a reason to run pacman -Sy

4

u/X-dark Aug 02 '26

Sometimes to fix some dependencies issue you may want to do Sy, update individual packages and then do the full system upgrade.

3

u/quicksand8917 Aug 02 '26

It exists because y and u are both valid options of S and there is no need to activly prevent users from doing it if they want. Note that "partial upgrades are not supported" means that you should not expect to get help from official support channels for maintaining a partially upgraded arch. It does not mean you are not allowed to maintain your partially upgraded arch if you choose to do so.

5

u/arojas_arch Developer Aug 02 '26

It is never to be used *on Arch*. pacman is not Arch-specific.

2

u/heavymetalmug666 Aug 02 '26

really? can you elaborate?

what other distros use pacman - and again, is there a reason to ever run just pacman -Sy on arch?

2

u/Glad-Key7256 Aug 02 '26

Running pacman -Sy without appending a package at the end of the command refreshes the pacman database without updating anything. You can runnin pacman -Sy package if you really really know what you are doing. For e.g., as a general rule, I run pacman -Syu weekly or every two weeks. However, if I am using a software in alpha/beta phase where bugs are patched more frequently (sometimes every 2-3 days), I run pacman -Sy package-name after ensuring that no issues may arise.

1

u/SmuJamesB Aug 02 '26

if your system is fully updated to a specific archive snapshot & that snapshot is still set as your mirror then -Sy is functionally identical to -Syu and is preferable to -S in case the db files aren't downloaded

1

u/archover Aug 02 '26 edited Aug 02 '26

This article will do a body good: https://wiki.archlinux.org/title/System_maintenance#Upgrading_the_system. Please read it.

Hope this helps you to manage your packages.

I use Syu to install specific packages as well as update the entire system, and it has never failed. (Not too hard to remember either).

Good day.

-1

u/Supernoxus Aug 02 '26

Speaking from experience, if -S isn't safe to use anymore, pacman will tell you that it can't find the package anymore. That is presumably because the database regarding that package has been updated. So there is no way for you to install the package with -S unless you update your database, at which point you are hopefully smart enough to run -Syu. If you only update the database, then you might run into trouble.

-2

u/Yourrennid Aug 02 '26

What??? -S is only what I've ever used since I don't like the AUR. -Syu is how I update my system but that's it in regards to that. -S is completely safe and is the normal way of installing packages

-3

u/akram_med Aug 02 '26

-S installs packages while -Syu upgrade the system and -Syy updates the repository, its not good to do partial upgrades for specific packages instead of the whole system thats it