GithubHelp home page GithubHelp logo

ajokela / factorio-pi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mcrossen/factorio-pi

0.0 0.0 0.0 16 KB

instructions to run x86 gameservers, in particular 'factorio', on ARM processors like the raspberry pi.

License: MIT License

factorio-pi's Introduction

factorio-pi

These instructions can be used to run x86 programs on ARM architectures. For this example, I will be installing an x86 factorio headless server on a raspberry pi running raspbian, but the general method should be adjustable to work for any x86 program on any ARM architecture running linux.

WARNING running factorio server in this way is unstable and buggy and not ready for regular use. This guide is intended to be a mere proof of concept. My hope is that others will build and improve upon it.

problem

The factorio headless linux server is only available for x86 machines but the raspberry pi is ARM. To run on ARM processors, like the raspberry pi, virtualization is required. Emulators like qemu-user-static work great for running statically linked binaries on foreign machines but they don't include all dependancies needed to run dynamically linked executables. The latter problem can be solved through containerization.

instructions

First, we'll need to install some utilities. On your raspberry pi, open the 'terminal' application and run the following commands to install two packages. The first, systemd-container, is used to run containers on your pi. The second, qemu-user-static, is used to run foreign executables like the factorio headless server. The third, debootstrap, is used to download container images.

sudo apt update
sudo apt install systemd-container qemu-user-static qemu-utils debootstrap

We'll also need to download the factorio headless server executable itself and extract it.

wget https://www.factorio.com/get-download/stable/headless/linux64 -O ~/factorio-server.tar.xz
# or curl https://www.factorio.com/get-download/stable/headless/linux64 -L --output ~/factorio-server.tar.xz
tar -xJf ~/factorio-server.tar.xz -C ~/
rm ~/factorio-server.tar.xz
mkdir ~/factorio/saves/

You should now notice a new folder called 'factorio' in your home directory. This contains the config and executable to run the factorio headless server. You'll probably want to change your server's name, description, and password from the default. To do that, copy the configuration template and open the file in nano to customize whichever fields you want. Press 'ctrl-x', then 'y', then 'enter' to save and quit when you're done.

cp ~/factorio/data/server-settings.example.json ~/factorio/data/server-settings.json
nano ~/factorio/data/server-settings.json

You can try to run the server with ~/factorio/bin/x64/factorio. You should get an error like "No such file or directory". This means that you're missing the required x86-64 dependancies to run this dynamically linked executable. To fix that you'll need to download the dependancies as a container image with the following command.

sudo qemu-debootstrap --arch=amd64 stable ~/factorio-runtime/ --variant=buildd

This downloads a copy of the debian filesystem onto your pi along with all standard x86-64 libraries and dependancies. The second command copies the emulator into the file tree for use in the containerized environment. Feel free to use a different x86-64 image if you like. You can now run your factorio server inside this container.

sudo systemd-nspawn -D ~/factorio-runtime --bind=/home/$USER/factorio:/factorio /factorio/bin/x64/factorio --start-server-load-latest /factorio/saves/ --server-settings /factorio/data/server-settings.json

You can connect to your server in factorio using the ip address of your pi. For example, if your pi has ip address 10.0.0.2 then enter 10.0.0.2:34197 in the dialog box.

factorio-pi's People

Contributors

mcrossen avatar stargateur avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.