How to clean up remnants after removing Wine bottle

Questions about Wine on Linux
Locked
electrocutioner
Level 1
Level 1
Posts: 6
Joined: Tue Apr 22, 2014 12:19 am

How to clean up remnants after removing Wine bottle

Post by electrocutioner »

A recent game installation went horribly wrong. The game installer froze and I was forced to kill the process. After rebooting, I removed the Wine bottle by running this command:

rm -rf ~/.wine

However, I can still see shortcuts left in the dash and on my desktop (the desktop one was deleted easily).

Aside from deleting the Wine bottle, how can I ensure that all changes made by an installer (or by Wine itself) are undone? For example, I know that Wine sometimes makes .desktop files that I can't remove just by deleting the Wine bottle.

Also, is there a way I can remove only a malfunctioning program instead of every program I have ever installed in Wine? I don't want to have to reinstall all my Wine programs because of one bad apple. Any help would be appreciated. I am using Ubuntu 12.04. Thanks!
User avatar
dimesio
Moderator
Moderator
Posts: 13367
Joined: Tue Mar 25, 2008 10:30 pm

Re: How to clean up remnants after removing Wine bottle

Post by dimesio »

electrocutioner wrote: Aside from deleting the Wine bottle, how can I ensure that all changes made by an installer (or by Wine itself) are undone? For example, I know that Wine sometimes makes .desktop files that I can't remove just by deleting the Wine bottle.
http://wiki.winehq.org/FAQ#head-cf92baf ... 05caaf9c0a
Also, is there a way I can remove only a malfunctioning program instead of every program I have ever installed in Wine? I don't want to have to reinstall all my Wine programs because of one bad apple.
Most experienced users install things in separate wineprefixes for that reason. http://wiki.winehq.org/FAQ#wineprefix
electrocutioner
Level 1
Level 1
Posts: 6
Joined: Tue Apr 22, 2014 12:19 am

Re: How to clean up remnants after removing Wine bottle

Post by electrocutioner »

Thanks, that got rid of my shortcuts. However, some files such as wine-extension-txt.desktop, wine-extension.png.desktop, and more seem to have remained. I found these files in ~/.local/share/applications. Are these .desktop extension files part of Wine itself, or were they installed when I installed a program into Wine? If they aren't part of Wine itself, how do I get rid of them (and all other files that might not be removed by these commands?):

cd
rm -rf .wine
rm -f ~/.config/menus/applications-merged/wine*
rm -rf ~/.local/share/applications/wine
rm -f ~/.local/share/desktop-directories/wine*
rm -f ~/.local/share/icons/????_*.{xpm,png}
rm -f ~/.local/share/icons/*-x-wine-*.{xpm,png}
User avatar
dimesio
Moderator
Moderator
Posts: 13367
Joined: Tue Mar 25, 2008 10:30 pm

Re: How to clean up remnants after removing Wine bottle

Post by dimesio »

electrocutioner wrote:However, some files such as wine-extension-txt.desktop, wine-extension.png.desktop, and more seem to have remained.
I don't have either file on my system, probably because I have winemenubuilder disabled in .bashrc. That suggests they can be safely removed. As to how, just delete them the same way you would delete any other file, either at the command line or in your file manager. If you want to be really safe, do it through your file manager and send it to the Trash rather than deleting them permanently so you can restore the files if removing them causes any problems.
electrocutioner
Level 1
Level 1
Posts: 6
Joined: Tue Apr 22, 2014 12:19 am

Re: How to clean up remnants after removing Wine bottle

Post by electrocutioner »

Sorry I'm a bit lost. What is winemenubuilder, and how do you think those .desktop files got on my computer? If you didn't have those .desktop files, then it would seem they were not part of my original Wine installation, which means they had to come from a program I installed. If they came from a program I installed, why didn't running those 7 commands remove them completely?
User avatar
dimesio
Moderator
Moderator
Posts: 13367
Joined: Tue Mar 25, 2008 10:30 pm

Re: How to clean up remnants after removing Wine bottle

Post by dimesio »

Winemenubuilder creates menu entries and filetype associations when you create/update a wineprefix or run an installer. Those two .desktop files are for .txt and.png files, and enable you to open those filetypes with a Wine application by double-clicking the files in your native file manager.
If they came from a program I installed, why didn't running those 7 commands remove them completely?
Only one of those commands targets anything in ~/.local/share/applications, and that only removes the wine subdirectory. It would not remove anything in ~/.local/share/applications outside of ~/.local/share/applications/wine.
electrocutioner
Level 1
Level 1
Posts: 6
Joined: Tue Apr 22, 2014 12:19 am

Re: How to clean up remnants after removing Wine bottle

Post by electrocutioner »

Thanks. That was very helpful information. I will just leave Winemenubuilder enabled. The alternatives seem pretty drastic. Besides, having a few .desktop files floating around isn't a big deal. My larger concern is that those commands wouldn't actually clean my Wine installations, thus leaving behind some junk and potentially interfering with new installations. If they're just file assocations that I can simply ignore, then I'm not too concerned. It was more important to understand the origin of those .desktop files. I can always disable Winemenubuilder later if I find a more compelling reason.

I went back to the FAQ section that described storing the virtual Windows installation somewhere other than ~/.wine. I think I understand the "export WINEPREFIX=~/.wine-new wine winecfg" command; it just creates a new Wine virtual environment. There are still a few things I don't understand though:

1. Aside from the "unset WINEPREFIX" command, how would I set WINEPREFIX back to ~/.wine? Suppose I just ran this command:

export WINEPREFIX=~/.wine-new wine winecfg

A folder called ~/.wine-new just got created. But what if I ran this command now?:

export WINEPREFIX=~/.wine wine winecfg

~/.wine already exists, so is this latest what the FAQ meant by setting "WINEPREFIX back to ~/.wine"?

2. What does it mean to specify the Wine prefix in each command? What "command" is the FAQ referring to?

3. Having separate bottles is great, but how do I choose which one I want to use when installing a program? From the perspective of the installer, all I am choosing is a destination folder within Windows (e.g. C:/Program Files/AProgram). How do I tell it to use a specific bottle?

4. Which command would I run to completely remove a specific bottle while leaving the others intact?
User avatar
dimesio
Moderator
Moderator
Posts: 13367
Joined: Tue Mar 25, 2008 10:30 pm

Re: How to clean up remnants after removing Wine bottle

Post by dimesio »

electrocutioner wrote: 1. Aside from the "unset WINEPREFIX" command, how would I set WINEPREFIX back to ~/.wine?

Code: Select all

export WINEPREFIX=~/.wine
Note that exporting only applies to that terminal session. It ends when you close the terminal window, and if you open another terminal window at the same time, you would have to set the WINEPREFIX for that session in that window.
2. What does it mean to specify the Wine prefix in each command? What "command" is the FAQ referring to?
The command to run the program. Winemenubuilder will include the wineprefix information in any menu entries and desktop links it creates, so if you don't disable it you should only have to specify the wineprefix when running an installer or one of Wine's builtin apps (winecfg, regedit, etc).
3. Having separate bottles is great, but how do I choose which one I want to use when installing a program?

Code: Select all

WINEPREFIX=/path/to/wineprefix wine /path/to/installer
4. Which command would I run to completely remove a specific bottle while leaving the others intact?
A wineprefix is just a directory, and you can delete it from your file manager just like any other directory. But if you really want to do it from the command line:

Code: Select all

rm -rf /path/to/wineprefix
I really don't recommend using the command line to delete wineprefixes; accidentally hitting the space bar in the wrong place could wipe out your entire home directory.
electrocutioner
Level 1
Level 1
Posts: 6
Joined: Tue Apr 22, 2014 12:19 am

Re: How to clean up remnants after removing Wine bottle

Post by electrocutioner »

If I use rm -rf /path/to/wineprefix (or the GUI equivalent), won't it still leave the broken shortcuts for that particular bottle intact?
User avatar
dimesio
Moderator
Moderator
Posts: 13367
Joined: Tue Mar 25, 2008 10:30 pm

Re: How to clean up remnants after removing Wine bottle

Post by dimesio »

electrocutioner wrote:If I use rm -rf /path/to/wineprefix (or the GUI equivalent), won't it still leave the broken shortcuts for that particular bottle intact?
Yes.
electrocutioner
Level 1
Level 1
Posts: 6
Joined: Tue Apr 22, 2014 12:19 am

Re: How to clean up remnants after removing Wine bottle

Post by electrocutioner »

Is there a way to manually remove the shortcuts then?

And what else could be left after removing a bottle?
User avatar
dimesio
Moderator
Moderator
Posts: 13367
Joined: Tue Mar 25, 2008 10:30 pm

Re: How to clean up remnants after removing Wine bottle

Post by dimesio »

electrocutioner wrote:Is there a way to manually remove the shortcuts then?
Select them in your file manager and hit "delete" or use the command line instructions that I pointed you to before.
And what else could be left after removing a bottle?
Some apps save data to directories outside the wineprefix, so look for those. And before you ask, yes, you can delete them through your file manager just like anything else.
Locked