You are not logged in.
Is there a way to remove all the files and folders associated with package when I remove a package?
Meaning specific folders which are created for it and the config files created at various locations.
I would like to revert my system back to the state in which it was before the package was installed.
Does anyone know of any script which can do this?
Thanks,
Acer Aspire V5-573P Antergos KDE
Offline
# pacman -Rsn installed_package
removes the configuration files installed with pacman.
The configuration files you have created must be removed manually.
Offline
would it also remove folders created in /etc/, /usr etc? I mean the issue is to remove all the unwanted folders created during package installation
Acer Aspire V5-573P Antergos KDE
Offline
yes I verified it doesnt remove the folder if the conf file inside is changed
Acer Aspire V5-573P Antergos KDE
Offline
When you remove all packages you don't like you can then later run a script to find files that are not known by pacman (-Ql). This includes user created files but also leftovers from previous installed packages. Skim that list and remove the junk... done...
There have been several threads about this, here is a link to a working script:
http://archlinux.spider007.net/pacman-f … unowned.sh
Offline
lilbenden is it safe to remove files listed by pacman -Ql ? Wouldnt it be good to prompt the user if he wants the system to be cleaned when he is removing the package? I mean config files in Home directory makes sense but why leave files in the file system?
Acer Aspire V5-573P Antergos KDE
Offline
pacman -Ql gives me a shit load of files, are they safe to be deleted?
Acer Aspire V5-573P Antergos KDE
Offline
NO! pacman -Ql lists all installed files!
The link provides a script to determine which files are NOT in that list. Files that are not in the pacman -Ql list can only be created by the user, or through .install files or configs etc. Sometimes there's leftovers from a unsucceeded install, or removal. Also there are a lot of fonts listed (ms-fonts) cause they can only be used following certain rules.
It is never safe to simply remove files listed by the script, but some files are easily recognizable so you can decide to remove or keep them.
If you're in doubt about some files post your list (from that script) up here.
Last edited by ibendiben (2008-07-01 19:39:11)
Offline
Thanks for the script. IT would be cool to see something similar integrated into pacman.
Offline
Yes I am still wondering if someone can explain to why it is a necessity to leave junk behind, I mean keep the configs in the home folder, if it is done in the system folders then atleast there should be an option to get rid of it.
Maybe i dont know something which the experts know
Thanks for the script, I will post my list here.
Last edited by venky80 (2008-07-01 21:04:51)
Acer Aspire V5-573P Antergos KDE
Offline
vote for my feature request:
http://bugs.archlinux.org/task/10799
It's actually not really pacman's fault most of the time. The files are created after installation, or in a separated .install script. If packages and packagers keep to the standards there shouldn't be any leftovers, even in those special cases you can use .remove script for that, runned by pacman -R... also be sure you don't make any mistakes.
Sometimes packages are broken do tue whatever reason. In this case you can force a reinstall after which you can remove it completely...
Anyway you can do a reading through some of the topics I collected in the feature request. You'll find some more answers there.
Offline
Why has no one voted for it? So there is yet no way to safely get a list and delete files to remove useless stuff?
Acer Aspire V5-573P Antergos KDE
Offline
Listen.
First remove all packages you don't want anymore.
Read man pacman:
REMOVE OPTIONS
-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.-k, --keep
Removes the database entry only. Leaves all files in place.-n, --nosave
Instructs pacman to ignore file backup designations. Normally, when
a file is removed from the system the database is checked to see if
the file should be renamed with a ".pacsave" extension.-s, --recursive
Remove each target specified including all of their dependencies,
provided that (A) they are not required by other packages; and (B)
they were not explicitly installed by the user. This operation is
recursive and analogous to a backwards --sync operation, and helps
keep a clean system without orphans.
For you to use:
pacman -Rns listofpackagesyouwantgone
After you have done this. You can have a look at the sanity of your system (according to junk files).
Run the script provided above. It will look for packages in all specified folders that are not in the list of files belonging to installed packages. Choose which folders you want to include in this search. Well check the options of the script...
Then you have an overview of files that might be useless. Hopefully this list isn't too big. It shouldn't be. As I said before, if you remember any pacman crashes or wrong installs/removals, there are some files expected. Else it should only be a list of some fonts, some java stuff and maybe more (don't remember)... but those files aren't useless. They are not created in a standard way, so pacman is unable to list them, that's all. Reasons for this I told you earlier.
Now I'm curious how big your list is going to be... so if you're done show it to us. I don't garantee I can be of any help. Soon I'll be on vacation too... but there are others which will be willing to help you determine whether files are sane or junky...
Go on now!
Last edited by ibendiben (2008-07-01 22:41:57)
Offline
The list was so huge I had to use pastebin
http://pastebin.ca/1060194
I have a shit load of crap in my system.
Thanks for the explanation Ibendiben
Last edited by venky80 (2008-07-02 04:26:31)
Acer Aspire V5-573P Antergos KDE
Offline
I made the list have shorter, you posted it double. You posted owned but not found too. This means you didn't include certain folders you should have included. Can you provide which folders you included? Or did you use the defaults?
Here is what I found till now:
All .pacsave and .pacnew files can be removed. These are backups of important config files pacman makes during installation/removal. If you are sure you don't need those anymore it's safe to remove them.
There are a lot of shared-mime-info (broken?) files. Check if they are owned with pacman -Qo. If they aren't you should force a reinstall of the package with pacman -Sf shared-mime-info. I could be wrong but it seems that package is broken.
Further I found files belonging to:
virtualbox
bluetooth
You should check those...
This folder is a huge one too:
/etc/ssl/certs ???????
I couldn't find where it belonged too. Some ssl application... I don't know, so try to find out by yourself.
If you're done you can post the updated list.
My update of your pastebin (without pacsave/pacnew, and without the owned but not found):
http://pastebin.ca/1060353
Last edited by ibendiben (2008-07-02 09:28:10)
Offline
All .pacsave and .pacnew files can be removed.
pacnew files should be merged first. In fact, it is best to do that as they are created...
Offline
i always uninstall packages using "pacman -Rncs package" and i got still a bunch of leftover files in my directories
it's important to check the installed packages if they're corrupted after deleting the "unowned" files. use pacworld from the aur or the french repo.
Offline
@Allan: YES, you are right.
@arch0r:
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.
Don't use that option arch0r, it is dangerous.
Last edited by ibendiben (2008-07-02 10:44:51)
Offline
I used the default option, what should I change in the script? Did I miss something important?
How can I find about the ssl stuff, I don't specifically know anything which uses it. Is there a good way to delete the files I want in the list or have to do it one by one?
Can you post your script file, which directories havI deleted the whole /usr/share/mime folder and did pacman -Sf shared-mime-info but i still all the lines.
what should I do to find if the file is indeed important? I have to say I am kind of lost here
Last edited by venky80 (2008-07-02 12:36:23)
Acer Aspire V5-573P Antergos KDE
Offline
I shall run the script myself to see what I get out of it.
Offline
So, you don't need to worry!
I have that huge list of mime-info and ssl files too...
Offline
so basically this cleanup need of ours will remain unfulfilled!
Acer Aspire V5-573P Antergos KDE
Offline
Not really, the best thing you can do to know a file is junk or not is to search for it with google.
Sometimes you won't find anything but still it's usefull. It takes some time, I know, but that's the way,
The answer on how to remove files on that list easily (in stead of one by one) would be: grep and sed. Try to make yourself familiar with those (also called regular expressions) and command line linux becomes a lot more fun.
Again, if you're in doubt ask specific questions here. It is good however to search for yourself first.
Offline
yeah i think the script's quite good to check if there any leftover files linked to any uninstalled packages. even xorg.conf is in the output, which is definitely no junk . if you delete too much, lots of installed packages will be corrupted (see pacworld in the aur, love this app :> ) or, in the worst case, arch has been killed
Last edited by arch0r (2008-07-03 10:34:41)
Offline
venky80:
The script features a FILTER list (open it in a text editor) which names paths to files that are important and enables you to exclude paths from the results.
You need to edit this list according to your likings. For me, I used this:
## FILTERED FILES / PATHS ##
/etc/fonts
/etc/gconf
/etc/X11
/etc/abs
/etc/ssl/certs
/opt/kde/share/autostart
/usr/share/fonts
/usr/share/mime
/boot
/dev
/home
/media
/mnt
/proc
/root
/srv
/sys
/tmp
/var/abs
/var/cache
/var/games
/var/log
/var/lib/pacman
/var/lib/mysql
/var/run
/var/tmp
/arch
I could add even more. Like the stuff from java (whatis) and vim (view). But those don't take up that much space and I don't mind them to be listed.
Also I found that the script can have some problems with symlinks.... The find command doesn't list those while pacman -Ql uses them sometimes (in my case "preload"-files).
Anyway, when you exclude your bluetooth and virtualbox groups by adding them to the FILTER your list get's a much more convenient length
I expect you can recognize files more easily and if you don't google and pacman -Ss are your friends.
From the look I gave it your list isn't all too messed up. I think you have nothing to worry about. Succes!
Last edited by ibendiben (2008-07-03 14:09:18)
Offline