Linux Support: Difference between revisions

From Flashpoint Datahub
Jump to navigation Jump to search
(Add info about configuring Docker for Flashpoint more securely, and add a section on using the standalone projector. Discussed in the Discord)
m (Fixed wiki formatting)
Line 99: Line 99:
Start by creating a wrapper script for <code>docker</code> that will automatically use <code>sudo</code> when you are not invoking Docker as root. Name it <code>docker</code>, make it executable and place it on your <code>$PATH</code>:
Start by creating a wrapper script for <code>docker</code> that will automatically use <code>sudo</code> when you are not invoking Docker as root. Name it <code>docker</code>, make it executable and place it on your <code>$PATH</code>:


#!/usr/bin/env bash
<pre>
export PATH="${PATH/$(dirname "$0"):/}"
#!/usr/bin/env bash
askpass=()
export PATH="${PATH/$(dirname "$0"):/}"
if [[ -n "${SUDO_ASKPASS:-}" ]]; then
askpass=()
    askpass+=("-A")
if [[ -n "${SUDO_ASKPASS:-}" ]]; then
fi
    askpass+=("-A")
if [[ "$OSTYPE" != darwin* ]] && [[ "$EUID" != 0 ]]; then
fi
    exec sudo "${askpass[@]}" -E -- "$0" "$@"
if [[ "$OSTYPE" != darwin* ]] && [[ "$EUID" != 0 ]]; then
fi
    exec sudo "${askpass[@]}" -E -- "$0" "$@"
exec docker "$@"
fi
exec docker "$@"
</pre>


Then you need to create an askpass script for <code>sudo</code>. Create a script that will print your sudo password to stdout. For example, my script retrieves my password from my password manager, <code>pass</code>, which will force authentication through a graphical dialog before retrieving the password. Technically you could just hardcode your password in the script, but this would sort of defeat the point of trying to be more secure in the first place.
Then you need to create an askpass script for <code>sudo</code>. Create a script that will print your sudo password to stdout. For example, my script retrieves my password from my password manager, <code>pass</code>, which will force authentication through a graphical dialog before retrieving the password. Technically you could just hardcode your password in the script, but this would sort of defeat the point of trying to be more secure in the first place.

Revision as of 20:00, 20 May 2023

Linux support in Flashpoint is currently experimental due to a lack of maintainers. This page describes the current state of our Linux support. If you need assistance with installing or playing, visit us at #flashpoint-mac-linux-help.

As it stands, the Docker version of Flashpoint for Linux supports Flash, HTML5, Shockwave, Unity and Java. The exceptions are content that uses the Chromium browser, and Shockwave content that plays in-browser. If you want support for the other platforms that are Windows-exclusive, there are a few options to get the Windows version of Flashpoint running on Linux:

  • Download the Windows version of Flashpoint and run it in a Windows virtual machine. This is the recommended non-native option.
  • Run the Windows version of Flashpoint with Wine. This works well on some computers, but does not work consistently.

Otherwise, download the latest Docker Flashpoint package and install it.

Manual Installation

Dependencies

First, install Flashpoint's dependencies.

Dependency package names on various distros
Library/command name Docker PulseAudio* X11** XHost NSS PHP bash
Debian-likea (see this page) pulseaudio xserver-xorg-core x11-xserver-utils libnss3 php bash
Ubuntu-likeb (see this page) pulseaudio xserver-xorg-core x11-xserver-utils libnss3 php bash
Fedora-like (see this page) pulseaudio xorg-x11-server-Xorg xhost nss php bash
Arch-likec docker pulseaudio xorg-server xorg-xhost nss php bash

a : E.g. ChromeOS Terminal, MX Linux | b : E.g. Linux Mint, Pop!_OS, Zorin OS | c : E.g. Manjaro, SteamOS >=3.0

Note: Chances are that Docker and PHP will be the only packages that you'll need to install, as most distributions come with the rest of the packages already pre-installed.

* : PipeWire can also be used in place of PulseAudio by installing the pipewire-pulse package on Ubuntu-like and Arch-like distros, or pipewire-pulseaudio on Fedora-like distros. For Debian-like distros, see this link.

** : X11 can also be used within Wayland by installing the xwayland package on Debian-like and Ubuntu-like distros, xorg-x11-server-Xwayland on Fedora-like distros, or xorg-xwayland on Arch-like distros.


To install them, use your distro's package manager:

Distro Package manager install command
Debian-like sudo apt-get install {PACKAGE}
Ubuntu-like sudo apt-get install {PACKAGE}
Fedora-like sudo dnf install {PACKAGE}
Fedora-like (old) sudo yum install {PACKAGE}
Arch-like sudo pacman -S {PACKAGE}

Pre-Installation

Before you start, you need to configure Docker to be managed by a non-root user. Once finished, you may have to reboot your computer if the permissions aren't applied properly when trying to run Docker commands as a non-root user.

If you don't want to add your user to the docker group as above (e.g., for security: doing this allows all programs on your computer to have unrestricted administrator access to everything at all times) then there is an alternative, it just takes a bit more work.

Optional: Configuring non-root Flashpoint

Start by creating a wrapper script for docker that will automatically use sudo when you are not invoking Docker as root. Name it docker, make it executable and place it on your $PATH:

#!/usr/bin/env bash
export PATH="${PATH/$(dirname "$0"):/}"
askpass=()
if [[ -n "${SUDO_ASKPASS:-}" ]]; then
    askpass+=("-A")
fi
if [[ "$OSTYPE" != darwin* ]] && [[ "$EUID" != 0 ]]; then
    exec sudo "${askpass[@]}" -E -- "$0" "$@"
fi
exec docker "$@"

Then you need to create an askpass script for sudo. Create a script that will print your sudo password to stdout. For example, my script retrieves my password from my password manager, pass, which will force authentication through a graphical dialog before retrieving the password. Technically you could just hardcode your password in the script, but this would sort of defeat the point of trying to be more secure in the first place.

Now, you can simply export the SUDO_ASKPASS environment variable to the path of your askpass script (make sure it is executable), make sure that your docker wrapper is on $PATH, and invoke ./flashpoint as normal once you get to that step below.

Nvidia GPUs

If you have an Nvidia GPU and use a distro that isn't Arch-like, you will need to add Nvidia's repository and install the nvidia-docker2 package. Follow the "Setting up NVIDIA Container Toolkit" instructions under the heading corresponding to your distro here.

If you use an Arch-like distro, install either nvidia-container-toolkit or nvidia-docker from the AUR if you did or didn't already install Docker respectively.

In both cases, you may have to restart the Docker service or reboot your computer to apply the toolkit.

Installation

Download the latest Docker Flashpoint package if you haven't already and extract it somewhere.

Go to the place where you extracted it, and pull the docker images by running ./pull.sh. They'll take ~3.5 GB.

Finally, run the ./flashpoint executable script to start the launcher.


Config files can be found in ./LinuxConf/ and ./FPSoftware/FSPConfigs/.

Save data is stored in ./SaveData. Java save data isn't persistent, because there's no standardized location for it.

Troubleshooting

proxy.sh: "Permission denied" error

Depending on your system's permissions, the proxy.sh script may throw a "permission denied" error in the launcher logs when launching a game, causing it to fail to start. To fix this, follow these steps:

  1. Close the Flashpoint launcher.
  2. Open ./LinuxConf/proxy.sh in a text editor.
  3. Change /var/lock/flashpoint-networking.lock to /tmp/flashpoint-networking.lock and save the file.
  4. Relaunch Flashpoint.

cgroup subsystem devices not found: unknown

This error occurs most frequently on Pop!_OS 22.04, due to an outdated version of the Nvidia container runtime being packaged in the default repositories. If this applies to you, follow these steps:

  1. Close the Flashpoint launcher and stop the Docker service.
  2. Remove your current nvidia-docker2 package, then remove its dependencies and configuration files by typing sudo apt-get autoremove --purge in the terminal.
  3. Create a text file in /etc/apt/preferences.d with the following contents:
Package: *
Pin: origin nvidia.github.io
Pin-Priority: 1002

Then save the file, update the package index using sudo apt-get update, reinstall the package, start the Docker service again, and relaunch Flashpoint.

Technologies

Flashpoint Infinity, like its Windows counterpart, uses router.php as a proxy server. But unlike Windows, Linux provides native ways to set per-application proxy settings, so no equivalent to the Flashpoint Proxy library is used. On Linux, each application is simply told via environment variables to use localhost:22500 as a proxy server. For example, before Flashpoint Launcher opens the Flash projector, it sets the http_proxy environment variable to http://localhost:22500/ in the docker container.

The Flashpoint FAQ contains a list of all web game technologies ("Platforms") supported in the Windows version of Flashpoint. The Linux version currently supports a subset of these platforms. This is explained in detail below.

Supported Platforms

  • Flash: Supported through Wine by default. Although a Linux Flash Projector exists, it suffers from graphical glitches on many systems. If you'd like to try your luck with the native projector, then tick it as a 'Native Platform' on the Config page.
  • Shockwave: Supported through Wine.
  • HTML5: Supported natively through the Basilisk browser.
  • Java Applets: Supported natively using the Oracle JDK.
  • Unity Web Player: Supported through Pipelight.

Using the standalone projector

If you would like to run your own .swf file that is not packaged for Flashpoint, you can use the built-in Flash projector that is shipped with Flashpoint. Locate the Windows executable FPSoftware/Flash/flashplayer_32_sa.exe in the Flashpoint distribution you installed, and execute it with wine (you will have to install it separately, since Flashpoint on Linux invokes Wine through Docker). Make sure you have a 32-bit Wine installation. Pass the .swf file as a second argument to wine, after the .exe.

It's probably possible to use the native projector through the Docker setup, to avoid two separate Wine installations, but I haven't worked out how to do that quite yet.

Obviously, this only works for games that are using the Flash technology, and are single-file and not site-locked. Flashpoint exists because many games are not like this, and require extra work.

As an alternative to the standalone projector bundled with Flashpoint, you can use the Linux native projector, which can be downloaded from a previous version of the Adobe website here.