An issue I had recently was that I wanted to run GraphicsGale, which is an application for Windows, on Linux, so I installed Bottles, which is an application just for that, but after setting it up, GraphicsGale did not run, more specifically, it crashed on start up.
I tested various applications. Some of them showed forbidden access errors, others seemed to be unable to find files or folders they needed to work. All of these files and folders were contained within their application directory, so it was really weird to me. It would make sense if the access error was for trying to access something in my home directory, but trying to access the application's own files? That shouldn't give an error.
On the Internet, some said it could be an installation issue that made some files owned by root. This wasn't the case here. This wasn't the case here, I owned the files and the application run through Bottles couldn't access it anyway.
A hint was the filepath of the files it failed to access, which I could see only by specifically running the graphical application from a terminal from Bottles. The filepath started with /run/user/1000/doc/
, which isn't where I put the .exe
file. I even tried specifying the current working directory in Bottles, but that didn't work. In that directory, indeed, you couldn't find any of the other files that the .exe
needed to run, which is why it wasn't working.
The Problem
Linux Mint only provides the flatpak version of Bottles, which sounds fine if you have no idea what that means. Flatpak is a way to containerize applications that is "secure" and not intuitive at all because no effort seems to have been made into making them so.
None of the Linux systems I've used bothered to explain me what is a flatpak with a dialog box, so I expect new Linux users first contact with the term is always going to be trying to fix "cross platform" applications made in Linux which worked on Windows flawlessly but ironically won't work properly on Linux by default because they're flatpaks.
By default, a flatpak doesn't have permission to access any files others than the one you specify. This should help prevent, for example, a case in which Steam accidentally ran rm -rf /*
as root1, which deleted the user's entire file system. That's right. All files gone. Then again, maybe you don't need flatpak for this, maybe you just need to not run things as root, or a more flexible permission system that lets you isolate your files into groups according to what applications should be able to access them.
In any case, the way flatpak allows applications to access files is this:
First, if the flatpak doesn't have access to files, and you use a file picker, the file will be copied to a temporary location which that flatpak application has access to. This is what happens with Bottles. When you create a new shortcut, a file picker appears and you select the .exe
. This .exe
is copied, ALONE, to the temporary directory, so it can't find any of the application files it needs to actually run.
Surely there could be many, many, many ways to inform the user of a flatpak version that what they're doing isn't going to work, preventing dozens of Linux users from having to look up why nothing works on Linux? A simple message dialog box warning about it could have saved everyone the trouble! It could have saved me from writing this article as well.
Second, there is a way to configure a flatpak so that it has access to files, which is what you need to do in order to fix this issue.
How to Fix
In order to fix the problem of Bottles not having access to other files of the .exe
, we need to give the flatpak access to the .exe
's whole folder. If you have many windows applications, I suggest placing all of them in a single directory, like /opt/my-windows-apps/
, so you can just give permission for Bottles to access everything in /opt/my-windows-apps/
and never have to worry about it again.
sudo mkdir /opt/my-windows-apps/
sudo chown $USER:$USER /opt/my-windows-apps/
To give permission: you need to install Flatseal. Flatseal is an application that lets you configure the permissions of flatpaks. For SOME REASON, even though you can install flatpaks from the Software Manager, and they need something like Flatseal to work properly, there is just no information about it in the Software Manager application, nor does Flatseal come installed by default in Linux Mint. Then:
1: after installing Flatseal, open it. There will be a list-detail interface with a list of applications.
2: click on Bottles on the applications list.
3: in the Filesystem section, in Other files, click the folder with a plus icon and add your application's folder. Or just add /opt/my-windows-apps/
and place all your apps there.
Fixing Shortcuts
After fix the flatpak settings through flatseal, you need to remove all the shortcuts you created in Bottles before doing this, because those shortcuts will still point to the temporary file location.
1: in Bottles, delete all the shortcuts you created that didn't work (e.g. to GraphicsGale).
2: create them again. Now they should run properly.
If an error occurs, then you have other problems. I'm sorry but I can't help you.
References
- https://github.com/ValveSoftware/steam-for-linux/issues/3671 (accessed 2024-09-05) ↩︎
Leave a Reply