problems with box86 using direct path on raspberry pi


zerschranzer

Newbie
Joined
Sep 23, 2020
Messages
5
Hi there. If i try to start ts3 server with box86 on a raspberry pi it works verry well, but just if i am in the directory. The directory name is "Teamspeakserver". so i do "box86 ts3server" and the server starts, and works great.
But if i try to start the server while not in the "teamspeakserver" directory, it gives me an error. i´ve tried this :

box86 teamspeakserver/ts3server

this results in:

Dynarec for ARM, with extension: HALF FAST_MULT EDSP NEON VFPv4 IDIVA PageSize:4096
Using default BOX86_LD_LIBRARY_PATH: ./:lib/:lib32/:x86/
Using default BOX86_PATH: ./:bin/
Counted 24 Env var
Looking for teamspeakserver/ts3server
Error loading needed lib: "libts3_ssh.so"
Error: loading needed libs in elf teamspeakserver/ts3server

i dont understand why he cant load the libs, if im not in the teamspeak server directory. you got any soltuion for this ? :) im verry new to this linux stuff but try my best to learn it! i would be verry happy for some help!
 

ptitSeb

Serial Porter
Joined
Aug 15, 2012
Messages
9,272
Age
50
Location
France, near Lyon
That's because box86 automaticaly tries to load library from current folder, and "lib", "lib32" and "x86" folder (if they exist) also from current folder. It will also search libs on folders defined in the standard LD_LIBRARY_PATH variable and also from BOX86_LD_LIBRARY_PATH variable. Plus some special folder if defined in the binary itself (like RPATH).

If you want to launch ts3 from elsewhere, you can do that (for you example):

BOX86_LD_LIBRARY_PATH=teamspeakserver box86 teamspeakserver /ts3server
 

zerschranzer

Newbie
Joined
Sep 23, 2020
Messages
5
thank you verry mutch! now im able to set a cron job to autostart the server on reboot!

edit:

seems like that solved the problem, but results in an other one .... xD


BOX86_LD_LIBRARY_PATH=teamspeakserver box86 teamspeakserver/ts3server license_accepted=1


Dynarec for ARM, with extension: HALF FAST_MULT EDSP NEON VFPv4 IDIVA PageSize:4096
BOX86_LD_LIBRARY_PATH: teamspeakserver/
Using default BOX86_PATH: ./:bin/
Counted 23 Env var
Looking for teamspeakserver/ts3server
argv[1]="license_accepted=1"
Using emulated teamspeakserver/libts3_ssh.so
Using native(wrapped) librt.so.1
Using native(wrapped) libpthread.so.0
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux.so.2
Using native(wrapped) libdl.so.2
Using native(wrapped) libm.so.6
Using emulated /usr/lib/i386-linux-gnu/libstdc++.so.6
Using emulated /usr/lib/i386-linux-gnu/libgcc_s.so.1
Warning, CPUID command C0000000 unsupported (ECX=08d8b588)
2020-09-23 22:26:49.755069|INFO |ServerLibPriv | |TeamSpeak 3 Server 3.12.1 (2020-03-27 10:38:47)
2020-09-23 22:26:49.760771|INFO |ServerLibPriv | |SystemInformation: Linux 5.4.51-v7l+ #1333 SMP Mon Aug 10 16:51:40 BST 2020 i686 Binary: 32bit
Using emulated teamspeakserver/libts3db_sqlite3.so
2020-09-23 22:26:49.784815|INFO |DatabaseQuery | |dbPlugin name: SQLite3 plugin, Version 3, (c)TeamSpeak Systems GmbH
2020-09-23 22:26:49.785104|INFO |DatabaseQuery | |dbPlugin version: 3.11.1
2020-09-23 22:26:49.802037|INFO |DatabaseQuery | |checking database integrity (may take a while)
2020-09-23 22:26:49.866106|CRITICAL|DatabaseQuery | |setSQLfromFile( file:create_sqlite//create_tables.sql) failed




also it looks like that it cant find the license file if i start the server elsewhere, so i have to start it with argument "license_accepted=1". i guess that means he just loads the libraries, but not the files like configs to work with. is that right ? if so, is there a way to load all files in the directory so box86 can work with it ?
 
Last edited:

FBnil

They'll own everything and be miserable.
Joined
Dec 14, 2012
Messages
5,051
Location
Yurp
Can't you use "cd" in the crontab?

Code:
@reboot sleep 60 && cd /home/user/teamspeakserver &&  box86 teamspeakserver/ts3server license_accepted=1

This will, on reboot, wait 60 seconds just in case other services are not started yet, then cd into teamspeakserver and THEN run ts3server.

Addendum: you also might want to write the output to a file, by appending the following:
Code:
>>/tmp/ts3server.log 2>>/tmp/ts3server.err

Also note that some programs behave differently depending if used in a terminal or not. Not only due to the program, but also due to having less environment variables, like PATH being minimal.
 
Last edited:

zerschranzer

Newbie
Joined
Sep 23, 2020
Messages
5
Can't you use "cd" in the crontab?

Code:
@reboot sleep 60 && cd /home/user/teamspeakserver &&  box86 teamspeakserver/ts3server license_accepted=1

This will, on reboot, wait 60 seconds just in case other services are not started yet, then cd into teamspeakserver and THEN run ts3server.

Addendum: you also might want to write the output to a file, by appending the following:
Code:
>>/tmp/ts3server.log 2>>/tmp/ts3server.err

Also note that some programs behave differently depending if used in a terminal or not. Not only due to the program, but also due to having less environment variables, like PATH being minimal.

First, thanks for your answer :)

I've tried it with this line in crontab :
Code:
@reboot sleep 60 && cd /home/pi/teamspeakserver && screen -d -m box86 ts3server

But there is no effect. No working server, or screen session :(

If i understood it right, the command
Code:
@reboot sleep 60 && cd /home/pi/teamspeakserver && screen -d -m box86 ts3server >>/tmp/ts3server.log 2>>/tmp/ts3server.err
should print log files in tmp directory. The files are there, but they are empty. 0 byte.

Dunno what im doing wrong here
 
Last edited:

zerschranzer

Newbie
Joined
Sep 23, 2020
Messages
5
i solved the problem!
solution was to write this script :
Code:
#!/bin/sh
/bin/sleep 20
cd /home/pi/teamspeakserver
/usr/bin/screen -d -m /usr/local/bin/box86 /home/pi/teamspeakserver/ts3server

And starting it with cron.

Thank you for your help!!
 

FBnil

They'll own everything and be miserable.
Joined
Dec 14, 2012
Messages
5,051
Location
Yurp
@zerschranzer Not sure why it doesnt work as a oneliner. If you use a shell script, it forks, so in theory, using parenthesis should work too:

Code:
$ 
# parenthesis create subshells
sleep 3 && (screen -d -m find /)
# reattach to previous screen session (and see the output)
screen -r

But you got working code, and if it works... don't change it! Good Job!
 

FBnil

They'll own everything and be miserable.
Joined
Dec 14, 2012
Messages
5,051
Location
Yurp
@levi Talking about ps, I now use an alias to do the explicit form (because usernames longer than 7 characters get truncated with a plus, for example:

Code:
$ ps -eo uname:20,pid,pmem,pcpu,start_time,cmd |grep -e ^Deb -e ^USER -e ^UID
USER                   PID %MEM %CPU START CMD
Debian-exim           1315  0.0  0.0 16:03 /usr/sbin/exim4 -bd -q30m

$ ps -ef |grep -e ^Deb -e ^USER -e ^UID
UID        PID  PPID  C STIME TTY          TIME CMD
Debian-+  1315     1  0 16:03 ?        00:00:00 /usr/sbin/exim4 -bd -q30m

Another trick is this:

Code:
alias cls='clear && echo -en "\e[3J"'

It not only clears your screen, but also your backbuffer (so you can't scroll past the start of the next output).

And the last one: runwhenchanged.sh
This is a script that runs as soon as you save a file. It uses entr (which usually needs to be installed, for example with: # apt-get install entr)
Code:
#!/bin/bash
#set -x
WN=$1
if [ -z "$WN" ];then
     echo "Make a script run as soon as it is saved/changed (uses entr)"
     echo "Usage: $0 <executable> [parameters]"
     echo "       $0 -w <watch_for_this_file> <run_this_other_thing> [parameters]"
     exit 1
fi

if [ x"$WN" == x"-w" ];then
     shift
     WN=$1
     shift
     FN=$1
else
     FN=$WN
fi

ls $WN |entr $@
 
Last edited:
Top