Steam for Linux

Steam for Linux

Headless Linux Client
hi,

This is more of a question for tools like steamcmd but I didn't found dedicated discussion for it.
First I would like to outline my current setup / problem.I have rather poor internet connection and updated that takes around 20GB of data to download takes a bit of time - this is problematic since I start PC when I want to play, and then whole downloading takes so much time that I do not have time for playing (now I know that people thought about in old meme about PS4 updates).In my 'home setup' I have a small linux box that is serving some web pages for my family and I thought about utilizing this linux box to resolve my problem.
I would like to start a Stream Client (connected to my account) that can automatically download updates for selected games, so when I start a PC 'for playing' and there is an update I could utilize full home network speed to obtain patches (not waiting for slow download through internet).
I could have My gaming machine turned on 24/7 with steam started and achieve this, but I would like to utilize this linux machine (as it is turned on all the time). Also using lightweight machine will give following benefits:
* Update could be downloaded through the whole night (time is no matter then)* Update could be downloaded at night time (not interfering with daily internet use).* Downloading will save some energy (as it will be downloaded on a light linux box using around 10W-30W instead of a gaming machine that takes around 100W idling).

Since this linux box is a really lightweight machine, there is no chance for running a full Steam Client through VM or Wine. Best way I see would be to have Steam Client running in some headless manner with games I play being downloaded on linux machine.

Does anyone make steam to work this way ?
< >
Showing 1-9 of 9 comments
DevaVictrix Dec 31, 2024 @ 5:42am 
To understand correctly, you’ve got a low powered rig that’s permanently turned ‘on’ and you want it to be able to automatically download updates so your gaming rig can play without waiting? Obviously, your games would need to be installed onto a shared volume

I think you can install games with steamcmd but I doubt it’ll update them automatically.

I managed to get steam working headless in a podman/docker container and accessible using either a browser or vnc. I didn’t test it much but it used about 1gb ram and next to no cpu time. The browser version (novnc) was more resource hungry than the straight vnc version but it's accessible from anything with a browser.

It isn’t a finished project but you can have the dockerfile if you want to try it.

Ultimately, the goal was to use it to install retroarch on my server so I could use steam remote play. I realised I wouldn’t have enough ram to pull it off so shelved the idea… often wondered if I should put it on GitHub though.

edit: whichever version I last built an image for uses about 600mb RAM whilst idle. This is using Xvfb, not novnc.
Last edited by DevaVictrix; Dec 31, 2024 @ 8:54am
Zyro Dec 31, 2024 @ 8:42am 
Originally posted by DevaVictrix:
To understand correctly, you’ve got a low powered rig that’s permanently turned ‘on’ and you want it to be able to automatically download updates so your gaming rig can play without waiting? Obviously, your games would need to be installed onto a shared volume

There's been added the feature of local copying of downloaded games lately, so that should work.

How low powered is the machine? I would also try to just use the actual Steam client. If it doesn't actually display anything, and is not interacted with, it might work just fine?

The question I'd have is if it would automatically download the games in time, because I often get update downloads scheduled for a later time.
Last edited by Zyro; Dec 31, 2024 @ 9:20am
grzegorz77 Dec 31, 2024 @ 9:37am 
I haven't tried it, but as Zyro wrote, a new option to download games from computers on the local network has been added.
And in the individual game options, you can set up instant updates.
Combined with the global night-only download setting, this should work.

As Zyro wrote, the Linux Steam client is relatively lightweight if you set low resource usage and low network bandwidth options.

I think you could also set up downloading games from your phone web browser. Or something similar, I've seen it somewhere.

If this computer is something like 43xx and 4 gb ram, I would install steam normally on linux that is there.
All in all, now I remember that I also used it on the 3110M, it was also sufficient.
Cray Dec 31, 2024 @ 11:27am 
Could use xpra, which lets you start a specific application on a remote machine and display it on another, over the network, keeping it running after you disconnect. Since it can skip starting a full desktop, just launches the app, it may be lightweight enough.

https://xpra.org/index.html

Related, not exactly what you're looking for, but perhaps it can be useful:

https://arstechnica.com/gaming/2017/01/building-a-local-steam-caching-server-to-ease-the-bandwidth-blues/

ps: Discovered just earlier today that steam has a bit of a memory handling bug that may affect your particular use case.
It tends to leave files behind in /dev/shm (shared memory folder) and doesn't clean them up after exiting, then creates new ones when you restart it, etc. If your system is already light on ram it could end up depleting it. The files are named 'u1000-Shm_xxxxx'-something, where I believe '1000' is your os/system user id. You can clean it up automatically when steam exits by launching steam with a script like this:

'''
#!/bin/bash
steam
rm /dev/shm/u$UID-Shm_*
rm /dev/shm/u$UID-ValveIPCSharedObj-Steam
'''

Note: that's a "works for me" solution with the caveat of assuming nothing else creates files with that particular naming pattern in there. Never seen anything else do that, but just beware.
Originally posted by DevaVictrix:
To understand correctly, you’ve got a low powered rig that’s permanently turned ‘on’ and you want it to be able to automatically download updates so your gaming rig can play without waiting?

Yes that is the idea. And then use home LAN to redistribute game to other PC.

Originally posted by DevaVictrix:
Obviously, your games would need to be installed onto a shared volume

No. Steam recenty added this feature, that is some Steam in Your LAN have already game You are downloading, then it stream from that PC from LAN, not from internet. It works pretty good, and I want to take it to next level.

Originally posted by DevaVictrix:
I think you can install games with steamcmd but I doubt it’ll update them automatically.
Nope. steamcmd (as far as I know) does not support 'always online updates'.

Originally posted by DevaVictrix:
I managed to get steam working headless in a podman/docker container and accessible using either a browser or vnc. I didn’t test it much but it used about 1gb ram and next to no cpu time. (...)

I will test it - this might be some solution - if resource usage is low.
Originally posted by Zyro:
How low powered is the machine? I would also try to just use the actual Steam client. If it doesn't actually display anything, and is not interacted with, it might work just fine?

Old ThinkCenter Tiny with i3 and 8GB ram. For My current usage is more than enough - with full Steam Client + VM it might not be enough.

Originally posted by Zyro:
The question I'd have is if it would automatically download the games in time, because I often get update downloads scheduled for a later time.
Originally posted by grzegorz77:
And in the individual game options, you can set up instant updates.

Ok good to know. But I will verify it :)

Combined with the global night-only download setting, this should work.

Originally posted by grzegorz77:
As Zyro wrote, the Linux Steam client is relatively lightweight if you set low resource usage and low network bandwidth options.

I will check this with the approach that Zyro mentioned (X with Steam Client in docker). I just hope that It will allow me to download Windows versions of games under Linux (I think with this Steam Play it might be possible).


Originally posted by grzegorz77:
I think you could also set up downloading games from your phone web browser. Or something similar, I've seen it somewhere.[/quore]

I think the Steam Client on Mobile allow to schedule downloads on PC. I think I tried it once - but I would like to have it on auto :)
What gpu do you have in the machine you want it to run headless on? I’ll strip it down tomorrow and try to give you something a bit more universal… the image is setup for my particular machine.

It’s only because as steam installs it chucks out errors related to… lots of things!


Edit: forget that above… I don’t think it matters now. The problem is storage.



I still don’t understand where you are storing the games. You can’t update a game that’s stored and played from a computer that’s turned off. They’d need shared storage (in the case of the headless steam - a container volume) that’s always ‘on’… ie, NAS, which is slow unless you have 10g networking.

I guess you could install all your games on the headless steam and direct your gaming rig steam to the container volume (probably the best way) but you’re still limited to network transfer speeds.

I haven’t played with the stream feature but it sounds like it’s just that - streaming gameplay. Like remote play.
Last edited by DevaVictrix; Jan 4 @ 5:27pm
As a starter try... (just run it from any Linux terminal)

sudo docker run --ipc host --interactive --tty --detach --publish 6080:6080 --name steam -v x:/home/steam/ koxt2/steam-headless-novnc

You'll need to create a directory and make it writable and executable for everyone, then replace 'x' with the path to that directory (without a succeeding /).

ie,
sudo mkdir /home/server/steam
sudo chmod 777 /home/server/steam

It's simply the directory/volume that the container uses for storage. Strictly speaking, you don't need that volume but as soon as you delete the container everything will be gone. My server updates daily, and on restart deletes all my containers so a volume is almost always needed/recommended.

I'll add a second volume to the image for game installs tomorrow but as I mentioned in my post above, for it to work you'll need to make game installs accessible even if your gaming rig is turned off. I can't see how it can be done any other way.

You will get Steam accessible from a browser at localhost:6080

You can obviously change the port number from 6080 if you need to.

Once it's up and running don't close the client. If you do you will have to delete the container to get the client to display again. I don't know why. Steam still runs after stopping and starting the container but if you close the 'window' (there isn't even a window manger in this container) it doesn't display. It's no biggy, your volume won't be touched.

I don't know what happens if the steam client needs to update. If it stops working just delete the container and image and run the command again. Any updates will be applied because you are reinstalling Steam/starting over from scratch - like an OS reinstall.

##########
Obviously, you need to login to steam and you don't know if I'm some sort of badass that's stealing your steam credentials! I've added the dockerfile to dockerhub so if you want to build the image and run it locally (as opposed to pulling from dockerhub) you can. I ALWAYS do this for containers that are created by random people. Let me know if you want me to tell you how. The dockerfile is simple (this whole project is simple), you'll read through it easily it if you can use Linux.
##########

https://hub.docker.com/r/koxt2/steam-headless-novnc

Personally, I use podman. It's a topic for another day but it's simply better and runs rootless so 'sudo' isn't needed. Podman is also best run using quadlet so all containers get deleted on each reboot. It's just better, imo. Enterprise Linux works this way, the rest of the world are stuck in the past with docker!

edit: the formatting of the dockerfile is screwed up... it's 3:30am. I'll fix that tomorrow too!

I'll add the vnc version tomorrow too. It's lighter on resources.
Last edited by DevaVictrix; Jan 14 @ 3:53pm
Cray Jan 5 @ 8:20am 
Regarding storage:

Mounted a drive from a different PC with SSHFS over 1gbit ethernet and added it as a steam library folder, it works just fine. Slower loads etc. of course, but I could cruise around town in Saints Row 3 with it.

Obviously it'd be better to use rsync or something and have local copies, but.. it works :D
< >
Showing 1-9 of 9 comments
Per page: 1530 50