2

This question already has an answer here:

Hoping someone can help me here with this issue I'm having. Wine isn't working on my Ubuntu 14.04LTS so I want to completely remove it and install from the software manager

Code I'm using is as follows

sudo apt-get purge wine

Which shows

wine            wine1.6         wine1.6-amd64   wine1.6-i386    wine-gecko2.21  wine-gecko2.34  wine-mono0.0.8  wine-mono4.5.4  winetricks

So When I go to unistall using

sudo apt-get remove wine1.6 --purge --no-install-recommends

It uninstalls wine1.6 all fine but also then installs another version

The following NEW packages will be installed


wine1.8 wine1.8-amd64 wine1.8-i386:i386

My question is how can I prevent wine1.8 from being installed as I want wine removed completely. Sorry if this is really simple I'm new to ubuntu and learning slowly

Thanks, Youlethal

marked as duplicate by Eliah Kagan, Eric Carvalho, edwinksl, Charles Green, Yaron Aug 24 '17 at 5:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Try updatedb command and then try to see if the which command would return the some result or not – Mostafa Ahangarha May 12 '16 at 11:58
  • 2
    I'm voting for the duplicate, but I'm curious - why are you using --no-install-recommends for an uninstall process? – Charles Green Aug 24 '17 at 0:36
4

I think your first command is only purging the wine package, which is just a dependency for the others.

sudo apt-get purge "^wine.*"

should purge every package on your system starting with the word 'wine'.

Note that apt-get uses regular expressions for pattern matching, hence the ^ and .*

  • This works and is safe, but you don't actually need the .* at the end (and, without it, the quotes become optional). That is, you can just use sudo apt-get purge ^wine. The presence of ^ is sufficient to cause the argument to be interpreted as a regular expression, and when apt or apt-get interprets an argument as a regular expression, it matches it anywhere in the package name. That's why you need ^--to anchor the match to the start of the package name. The regex doesn't need to match the entire package name, just any part of it. – Eliah Kagan Aug 25 '17 at 11:23
2

Simply running

sudo apt remove --purge wine*

should remove the wine packages and not result in any additional installations.

Sidenotes

  • * is acting as wildcard here
  • apt and apt-get are similar commands - while they are not 1:1 the same. apt seems to be the future.
  • --purge results in removing the user-related configs as well and not just the package itself
  • 7
    Don't do this! See Why does apt removes unwanted packages when giving * as suffix? The purge or remove action with an argument like wine*, wine\*, or 'wine*' removes way more than you might think. It removes every package with win anywhere in its name (not wine, win--as wine* is treated as a regex and e* means "zero or more es") and every package that depends directly or indirectly on any of those packages. This often breaks an Ubuntu system very badly, preventing it from being used for much of anything until it is fixed or reinstalled. – Eliah Kagan Aug 23 '17 at 19:18
  • So wine+ will do it? – Reeshabh Ranjan Dec 12 '17 at 7:27
1
purge remove

will remove about everything regarding the package packagename, but not the dependencies established during installation.

sudo apt-get purge --auto-remove [packagename]

This will remove the package along with the configuration files and dependencies.

You may like to have a walk through following links:

How to completely remove any program and its installation files?

What is the correct way to completely remove an application?

1

In my case, after conducting

sudo apt-get remove wine

Wine still appear in a dash. So I tried:

sudo apt-get purge wine

Which gave me an output:

The following packages were automatically installed and are no longer required: (...)
Use 'sudo apt autoremove' to remove them.

So when you get to this point, then you can run this command:

sudo apt-get autoremove

When I did that, wine disappeared from the dash.

  • That's effectively the same as Dhaval's answer. apt-get purge <PACKAGE> && apt-get autoremove is equivalent to apt-get purge --auto-remove <PACKAGE>. – David Foerster Apr 30 '17 at 19:48
  • @DavidFoerster I think this is a different, nicer, easier, less error prone way. (a) In practice when one knows one needs autoremoval, it is often because one has already run an apt or apt-get command with the remove or purge action. So the method here is usually the one that is useful. (b) If one is unsure about whether or not one wants autoremoval, it's better to use these two separate steps. There's nothing wrong with purge --auto-remove--the other answer has value--but I wouldn't recommend getting in the habit of removing what one thinks are single packages in that way. – Eliah Kagan Aug 25 '17 at 12:07

Not the answer you're looking for? Browse other questions tagged or ask your own question.