Skip to content
TheChatArchiveThe Chat Archive
o1-mini-2024-09-12· OpenAIAi2 WildChat-4.8M (AI2)

How can I purge wine from my Ubuntu 22.04 if I didn't install it by sudo apt install?

  1. User

    How can I purge wine from my Ubuntu 22.04 if I didn't install it by sudo apt install?

  2. Assistant

    If you didn't install Wine using sudo apt install, it was likely installed through another method such as adding the WineHQ repository, using a different package manager (like Snap or Flatpak), employing tools like PlayOnLinux or Lutris, or compiling it from source. To completely remove Wine from your Ubuntu 22.04 system, follow the steps below based on how Wine might have been installed:

    1. Check and Remove APT-Based Installations

    Even if you didn’t use sudo apt install wine, other methods might have installed Wine-related packages via APT (Advanced Package Tool).

    • List Installed Wine Packages:

      dpkg --get-selections | grep -i wine
      
    • Purge Wine Packages:

      If you find any Wine-related packages, remove them using:

      sudo apt purge 'wine*' -y
      sudo apt autoremove -y
      

    2. Remove WineHQ Repository (If Added)

    If you added the WineHQ repository to install Wine, you should remove it:

    • List WineHQ Repository Files:

      ls /etc/apt/sources.list.d/ | grep -i wine
      
    • Remove WineHQ Repository Files:

      sudo rm /etc/apt/sources.list.d/winehq*.list
      
    • Update APT Cache:

      sudo apt update
      

    3. Uninstall Wine Installed via Snap

    Wine can be installed as a Snap package. To check and remove it:

    • List Snap Packages:

      snap list | grep -i wine
      
    • Remove Wine Snap:

      If you find a Wine Snap package, remove it using:

      sudo snap remove [wine-snap-name]
      

      Replace [wine-snap-name] with the actual name of the Wine Snap package.

    4. Uninstall Wine Installed via Flatpak

    If you used Flatpak to install Wine, follow these steps:

    • List Flatpak Packages:

      flatpak list | grep -i wine
      
    • Uninstall Wine Flatpak:

      flatpak uninstall [wine-flatpak-name]
      

      Replace [wine-flatpak-name] with the actual name of the Wine Flatpak package.

    5. Remove Wine Installed via PlayOnLinux or Lutris

    If you used tools like PlayOnLinux or Lutris to manage Wine installations:

    • PlayOnLinux:

      • Open PlayOnLinux from your applications menu.
      • Select Configure.
      • Choose the Wine version or virtual drive you want to remove.
      • Click Remove.
    • Lutris:

      • Open Lutris from your applications menu.
      • Navigate to the Runners section.
      • Select Wine.
      • Click Remove to uninstall the Wine runner.

    6. Uninstall Wine Compiled from Source

    If you compiled Wine from source, you'll need to manually remove the installed files:

    • Navigate to the Source Directory:

      If you still have the source directory where you compiled Wine, navigate to it. For example:

      cd ~/wine-source-directory
      
    • Run Uninstall Command:

      sudo make uninstall
      

      Note: If you no longer have the source directory, you'll need to manually remove Wine files, typically located in /usr/local. For example:

      sudo rm /usr/local/bin/wine
      sudo rm -rf /usr/local/share/wine
      sudo rm -rf /usr/local/lib/wine
      sudo rm -rf /usr/local/include/wine
      

    7. Remove User-Specific Wine Configuration and Data

    Regardless of how Wine was installed, user-specific configurations and data are stored in your home directory. To remove them:

    rm -rf ~/.wine
    rm -rf ~/.local/share/applications/wine
    rm -rf ~/.config/wine
    

    8. Verify Removal

    • Check for Wine Executable:

      which wine
      

      If it returns a path, you may need to remove the executable manually:

      sudo rm $(which wine)
      
    • Search for Remaining Wine Files:

      To ensure all Wine-related files are removed, you can perform a comprehensive search:

      find / -iname "*wine*" 2>/dev/null
      

      Review the output and manually delete any remaining Wine files or directories that you recognize as part of the Wine installation.

    9. Clean Up APT Sources and Dependencies

    After removing Wine, it's good practice to clean up any residual packages and update your package lists:

    sudo apt autoremove -y
    sudo apt autoclean
    sudo apt update
    

    10. Optional: Remove PPAs Related to Wine

    If you added a PPA (Personal Package Archive) for Wine, remove it to prevent future package updates from that source.

    • List All PPAs:

      ls /etc/apt/sources.list.d/
      
    • Identify Wine-Related PPAs:

      Look for files related to Wine, such as winehq.list or similar.

    • Remove the Wine PPA:

      sudo add-apt-repository --remove ppa:repository-name
      

      Replace ppa:repository-name with the actual PPA name related to Wine.

    Final Notes

    • Backup Important Data: Before performing system-wide removals, ensure you backup any important data to prevent accidental loss.

    • Use Caution with rm -rf: The rm -rf command is powerful and can delete files irreversibly. Double-check paths before executing.

    By following these steps, you should be able to completely purge Wine from your Ubuntu 22.04 system, regardless of the installation method you initially used.