ptitSeb / box86

Box86 - Linux Userspace x86 Emulator with a twist, targeted at ARM Linux devices
https://box86.org
MIT License
3.3k stars 227 forks source link

Team fortress 2 server on box86 #133

Closed tmvkrpxl0 closed 4 years ago

tmvkrpxl0 commented 4 years ago

Recently, i decided to move my tf2 server to rpi. and i successfully moved by using chroot and qemu however, it was too slow that i decided to use box86 instead Since steamcmd, srcds, ect.. are already installed using chroot and qemu method, i only just need to run. but this gives me unknowns errors and library missing error, server seems to be started regardless errors, but it shuts down itself just because some operation took so long weird thing is, it even took long when using chroot and qemu method and it started properly. Log: https://hastebin.com/ejobisoxuc.sql

tmvkrpxl0 commented 4 years ago

note that metamod and source mod installed, and arguments i used is this: BOX86_LD_LIBRARY_PATH="/home/steam/chroot-stretch-i386/home/pi/tf2Server/bin:/home/steam/chroot-stretch-i386/usr/lib:/home/steam/chroot-stretch-i386/lib/i386-linux-gnu:/home/steam/chroot-stretch-i386/home/pi/linux32:/home/steam/chroot-strecth-i386/home/pi/linux64:/home/steam/chroot-stretch-i386/usr/lib/i386-linux-gnu" box86 srcds_linux -game tf -num_edicts 8192 +map mvm_ma_ep1_3 +maxplayers 32 +sv_lan 0 +r_hunkalloclightmaps 0

ptitSeb commented 4 years ago

I think this is caused by the fact the server use libncurses.so and not libncursesw.so. Add this export to your command line: BOX86_EMULATED_LIBS=libtsinfo.so.5 to use emulated tsinfo. I'll add support for wrapped libncurses.so.5 later.

tmvkrpxl0 commented 4 years ago

I think this is caused by the fact the server use libncurses.so and not libncursesw.so. Add this export to your command line: BOX86_EMULATED_LIBS=libtsinfo.so.5 to use emulated tsinfo. I'll add support for wrapped libncurses.so.5 later.

Thanks for the reply. I added it but it still shuts down itself with same reason. Log: https://hastebin.com/nepesutoma.sql Should i install debugger in order to see what's problem?

tmvkrpxl0 commented 4 years ago

bump

ptitSeb commented 4 years ago

There was a typo, it's in fact BOX86_EMULATED_LIBS=libtinfo.so.5 Also, be sure to update box86, I have fixed some issue that could have caused the hand you are experiancing (becasue the watchdog needs to kick in).

tmvkrpxl0 commented 4 years ago

There was a typo, it's in fact BOX86_EMULATED_LIBS=libtinfo.so.5 Also, be sure to update box86, I have fixed some issue that could have caused the hand you are experiancing (becasue the watchdog needs to kick in).

I did what you said, but it seems the issue isn't changed except i don't get libtinfo.so.5 error. I think i should use debugger to give you more information Also, the log i sent you is inaccessible, so i'll send you again with txt file to avoid being inaccessible log.txt

ptitSeb commented 4 years ago

I'm unsure what you want to debug.

My understanding is that the server is killed by the wtachdog because it take too long to load:

WatchDog! Server took too long to process (probably infinite loop).
Host_Error: WatchdogHandler called - server exiting.

Not sure if the wtachdog delay is parametrable somewhere, and how long it does wait. You can try to use BOX86_LOG=2 BOX86_TRACE_FILE=trace.txt to generate detailled log of every functions called, adn redirect all output to trace.txt. Be warned, the trace.txt will be very big I assume. I'm interrested in the end at first.

tmvkrpxl0 commented 4 years ago

I added -nowatchdog to server and it seems started up, however, unlike i ran my server on chroot and qemu method, server does not load any plugin and crashes when i join & choose class. I couldn't get log, because server was spamming this-> 1741|SIGSEGV @0xb6db58c8, for accessing 0xbe0b68ea (code=1) log before i join my server is mostly same as not adding -nowatchdog

tmvkrpxl0 commented 4 years ago

I tried using BOX86_LOG=2 BOX86_TRACE_FILE=trace.txt but this makes the server extremely slow and server won't even start after 15 minute. I tried using BOX86_LOG=1 BOX86_TRACE_FILE=trace.txt and i got this

https://drive.google.com/file/d/1Jf1LkDgI0YkvD2Uyz4oIvjE6TY9ZvEyN/view?usp=sharing

ptitSeb commented 4 years ago

I need to debug it myself. I don't know when I'll do that, maybe this weekend.

tmvkrpxl0 commented 4 years ago

Thanks, i appreciate your effort on this project

tmvkrpxl0 commented 4 years ago

Recently i discovered that Steam cmd also installs some i386 libraries, so i included them and the server starts well, I haven't tested various maps and metamod/sourcemod, but it's working, at least. The problem is, it lags when there are too many bots or too many objects, which is my server's main content.(It's called mvm, I'm not sure if you know this). I'm worried that I'll need to buy Atomic pi for this. Could you tell me if box86 is capable of operation that requires cpu performance but no gpu performance? note that server only uses about 500MB(Tested on my PC), and my Raspberry pi model is Raspberry pi 4B 4GB

ptitSeb commented 4 years ago

Ok good it works.

Now, about performances, box86 can do some cpu intensive works, but keep in mind thta arm->x86 conversion has a cost. I don't if you overclocked your pi, but with some active cooling, you can go easily to 2.0GHz, wich could be usefull for you.

Also, make a run with BOX86_DYNAREC_LOG=1 to check if there are some missing opcodes in the dynarec. Check also the overall CPU work: is it 100% well it's lagging or not. Because maybe the issue is with I/O or Network or something else if it's not 100%.

(one question, is box86 faster than your first attempt with qemu?)

tmvkrpxl0 commented 4 years ago

I did full overclock with cooling, but it's only bit faster than without it. I used htop command and saw CPU usage. box86 process uses more than 100. but only one of the CPUs loads 100%. rest of them are mostly less than 5% About networking, it's wired connection and my house's internet isn't slow I also used ping command(in-game command) and it shows 48ms, but it shows 100ms when it's lagging.

tmvkrpxl0 commented 4 years ago

Quick update: I used BOX86_DYNAREC_LOG=1 and it shows

0xabdc1ee9: Dynarec stopped because of Opcode 66 0F 3A DF C8 00 66
0xabdc1ee9: Dynarec stopped because of Opcode 66 0F 3A DF C8 00 66
0xabdc3484: Dynarec stopped because of Opcode 66 0F 38 DC E0 66 0F

right after server is started

tmvkrpxl0 commented 4 years ago

trace.txt I also found some minor problems, i hear no voice messages from other players. and both steamcmd and srcds doesn't shutdown even if i typed exit, it stops after exit sequence that is included in program

ptitSeb commented 4 years ago

About the cpu load, does runing on x86 linux shows a different profile, with work load on all cpu core?

tmvkrpxl0 commented 4 years ago

It uses 2~4 cpu on raspberry pi when i checked on htop, but it still uses only 1 cpu if i look only cpu usages

tmvkrpxl0 commented 4 years ago

Unfortunately i don't have x86 linux machine, i just tested on my main pc(amd64) It seems it uses 4 cpus, but i don't know individual cpu usage.

tmvkrpxl0 commented 4 years ago

I have discovered that the servers(aka srcds)are to use 1 core. so this isn't box86 problem. sorry for bothering you for this.