For some reason removing some packages I just installed ruined my system

Whilst I was able to revert back, something ruined my system.

I installed these packages dnsmasq iptables-nft bridge-utils dmidecode and when I uninstalled it using:

sudo pikaur -Rcs dnsmasq iptables-nft bridge-utils dmidecode

Then I got some error it said failed to execute something and then I wasn’t able to open up applications and after a force restart I wasn’t able to boot into EndeavourOS. I did manage to recover some stuff via timeshift with live ISO but I wanted to know why would uninstalling these packages ruin my system even though I just installed it?

The -c option can be dangerous if you do not pay attention to the list of packages that are proposed to be removed.

man pacman:

-c, --cascade

Remove all target packages, as well as all packages that depend on one or more target packages. This operation is recursive and must be used with care, since it can remove many potentially needed packages.

Arch wiki:

To remove a package, its dependencies and all the packages that depend on the target package:

# pacman -Rsc *package_name*

Warning: This operation is recursive, and must be used with care since it can remove many potentially needed packages.

2 Likes

I do not know the pikaur tool but the arch wiki says about the command “pacman -Rcs”:

Warning: This operation is recursive, and must be used with care since it can remove many potentially needed packages

https://wiki.archlinux.org/title/pacman#Removing_packages

Your best bet is to look into /var/log/pacman.log which packages have been removed and reinstall them.

1 Like

So when I uninstall packages, what is the recommended typical recommended flags?

I typically just use -R, or -Rns.

man pacman will give you a list of all options, and what they do.

1 Like

-R

Thats it. Every once in while you can check for orphan packages and remove them too.

1 Like

A highly divisive topic.

I recommend using -Rc when removing packages.

The issue is that you combined -Rc with -Rs. -Rs is recursive downward and will even will include optional dependencies. When you combine that with -Rc which is recursive in the opposite direction that can create a mess.

Of course, the real issue here is not which options to pacman you chose to use. It is that whenever you perform any package operation, you need to carefully review the list of changes to ensure that is what you want to happen.