How i remove a package without leaving any trace

hi guys,

normally i remove packages with:

# pacman -Rs package_name

or

# pacman -R package_name

the problem is, i removed a package with it’s dependencies and after that i found in /etc a folder from the package(/etc/package_name/package_name.json).

it’s possible to remove packages with all files and folders.

I use

sudo pacman -Rns package_name

The n option removes the config files.

From the Archwiki:

Pacman saves important configuration files when removing certain applications and names them with the extension: .pacsave. To prevent the creation of these backup files use the -n option:

pacman -Rn *package_name*

Note: Pacman will not remove configurations that the application itself creates (for example “dotfiles” in the home folder).

1 Like

It isn’t entirely possible for pacman to do this. pacman removes the files it installs only. However, applications create files on their own and these will never be removed by pacman.

In my opinion, this option is poorly named and somewhat misunderstood. What it does is not “remove config files”. It stops the creation of .pacsave files for files in the package’s backup array.

Most packages don’t actually have anything in the backup array so this option usually does nothing.

7 Likes

hi @sradjoker thanks for fast reply,

i know this option and have try it, but it is still there.

for more background, i installed timeshift with yay.

See my explanation above.

1 Like

ok thanks for explanation.
the solution for me is to remove these files manually? damn :exploding_head:

1 Like

I remove all pacman installed packages with -Rns option, because I want to be sure it’s completely off the system, even if I plan to reinstall it at a later date.

So should I still be doing -Rns option, just in case there are unwanted configuration files?

It doesn’t hurt to use the -n option as long as you have the proper expectation for what it actually does.

2 Likes

Which is nothing in most cases, but at least I know its cleanly removed. Thanks @dalto .

1 Like

In case of browsers, you may consider deleting the cache of the browser inside the settings of the browser and then uninstalling the package.

1 Like

I’ve used -Rns countless times, but I’ve also used just -R, to see which one removes more or less. 95% of the time for me, -R removes no more, no less than -Rns, so in practice -Rns isn’t really as effective as we’d like to think it is. Still useful I suppose, but nowadays I just stick with -R when I want to remove anything.

-Rs removes the dependencies of the package. If the package has no dependencies
-R and -Rs will do the same thing. Otherwise -Rs will remove the dependencies.

  1. $ sudo pacman -R gthumb
checking dependencies...

Package (1)  Old Version  Net Change

gthumb       3.12.2-1     -12.54 MiB

Total Removed Size:  12.54 MiB

:: Do you want to remove these packages? [Y/n] n
  1. $ sudo pacman -Rs gthumb
checking dependencies...
:: gdk-pixbuf2 optionally requires libjxl: Load .jxl
:: imagemagick optionally requires libjxl: JPEG XL support
:: imlib2 optionally requires libjxl: JXL loader

Package (4)     Old Version  Net Change

gperftools      2.9.1-2       -2.83 MiB
gst-plugin-gtk  1.20.1-1      -0.06 MiB
libjxl          0.6.1-3      -16.18 MiB
gthumb          3.12.2-1     -12.54 MiB

Total Removed Size:  31.61 MiB

:: Do you want to remove these packages? [Y/n] n

With only -R all the dependencies which are not dependencies of other packages will not be removed. They will become the so called orphans.

If you use only -R to remove packages, you might want to check if there are some orphans on the system and if you want to remove them.

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.