Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Should I start a "by mail" game server config service?  (Read 1559 times)

wierd

  • Bay Watcher
  • I like to eat small children.
    • View Profile
Should I start a "by mail" game server config service?
« on: December 15, 2016, 05:33:29 am »

I recently made a post in Life Advice, given the number of tech-help threads in there, about starting a "by mail" service to repurpose old pieces of network hardware to function as dedicated game host appliances, and was suggested that I ask here-- here's the text from the other post.

-----------
I don't know if any of you are old enough to remember old classic computers, or the communities they created, but a staple if those communities as they still exist today revolves around floppy diskette image dumping, and by-mail services to do the imaging. Basically, the floppies and an sdcard are mailed to the person who still has a working disk drive, they dump all the disks to image files saved on the sdcard, and mails them back to the sender.

These services are typically done for free, and without warranty, but are a staple in such communities.

Recently, a thread about hosting a game server for Minecraft that came up.  That got me wondering.

How many of our forum users play networked games, and how many would like convenient settop server boxes, and if those, how many would make use of a by-mail service to repurpose old routers and NAS boxes? I know how to set up chroot sandboxes on these devices so that they can run game server daemons along side whatever the appliance normally does, and even how to get these chroots to auto update themselves.

Just about any network or internet game that has a Linux daemon available can be run this way, as long as min reqs are met.

I could hunt down a list of Linux daemons, and cobble together a list of compliant devices, and offer the service, if there was a want for it.

Do you guys think there is enough demand to make it worthwhile, and or, do you think it is a good idea?

I have no interest in other peoples networks or data, I just know how to make those old routers I see at garage sales do useful things, and would be willing to hook people up.

----------
Logged

Parsely

  • Bay Watcher
    • View Profile
    • My games!
Re: Should I start a "by mail" game server config service?
« Reply #1 on: December 15, 2016, 11:52:33 am »

I just finished my Linux admin cert yesterday, so I'd be more interested in learning how to do that myself.
Logged

George_Chickens

  • Bay Watcher
  • Ghosts are stored in the balls.
    • View Profile
Re: Should I start a "by mail" game server config service?
« Reply #2 on: December 15, 2016, 11:54:57 am »

That would be a super cool service, but I'm afraid I can't comment, as my location means I probably will never be able to use it.
Logged
Ghosts are stored in the balls?[/quote]
also George_Chickens quit fucking my sister

Shadowlord

  • Bay Watcher
    • View Profile
Re: Should I start a "by mail" game server config service?
« Reply #3 on: December 15, 2016, 12:13:34 pm »

I don't understand what the first thing you talked about has to do with the second thing you talked about.  :-\
Logged
<Dakkan> There are human laws, and then there are laws of physics. I don't bike in the city because of the second.
Dwarf Fortress Map Archive

wierd

  • Bay Watcher
  • I like to eat small children.
    • View Profile
Re: Should I start a "by mail" game server config service?
« Reply #4 on: December 15, 2016, 03:25:41 pm »


Re: Dont understand how the two things are similar

Situation 1) A person has a thing, or skill that another person does not (Dump a diskette to an image file, for emulation), but needs to have done in order to play a game they want. (because the game is on a moldering old diskette they cannot read anymore)

Situation 2) A person has a thing or skill that another person does not (Knows how to configure a small lowpower dedicated machine to make it run as a dedicated game server), but needs to have done in order to play a game they want. (because they need a game server running to play a game, but dont have a lot of space or money to invest in hiring or powering one.)


Re: How to do it

It's pretty simple.  You can often SSH into these boxes, and they typically have a linux kernel running. Just get the outputs of

cat /proc/cpuinfo
cat /proc/swaps
free
chroot

which will tell you how much free memory there is, if swap is enabled and how much, and what the CPU flavor is (and how fast in useless bogomips). running chroot with no parameters lets you know if the busybox install has chroot applet baked in. If it does, all is golden.

After that, I use a minimal debian userspace chroot, downloaded on a different linux machine that has access to a package manager. (The network appliance does not have the toolchain, and likely has only a minimal busybox installed.)  You do that with debootstrap using the --foreign flag.

debootstrap is an old 'network installation bootstrapper' that is GREAT for creating the initial chroot environment.  The --foreign flag tells debootstap that you are downloading packages for an architecture that is different than the one you are running on. It enables the use of the --arch flag, where you get to specify the architecture.

In the case of my western digital mycloud nas (my current toy I am playing with), the architecture is armhf, because cpuinfo reports vfp and vfpv3, meaning the chip has an fpu baked in, and the kernel supports it.  so, I used this on my workstation:

debootstrap --foreign --arch armhf ~/mycloud_chroot jessie http://ftp.debian.org/debian

That tells debootstrap that I am downloading for foriegn architecture (dont do the config stage, just download packages), the architecture is armhf, where I want the files stored, what branch, (in this case, jessie), and what server to contact with the package manager to get packages. One of the useful features of doing it this way, is that a binary for debootstrap is put in a folder in the resulting new root filesystem in a folder called debootstrap. This allows you to continue the process on systems that lack the command, and have no access to a package manager to get it.

It will then download all the packages needed for a very bare-bones, console only userspace for Debian Jessie on that architecture.

Once it is done, you use scp or whatever sftp transfer tool you want to copy the chroot folder to the device's long term storage. (for routers, I suggest putting a USB thumb drive on, and using that.) Once there, we switch to the device's console, and do the following:

(Mount /dev /proc and /sys for the chroot)

mount -o bind /dev /home/(Path to the chroot folder you sftp'd in)/dev
mount -t sysfs none /home/(path to chroot)/sys
mount -t proc none /home/(path to chroot)/proc

(then enter the chroot and continue setup with debootstrap by running the config stage using the --second-stage flag.)

chroot /(path to chroot) /bin/bash
cd debootstrap
./debootstrap --second-stage

This will run all the config scripts.  It is normal for the chroot prompt to report "I have no name!" in the prompt. this is because the root user has not been properly set up. You cannot do that until AFTER debootstrap has been invoked to configure the base system and give you access to the basic toolkit.  Once it is done, use su to switch to the root user, (you might need to use adduser to create it) then use passwd to set the root password. exit the chroot, then re-enter it again. All will be well after that.

Once you are back in the chroot again, you should now have access to nano, and a few other goodies. Take the time to configure the /etc/apt/sources.list so that it looks sensible to you, then issue an apt-get update to get an up to date package list.  Then install whatever packages into the chroot you want with apt-get install method.

Once you have the packages installed you want, now it is time to make some old school init scripts.  The chroot comes alive after the system has gone through the kernel init, and the system is already running, so normal init systems wont work. You have to cobble together something similar to sysvinit initscripts, like an /etc/init.rc, which takes care of starting server daemons, getting chron running, etc.  Once you have that written, exit the chroot, and enter it again, but instead of invoking /bin/bash to land in a shell, we want to invoke our new init script.

chroot /home/(path to chroot) /etc/init.rc

This will give us a test-run of our system coming up.  I suggest re-mounting /proc and /sys again in the init script, because sometimes they lose the magic when entering the chroot. Dont know why. They just do. Same with /dev/pts for some reason.

You can invoke another instance of sshd to run inside the chroot using this init script, and I highly encourage it, just run it on a different port.  This will let you ssh into the chroot as if it were the real root from your workstation after the system has run its init script.

Once you are sure the chroot is ready for actual use, we need to have a way to execute it on startup of the embedded device. This is where it gets device specific.

On routers, almost all have the source-tree for the firmware image available online. This will let you build a new flashable image that contains a modified init script that calls a script on the external storage. If the call fails, it does not harm the router, it just does not launch the chroot. If it succeeds, it starts the chroot automatically. We can even have this fail gracefully with a check for existence. Either way, the change is harmless, but needs a full rebuild of the image from source. It takes time and is annoying, but necessary.

For things like a NAS, that have native access to permanent storage, we can abuse one of the chron jobs executed at startup to invoke our chroot's startup on the last leg of boot, and add a trap to prevent it being executed a bazillion times by chron in the script. (write a dummy file to /tmp using touch, and if the file exists, do nothing-- otherwise, create dummy file then invoke the chroot. That kind of thing. Every time the job runs after that, it will do a check, see the file in /tmp, do nothing, and end)

The chroot's fake root file system will act just like a real root filesystem to whatever userspace toolchains and packages you see fit to pull from the package repo. You can even set up a vnc server and run a GUI if you really really want to. (I dont see a need. the console is good enough)

Once you have it set up, you can set up and use any game daemon you want, using the normal linux installation procedures.

Because there are lots of steps involving creating init scripts, and abusing chron jobs or recompiling sources for flashable images to have an init hook, this isnt something most users would feel comfortable doing themselves, hence the idea of doing it as a service for free by mail.

You send in a box you want to putter around with, I set up a suitable chroot on it, put a sticky note on top saying what port and default root password I configured the chroot's sshd with, and mail it back.  You get it in the mail, power it up, log in with ssh, change the password to whatever the hell you want, and off you go.


If you dont like debian, you can use any of the "based on debian" distros instead, like ubuntu.  Just substitute an ubuntu mirror and version identifier instead of the debian ones when invoking debootstrap.


Logged

Parsely

  • Bay Watcher
    • View Profile
    • My games!
Re: Should I start a "by mail" game server config service?
« Reply #5 on: December 15, 2016, 03:44:01 pm »

Thanks for the guide! Saved it to a text file. Speaking as a Linux noob, while this doesn't sound easy per se, it seems like something I could figure out with a few days of tinkering. Definitely a service worth providing as most people don't have Linux machines or the knowhow to mess with filesystems in BASH shell. I approve.
Logged

IWishIWereSarah

  • Bay Watcher
    • View Profile
Re: Should I start a "by mail" game server config service?
« Reply #6 on: December 16, 2016, 01:56:54 am »

Wierd, I think the main problem with what you propose is that your potential customers won't go for it :
It seems to be based around cheap solutions for (game) servers.

Let's take an example : minecraft server.

I could want to have a minecraft server for me and my friends. And I could ask you to create and mail me one. And It would at least cost as much as the physical server costs.
Or I could rent one online. And there are offers for less than $5 per month.
Medium- or long-term, it would obviously be cheaper to order you a box, but the customers you aim your service at are specifically those who would go for a cheap, low-power solution. Then the fact that it would be cheaper to simply rent for a year matters.



EDIT : didn't see you last replay, wierd. Can't read it right now. Not sure it still applies :)
« Last Edit: December 16, 2016, 02:00:13 am by IWishIWereSarah »
Logged

wierd

  • Bay Watcher
  • I like to eat small children.
    • View Profile
Re: Should I start a "by mail" game server config service?
« Reply #7 on: December 16, 2016, 05:10:57 am »

Minecraft server requires more oomph than a NAS can supply.  I can make it "run", but you will NOT find it desirable.
It needs a 2 to 3ghz processor, and several gigabytes of ram to run. (I  blame the overhead of the java virtual machine it runs in. Java adds hundreds of megabytes of memory overhead just to run "hello world." True story.)

Unless you want to send me something more powerful than a raspberry pi (Some of the recent intel offerings have pretty sporty atom cpus in them, with fair amounts of ram that might work) I am afraid a cheap minecraft server mod is out of the question.

For other things, like a team fortress server or gmod server, pvpgn for old westwood and blizzard titles, or an open tibia/evol server,  this kind of thing works a treat through.

The intended audience is for people that score a 5$ router, or a 20$ NAS box at a garage sale, and want it to do something neat for them.

Not a "Hey, I buy all the stuff, set it up, and mail it to you." kind of service.

More the "Hey, I scored this interesting but currently useless obsolete appliance, can you make it do something for me?" kind of service.
Logged