Saturday, February 4, 2017

software installation - How to install and configure Wine?


I am looking for a step by step instruction to guide me in the ways of installing, configuring and debugging many of the issues new users have when dealing with Wine in Ubuntu.


What is the recommended way of installing Wine, some of the key issues that it has and how to solve them?


If I have a specific problem with an App in Wine, how do I go about solving it? What are the recommended steps to ensure that I can fix a problem related to an app I wish to use?



If you want to use the latest development/staging version of Wine, please make sure to follow the guide in the Official WineHQ Guide for Ubuntu, basically covering:



  • If you are using a 64-bit Architecture, then enable 32-bit for better compatibility


    sudo dpkg --add-architecture i386

  • Add the Wine Key, Wine Repository & Update Repositories


    wget -nc https://dl.winehq.org/wine-builds/winehq.key
    sudo apt-key add winehq.key


For Ubuntu 19.04 for example, we would add the repository like this (just change the name of the version at the end of the command line, in this case, the word disco to the name of the Ubuntu version you are using):


    sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ disco main'
sudo apt update


  • Then install the version of Wine you wish to use:



    • Based on Wine Development (Stable) (eg: 4.0)


      sudo apt install --install-recommends winehq-stable

    • Based on Wine Development (Testing Stage) (eg: 4.1)


      sudo apt install --install-recommends wine-devel winehq-devel

    • Based on Wine-Staging (Bleeding Edge) (eg: 4.1.1)


      sudo apt install --install-recommends wine-staging winehq-staging


    Lastly run


    WINEARCH=win32 winecfg

    in the terminal to make sure it configures Wine correctly (In that order). You will also need to install winetricks (Another configuration package, really helpful for installing Windows components like .NET Framework and other needed libraries). So after this, please do:


    sudo apt install winetricks


Video Demostration showing Wine 1.9.X in Action - Wine 1.9.X Performance


1. Differences between Wine Stable, Development & Staging versions


Stable versions offer less bugs with better stability and receive updates every 3-6 months after release.


Development version is the next stable version in development and receives updates every 2 weeks.


Staging version is the same as Development Version but includes all patches and enhancements from Wine-Staging


The decision to stick with the stable version (Even number versions: 1.0, 1.2, 1.4...) or with the unstable versions (Odd number versions: 1.1, 1.3, 1.5...) is up to the user, the main difference is compatibility and performance which are both enhanced in the Development version. You get the latest fixes it offers, and also become a tester that can help in the development cycle.


2. Installing the Recommended Stable Wine version (from PPA)


In the terminal type the following to add the Wine PPA, update repositories, and install latest Wine & Winetricks version:


wget -nc https://dl.winehq.org/wine-builds/Release.key && sudo apt-key add Release.key && sudo apt-add-repository -y https://dl.winehq.org/wine-builds/ubuntu/ && sudo apt update && sudo apt install wine-devel winehq-devel winetricks

or you could include the Wine 32-Bit Arch (Better support) and configuring winecfg (This should only be applied to new installations since it will move the existing Wine installation to a folder called winebck):


sudo dpkg --add-architecture i386 && wget -nc https://dl.winehq.org/wine-builds/Release.key && sudo apt-key add Release.key && sudo apt-add-repository -y https://dl.winehq.org/wine-builds/ubuntu/ && sudo apt update && sudo apt install wine-devel winehq-devel winetricks && export WINEARCH=win32 && winecfg

3. How to know which components an application needs


To find out what components an app needs, look in the Wine Application Database. It lists if the application is usable, what components it needs and how to install them.


4. How to install additional components, DLLS and Libraries to Wine


To have a working and enhanced Wine environment for your games and apps, I suggest you use winetricks to install additional components which offer better compatibility with games. To have a better working system do the following here is an example for HL/HL2 (Non-Steam. For the Steam Version go here: How can I install Steam? . Know that Half-Life and HL2 are natively supported in Ubuntu):


To play HL/HL2 you need the Wine PPA as mentioned above. After opening winecfg at least once on the terminal, open winetricks by running winetricks --gui then follow this steps:


Select Select the default wineprefix


enter image description here


Select Install a windows DLL or component


enter image description here


Install all that I have marked (and any additional you need). This covers many apps:


enter image description here


enter image description here


enter image description here


enter image description here


Right click the installer for HL/HL2 and select Open with Wine. Both games should work perfectly. This applies to apps in general and depending on the app you will need to install more or less components.


You can also install each component in terminal by adding the name of the component after the winetricks command:


winetricks vcrun2010 - Will install vcrun2010 using winetricks


winetricks xna40 - Will install xna40


5. Troubleshooting a Wine App


Sometimes, when running an App one or several of the following can actions can happen:



  • Frozen App

  • Wine opens a Blue window for a moment and then closes it

  • Nothing appears to happen

  • Inside the Wine window everything is Black in the start or at some point

  • DLL, Video card or Component not recognized


    For most of this problems there are solutions. Here are the recommended steps for you to start troubleshooting your way into a Wine app:



    1. Always visit the Wine App Site to see what other testers have done to make the App work. For example here is me testing Dead Island: Riptide which I gave it a Bronze since after the selecting the character the whole game went to a Black screen. What I did to test out what was happening was to go to the terminal and run the game from there. In the terminal some of the errors suggested I was missing a vital piece for the game to work. After reading the error output and doing what it suggested (Replacing a corrupted DLL) I could install a component the game needed and the game worked perfectly.


    2. Knowing what the game needs is crucial to getting the game working correctly. Setting the winecfg options and OS environment is only a small part. This is only creating the environment for the app. You need to add other functionality like DirectX, XNA, .NET Framework and more that the app might need in order to work. These are key components for some apps. Without them, even if some apps work correctly, others will not. Making sure you have all of this components gives you a higher chance of complying with what an app needs.


    3. As you can see from my Dead Island test I added several winetricks packages and also installed 3 packages the games comes with (DirectX, Windows Media Format and Microsoft Visual C++ 2010). With this I managed to guarantee that the game would start and be playable.


    4. Some apps are only created for certain Windows versions as seen with Dungeon Keeper. To specify a particular Windows Version for a particular app you can open winecfg navigate to Applications and select Add Application, then search for the applications executable file and click on Open. Now select the application from the list and then change the Windows Version for it. This way, only this application will have an specific version of Windows assigned to it, instead of globally changing the Windows version for all apps.


    5. Changing the Windows version globally can affect apps that were installed with a different Windows version. For example, Installing Terraria in a Windows XP environment and then changing it after playing to Windows 7 will give you one of two errors, one, not finding the saved games and two not running the app.


    6. Running an app to diagnose what the problem can be done through the terminal which is the best way by far to know what the app is doing or needing. The app can tell you information like:



      • What missing DLL it needs to run (mscore.dll, steam_api.dll)

      • What missing component it needs to run (XNA, DirectX, .NET...)

      • If the problem is you are using a 64 Bit environment instead of a 32 Bit

      • If you need to add a parameter for the app to run


      For missing DLLs I suggest using dll-files to download specific DLLs missing that are needed for the APP. Normally you can paste this DLLs inside the game folder or in the Windows/System32 folder (Or both) and that should solve the problem. For missing components use winetricks.


    7. When troubleshooting an App, always run the app in an emulated Desktop Window. Open winecfg go to Graphics and enable Emulate a Virtual Desktop. Then set the resolution for it. This way, if the app freezes, hijacks the keyboard and/or mouse focus, at least you have a way to eliminate the app instead of having it fullscreen where you have few choices:


      enter image description here


    8. For freezing scenarios of an app at fullscreen I suggest activating the "Kill X" feature that is found in the Keyboard Layout Window which can save you several seconds of time when trying to get out of a frozen Wine app:


      enter image description here


    9. Another technique of getting out of a frozen state is either opening a terminal and type wineserver -k or killing the X server. To do this firs configure it by running sudo dpkg-reconfigure keyboard-configuration and on the last option there that talks about killing X, say "YES". This will enable the CTRL+ALT+BACKSPACE combination.


    10. Remember that if an app needs a minimum or recommended hardware requirement in Windows, it will also need the same on Linux. If the app needs 512 MB of RAM and a 2.0 Ghz CPU, it will need the same on Linux using Wine.


    11. Sometimes you will come across an app in an ISO or any other Image format that you can not manage to open or install. Ubuntu comes with several tools to open this files but the best one I have tried so far is CDEMU which covers several types of images that bring Multi-Sector or Protected format. This is the closest you will get to something similar to DAEMON Tools. Cases like The Sims 3, Simcity 2000 and others can only be opened and installed using this app. More info in Apps capable of mounting/unmounting CD/DVD Images with multi-sector or protected format


    12. For cases where an specific app is not running, showing graphical glitches, black screen or not running with full graphics I actually recommend reading one of the following links that applies to the end user for video support:


      Nvidia Users - How do I install the Nvidia drivers?


      Hybrid - Is a NVIDIA GeForce with Optimus Technology supported by Ubuntu?


      Ati - What is the correct way to install proprietary ATI Catalyst Video Drivers (fglrx) directly from AMD?


      Apart from checking the above, if you have the correct drivers I would also add that you need to check if your video card has OpenGL support. For this I would first install mesa-utils if not yet installed:


      sudo apt-get install mesa-utils


      to test for OpenGL support. Simply run a check to see if you have OpenGL support:


      glxinfo|grep 'direct rendering'


      which should say Yes if you do have support. Another alternative would be:


      /usr/lib/nux/unity_support_test -p


      Lastly, you can run glxgears to give you an idea of how your video card renders and its FPS for the render. Another very important point is to run the application from the terminal as in wine AppName.exe, this way it will show what the problem is.


    13. If the Unity Launcher is not hiding itself when running a Wine app or is moving the app to the right you can do one of 2 things:



      • Hold the ALT key and click and drag the Wine to the Left


      • In the appearance option select "Auto-Hide The Launcher" and set the sensitivity to a level you like. This way the launcher will hide when the mouse leaves it's area.



      enter image description here


    14. Shader Model 3.0 is not recognized in Wine (Including Steam games)


      There are games that require Shader Models and output an error similar to Required OpenGL extension GL_EXT_texture_compression_s3tc. To fix this simply type the following in the terminal:




sudo apt-get install libtxc-dxtn-s2tc0
( note in recent version of Ubuntu libtxc-dxtn-s2tc0 is not longer needed )


Wine has come a LONG way from the days where newer games could not be played. It has gotten to a point where playing in Ubuntu is effortless. Wine has even some support for SM4.0 and DirectX 10/11 on Wine 1.6. If the problem persists it means that either your video card does not support this or you are missing the correct libraries.


Another reason that Wine might not detect Shader Model is because it might be set to Disabled in the Winetricks. Open the Dash and type winetricks. Select your wineprefix then Change Settings. Then look for the glsl=enabled option and select it. This should solve the Shader Model issue. Cases like the game Limbo are solved this way.


6. How do I open multiple Wine apps without them using the same Window (Overlapping)


You can setup multiple Wine windows by adjusting some Wine parameters before starting each individual Wine program. The fastest way is to open the terminal where the executable of the app you want to run exists. Let us assume it is the Wow.exe app. Then simply type the following:


wine explorer /desktop=WOW,1024x768 "Wow.exe" -opengl -console

This would open the Wow.exe executable with a Window titled "WOW", a resolution of 1024x768 for that specific Window and it would apply the parameters -opengl and -console to the Wow executable. Now assuming you have the game installed somewhere else, you would the following change:


wine explorer /desktop=WOW,1024x768 "/media/cyrex/fun/wow/Wow.exe" -opengl -console

This executes Wow.exe assuming it resides in the folder wow inside a partition called fun in your /media/USER folder. The output should be similar to this when running for example 4 apps:


Wine


There is a more easier way to accomplish this. The idea is to create a Desktop shortcut by right clicking on the Desktop and selecting New Document --> Empty Document. This should create an "Untitled Document" file on your desktop. Now open the file and paste in it the following:


   [Desktop Entry]
Type=Application

Now save it and rename the file to the application you want to open but at the end add ".desktop". It will turn into an "Executable Windows Icon". Now right click the Icon again and go to Properties --> Permissions --> Activate Allow executing file as program. Now go to the Basic Tab and insert the information you need to execute that wine app. The end result should be something like this:


enter image description here


7. Does having Ubuntu 64 bit influence Wine


Yes, having Ubuntu 64 Bit will also set Wine as 64 bit. This will create several problems for many Windows apps that only work on 32 Bit, for example not being able to install several of the .NET Frameworks since they will only work on the 32-Bit version, which will result in the user not being able to run many Windows applications. To solve this you need to do the following after having succesfully installed the PPA version as I mentioned above. Immediately afer installing the PPA wine package and before opening winecfg open the terminal (Make sure you are at your home folder by typing cd ~) and type the following:


rm -fr ~/.wine
export WINEARCH=win32
export WINEPREFIX="/home/USER/.wine"
winecfg

Change USER with your user account. For example in My case, that line would read export WINEPREFIX="/home/cyrex/.wine"


With this method you have changed the Wine architecture to 32 bit and on the moment you open Winecfg, it will configure all the Windows versions available to 32 Bit.


8. Alternatives to Wine PPA


PlayOnLinux (PoL)


Although you can actually install and configure everything you need with Wine alone and it's complementing apps (winetricks, regedit, explorer) using PoL can save you some trouble and time when installing an application. With PoL you can find a list of apps that you can select and install in it's database:


enter image description here


and by simply selecting to install you achieve the following benefits:



  • Creating an independent container which holds the app installed, a specific Wine version for the app installed (In some cases, a specific Wine version works better for a specific app than the current Wine version).


  • Automatically installing any additional DLL and Components the app needs to function correctly.


  • Adding the appropriate registry keys the app needs


  • Create an independent way of running multiples apps without them overlapping each other with Windows version changes, regedit changed, specific Wine versions, etc..


    Of course, it is important to know that PoL works side by side with Wine and it needs Wine to work correctly (It is based on it). In many cases, an app might not work with PoL but will work with the default Wine configurations I have mentioned in this guide. So if you find the app you want to use in PoL, great. But if you don't find it, remember you always have the alternative to using the default Wine to install and configure the app.


    The benefits of installing the app using Wine and installing it using PoL is that with Wine, you can access and execute the App using the DASH, like in the images below:


    enter image description here
    (Terraria)


    enter image description here
    (Dead Space & Dead Island)


    CodeWeavers CrossOver (CC)


    CC is very similar to PoL on how to install and configure apps. The main difference is that CC offers official support. They even have their own CodeWeavers Database which holds more than 10.000+ apps. Not only that but they have a ranking system similar to the one in Wine's AppDB. They have also contributed to the development of Wine some of which you can see in their Support.


    DosBox (DB)


    DB is to MS-DOS apps as Wine is to Windows apps. With DB you can run MS-DOS apps in your system. Simply install the dosbox package and you are done. Running an app is as simple as going to the folder where the app resides and executing the following:


    dosbox ./


    This will open the current folder as a drive letter on the DB environment.


    You can also mount a folder by doing the following after opening DB:


    mount x: /Absolute/Path/To/Folder/Of/App


    For example


    mount c: /home/cyrex/Desktop/Dune2


    Will create the C: Drive letter which contains the Dune2 folder. So if I simply execute dune2.exe I get the following:


    enter image description here



9. What are some special parameters and tips I can use with Wine


There are a couple, for example:


COMMANDS


wine --version - Shows the version of wine


wineserver -k - Kills all wine versions for the specific user. This is useful if your Wine app is frozen, took the whole screen and does not let you use Ubuntu, has the mouse or keyboard focused on it and other Wine issues that might appear with some apps.


wine explorer - Will open an explorer similar to the Windows Explorer


wine explorer /desktop=X,Y - Creates a virtual desktop where X is the name of the Desktop Window and Y is the resolution of the Window. For example: wine explorer /desktop=WOW,1024x768 Wow.exe


regedit - Will open the regedit version of Wine similar to the Windows one.


wine uninstaller - Will open the Add & Remove of Wine similar to the one in Windows. Here you will be able not only see which apps you have install and uninstall them, but also be able to install new apps if you wish.


winetricks - Will open the winetricks app to install missing Libraries, DLLS and Components essential for the correct functionality of many Windows apps.


winecfg - Will open the Wine Configuration where you can set Video, Sound and Windows version.


wine ipconfig - Shows you the IP that Wine can see. Similar to ipconfig.


wine netstat - Shows you the IP/Port connections made. Similar to netstat.


wine start - Sets the working directory for the executable. This option helps in cases where the executable only works from the same folder and not from a full path. An example is if you wanted to run a .bat file or simply execute a command from another folder (eg: Parent folder), you would do something like this, assuming we are not in the same folder as MetroLL.exe:


 `wine start /d "C:\\Program Files\\GMT-MAX.ORG\\Metro Last Light" MetroLL.exe`

This would do two things, it will first set the directory to the Metro Last Light folder and then it would run the MetroLL.exe mentioned at the end. This is similar as running the executable from the same folder but it has the advantage of running the app from any other place. The thing to know here is that:



  • Wine does not like Unix paths, so you need to separate folders with \\ instead of \

  • You need to use an absolute path. You need to start from C:\\ to make sure the executable will always work as it should.

  • If the executable is outside the C: drive, then add the corresponding letter. For example, to execute a Windows binary outside of Wine, you would use the Z:\\ letter since Z: normally points to the Linux system's root directory.

  • If in doubt ask the command for help with the /? parameter, (eg: wine start /?)


export WINEPREFIX - This variable is used to change the Wine Prefix to another location. For example if you wish to merge PoL and Wine (Not recommended since PoL has multiple Prefixes) you can do the following:


   `export WINEPREFIX="/home/USER/.PlayOnLinux/wineprefix/PREFIX"`

Where PREFIX is the one you want to merge with Wine. You would have to run winecfg again.


TIPS



  • When dealing with a folder tha has spaces (eg: World of Warcraft), you can execute the Wow.exe file by adding the \ symbol in front of every space, this escapes the symbol. The end result would be something like "World\ of\ Warcraft\Wow.exe". If you do not want to add this escape symbols to your line of code, simply double quote the entire link, so it looks like:


    wine explorer /desktop=WOW,1024x768 "/media/cyrex/My Partition/World of Warcraft/Wow.exe" -opengl -console


    as you can see, there are 2 folders with spaces in them, "My Partition" and "World of Warcraft", but since I quoted the whole string, the need to include escape characters is not needed. If you wished to use the Wine Path (eg: C:/) then all slashes would be a double slash (eg: "C:\Program Files\App").


  • Parameters that are applied to an app should always be OUTSIDE the quoted strings. Using the example above, we can see -opengl and -console outside the quotes.


  • When dealing with apps that take hold of you mouse and/or keyboard, you can use wineserver -k to kill the app, or simply opening the App in Windows mode or setting the Windows mode with the wine explorer /desktop parameter will save you from having this mouse/keyboard problems.



10. Stability, Performance and App Support Wine offers to end users


APP SUPPORT


I have tried Wine since 2005 and seen how the developing process in Wine under Ubuntu has been quickly catching up to the latest games.


Before Wine 1.2 came out around 2012, it was difficult to get many apps working on Wine, but after Wine 1.2 came out it was a totally different result. Even more so after 1.4 came out in 2012, 1.6 in 2013 and then 1.8 in 2015. Many cases started to appear where they would work out of the box. Cases like Deep Space 2 which is/was one of the latest games I could play at that moment and which I tested 3 days after it was released. Alice in Wonderland (The new one I mean), The Sims 3, World of Warcraft, Amnesia and others. Even Skyrim could be played. These are games that demand powerful graphics and you can play them with little to no additional setups other than the normal install provided above.


To know what games you can play on Wine I recommend visiting the Wine App Database: http://appdb.winehq.org/ which holds more than 10K+. This includes information about their performance & stability and it helps in knowing if a game is playable.


The Wine App Database also offers a Ranking which determines what games can be played with less issues, if any. When you see this ranks, you have an idea if the App will work or not. Mind that you need to also take into consideration what hardware and Wine version the tester shows on the Wine Database. The rankings are as follow:


Platinum Rank - Means you have an almost 100% chance the app will work out of the box.


Gold Rank - Means you might find yourself doing a little bit of configuring but it will work out at the end.


Silver Rank - Means that the app will run, but might have graphical, sound or control issues.


Bronze Rank - Means the app will not work correctly.


Garbage Rank - Means the app still does not work and probably will not even install. The only way you could make it work would be when Superman starts eating kryptonian cereal in the morning.


For reference, a couple of years ago the amount of Platinum games was less than 50. In 2012 you could find More than 1.5K games out of which almost 200 were in the Latest Titles. Today there are more than 6K+ Games of which 4K+ are Platinum. The more people that participate in testing Wine apps, the better. Main reason I always recommend using the PPA from Wine.


PERFORMANCE


For performance information see Gaming performance difference between Windows and Ubuntu


11. How to Uninstall Wine


Uninstalling Wine can be done in 2 ways depending on your needs. If you only need to "Reset" Wine to the default values, you can simply delete the .wine folder and then create it again by running winecfg. If you have apps on the .wine folder that you wish to backup, now would be a good time before deleting the folder. To delete the folder simply do the following and it will take care of the whole Wine environment:


rm -fr ~/.wine
rm -fr ~/.cache/wine


Now if you want to actually uninstall Wine from Ubuntu, you can do the following, but note that this will NOT delete your .wine or cached folder:


sudo apt purge wine*


This would uninstall every package related to wine, including wine, wine1.9, winehq, winetricks and more. Basically removing anything related to wine.


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...