Ubuntu - cannot uninstall/reinstall apps properly

-1

Uninstalling apps is a nightmare. For instance, I use 'sudo apt-get install nginx' and then when I go into Software Center, and uninstall it... it still keeps all the configs and some folders and I'm curious why.

I try using -rm -r on the folder ... it removes it all, success! Though, not for long. If I was to reinstall the application, it creates all the folders it needs ... but NONE of the files. So in order to reinstall an app, I need to reinstall the OS.

If I uninstall it, but not remove the excess files ... I can reinstall fine. It's just a hard wipe that doesn't reinstall fine.

The app could be nginx, it could even be PHP or many other things. What is happening and how can I fix this?

I did actually attempt purge, it didn't remove the configurations so I tried it again and it mentioned there were two apps that were related and if I was to install. I was to do 'autoremove'. It's not necessarily an instant reinstall. I perhaps may want to completely remove an app and then install it again in a few months later.

Just can't figure it out, but I guess I can have an attempt to read the manpage and see if it makes sense to my little brain, so right now I'm going to have to reformat in order to be able to install nginx again to test.

Jeanie Tallis

Posted 2011-09-29T20:35:18.837

Reputation:

@Jeanie: since you're trying to learn this, why don't you consider asking "How can I properly manage packages; I know how to get things installed (sample) but I have no clue how to uninstall them? I tried doing A or B but ran into problem X, Y and Z. Can someone point me in the right direction?" - it is more constructive than complaining that things don't work the way you expect them to – sehe – 2011-09-30T15:31:46.863

Answers

3

If you want to uninstall the application and the config files, you need to use sudo apt-get purge <app>. This behaviour is described in the man-page of apt-get. Read it with man apt-get. The command sudo apt-get remove … will keep the config file (for very good reasons!).

Stefan Haller

Posted 2011-09-29T20:35:18.837

Reputation:

0

See the man pages for apt-get and synaptic.

Things often break when you manually delete files belonging to installed packages. Anyways, you can always

sudo apt-get install --reinstall some-package-name
sudo apt-get install -f

sehe

Posted 2011-09-29T20:35:18.837

Reputation: 1 796

I have edited your answer to make it easier to read for others with a similar problem who find this answer when searching. I think your commentary would be better placed as a comment to the original question. If you disagree, please undo the edits. – RedGrittyBrick – 2011-09-30T15:27:21.580

@RedGrittyBrick: Welcome edit. I had typed this as a comment but decided... it became unreadable - It explains the 'here nor there' half baked formatting. Thanks for the improvement – sehe – 2011-09-30T15:29:30.687