Does "zypper remove" command remove user configuration files like "apt purge"?

I tried searching in the official openSUSE docs website](https://doc.opensuse.org/documentation/leap/reference/html/book-reference/cha-sw-cl.html#sec-zypper-softman), but I didn’t find any info whether

sudo zypper remove PACKAGE_NAME

will remove user configuration files like what “apt purge” does](https://manpages.ubuntu.com/manpages/jammy/en/man8/apt.8.html#:~:text=Removing%20a%20package,your%20home%20directory.).

However, I found **this Reddit answer **saying that “zypper remove” behaves like **“apt purge” **Is this correct, and why wouldn’t it officially document anywhere?

Thanks in advance.

man zypper: “… The remove command will uninstall the selected and their dependent packages. …”

To me this means that zypper remove will remove all files which were part of the package(s) and it will not remove anything else (e.g. files, which the package(s) created while it/they were installed because those were not part of the package(s))

So the command does exactly what the manual says. Why should the openSUSE documentation compare zypper remove with apt purge (or any other package managing tool)? This would not be very helpful to me because I do know nothing about apt.

Regards

susejunky

RPM does not have notion of separate steps “remove” and “purge” like DPKG. RPM package removal removes all files listed as part of package. RPM leaves a copy of modified configuration file with .rpmsave suffix, but once package was removed these files are outside of RPM management and need to be removed manually.

If file is not listed as part of package, nether RPM (zypper) nor DPKG (apt) will touch it, unless package includes scripts to explicitly clean up such files.

I don’t care what apt does but I definitely want to remove all unneeded packages including their dependencies. I use:

zypper packages --unneeded | grep ^i|cut -d '|' -f3|xargs zypper rm --clean-deps

See also: What is zypper equivalent of ‘apt autoremove’?

https://www.reddit.com/r/openSUSE/comments/i57ld8/what_is_zypper_equivalent_of_apt_autoremove/

@karlmistelberger.

Both answers are not what the OP asked for and thus off-topic and to create confusion.

I use “sudo rpmconf -a” (from rpmconf package) to remove such leftovers, I believe this is what OP is looking for. It’s an interactive tool, also helps to deal with configuration conflicts from package updates.

Wow, thanks a lot. This is what I was looking for. Thanks.

Note to all users. I didn’t want to compare zypper and apt. I just wanted to know how to remove/clear user configuration files of any package like what “apt purge” does, but on openSUSE, not to remove unused packages which would belong to “apt autoremove”.

Well, as many here I do not know what those apt commands are supposed to do (and no, we, at least I, are not going to study apt documentation for this lone case), thus saying things like “I want some thing that works like apt-xxx” will not help much. You must define/describe what exactly the effect should be and then we may hope that people here will offer you some (combination of) command(s) that do what you describe.

That said, are you sure that your apt command will visit the home directories of all users on a system and remove there files it assumes to belong to a certain software package?

As user, I would be very upset if my system manager would execute things like that and meddle with data I have in my own space, my home directory. >:(

I do not know exactly what the rpm command advised by @awerlang does, but what he describes seems to come very near to what you want. But I doubt it will change things in users’ home directories. It will probably at the most handle system configuration files.

For your information: *(https://itsfoss.com/apt-vs-apt-get-difference/).

For details of a recommended way of removal see this example “How to cleanly remove a package from a Debian-based distribution” by Jack Wallen: “When you uninstall an application from Linux, make sure you’re doing it in such a way as to remove both configuration files and dependencies.” What are those two commands? Let me demonstrate

Cleanly removing packages with zypper generally requires running both “zypper remove --clean-deps PACKAGE” and “zypper packages --unneeded | grep ^i|cut -d ‘|’ -f3|xargs zypper rm --clean-deps”.*

I didn’t want you or anyone here to study apt commands. That’s why in my thread’s title, I described my question pretty clear regarding the removal of user configuration files of “zypper remove” that I wanted to know. If zypper does that, then yes, if not, then thanks for the other tools that anyone here recommended to be used in place of “apt purge”.

AFAIK, there’s no package manager that would delete user configuration files in home directory. Even “apt purge” doesn’t do that. rpmconf doesn’t do that also.

Now I know that “zypper remove” doesn’t remove user configuration files like “apt purge”, and I have to use rpmconf for that. Thanks.

I now do not understand what you say;

  • first you say that you want “user configuration files to be removed”;
  • then you say there is no package manager that would delete user configuration files.

IMO that is contradictory. Sorry.

No, I didn’t say there is no package manager that would delete user configuration files. I said “…there’s no package manager that would delete user configuration files in home directory.

User configuration files doesn’t have to be in the home directory, it can be in the system directory (configurations of the app that’s set by one user for all the users).

Here’s the confusion. User configuration files lie under a single user’s home directory. Configuration under system directories (/etc) are usually called *local administrator *configuration.

Examples:

  • /usr/etc/
    : distribution-specific configuration - /etc/
    : local administrator configuration - /home/$USER/
    : user configuration

Thanks for the explanation.

However, on Ubuntu Manpage, they also called the configuration files in the system directories as user configuration files, so I followed the suite.

“zypper remove” actually does remove configuration files owned by the package to be removed. However zypper keeps configuration files modified after installation. Example:

**erlangen:~ #** rpm -V fetchmail 
......G..  c /etc/fetchmailrc 
**erlangen:~ #**

/etc/fetchmailrc is owned by fetchmail. “zypper remove fetchmail” will preserve the file as it has been modified.

rpmconf does something different than apt purge even if end result may be used for your intended purpose. This and …

… returns us to

Oh, and …

Of course it does, you have been told so. Why are you asking questions if you ignore answers that do not suite you?

Those are NOT user configuration files. They are system configuration files. And yes, system configuration files of a program (often in /etc) are valid system wide to the program and thus are valid for all users that use the program (if it is a program to be used by users), but they are still not user configuration files to be manager by the user.

It seems that you use “user configuration files” in a different way then most people do. I wonder what in your opion are then “system configuration files”.