Headless Tribler (Raspbian)

Hi there,

Not quite discouraged by this thread Tribler on Raspberry pi? I am interested in running Tribler on my Raspberry Pi which is always on and very energy efficient.

My Pi is headless, i.e. only working as a server. I wonder if there is a way to install Tribler in headless, or daemon, mode so it only runs as a server that I can manage e.g. via the web interface or other API/CLI.

Does Tribler need additional coding to achieve this? I think it would be a design improvement to separate the code base between P2P server, GUI, and streaming/player services.

Any info and comments are appreciated! Thanks,
Stefano

1 Like

Why not, if you run a Linux distribution for example Ubuntu.

I think that there enough versions available.

Success.

Since I’m also interested in this, Core/GUI has been split and is expected to be available in 7.0.

The daemon does not yet run on it’s own but you check the progress here
https://github.com/Tribler/tribler/issues/267#issuecomment-263518444

Awesome! Glad to know that there is more widespread interest.

I’ll follow the Github issue. Incidentally, all three links in the initial comment are broken. Did the forum platform migrate recently?

Thanks

Yes, the forum software changed this year.

I think I will hook my question here instead of new topic as it is connected…
Is there already an option to close Tribler from the Terminal?
I have a script that runs Tribler (by nohup) but I want to close it also.
Is there a proper way to close it? Is “kill -15” safe? It looks like Tribler is not closing properly with “kill -15” ??

Tribler should shut down properly when receiving a SIGINT signal so you can do something like kill -2. We don’t capture the SIGTERM as far as I know.

With kill -2 Tribler is just “disappearing”- there is no “closing Tribler” window (the one with status bar on the bottom). It looks the same as with kill -15. Is this ok?

I too would like to install Tribler on a headless machine. I tried running Tribler 7.0 (tribler_7.0.0-alpha3_all.deb) on an Ubuntu desktop 16.10 to test this but I can’t get it running.

I tried to run:

twistd -n tribler

but this just gives me:

Usage: twistd [options]
Options:
      --savestats      save the Stats object rather than the text output of the
                       profiler.
  -o, --no_save        do not save state on shutdown
  -e, --encrypted      The specified tap/aos file is encrypted.
  -n, --nodaemon       don't daemonize, don't use default umask of 0077
      --originalname   Don't try to change the process name
      --syslog         Log to syslog, not to file
      --euid           Set only effective user-id rather than real user-id.
                       (This option has no effect unless the server is running
                       as root, in which case it means not to shed all
                       privileges after binding ports, retaining the option to
                       regain privileges in cases such as spawning processes.
                       Use with caution.)
  -l, --logfile=       log to a specified file, - for stdout
      --logger=        A fully-qualified name to a log observer factory to use
                       for the initial log observer.  Takes precedence over
                       --logfile and --syslog (when available).
  -p, --profile=       Run in profile mode, dumping results to specified file.
      --profiler=      Name of the profiler to use (profile, cprofile).
                       [default: cprofile]
  -f, --file=          read the given .tap file [default: twistd.tap]
  -y, --python=        read an application from within a Python file (implies
                       -o)
  -s, --source=        Read an application from a .tas file (AOT format).
  -d, --rundir=        Change to a supplied directory before running [default:
                       .]
      --prefix=        use the given prefix when syslogging [default: twisted]
      --pidfile=       Name of the pidfile [default: twistd.pid]
      --chroot=        Chroot to a supplied directory before running                                                          
  -u, --uid=           The uid to run as.                                                                                     
  -g, --gid=           The gid to run as.                                                                                     
      --umask=         The (octal) file creation mask to apply.                                                               
      --help-reactors  Display a list of possibly available reactor names.                                                    
      --version        Print version information and exit.                                                                                                                                                                                                                     
      --spew           Print an insanely verbose log of everything that happens.                                                                                                                                                                                               
                       Useful when debugging freezes or locks in complex code.                                                                                                                                                                                                 
  -b, --debug          Run the application in the Python Debugger (implies                                                                                                                                                                                                     
                       nodaemon),         sending SIGUSR2 will drop into                                                                                                                                                                                                       
                       debugger                                                                                                                                                                                                                                                
  -r, --reactor=       Which reactor to use (see --help-reactors for a list of                                                                                                                                                                                                 
                       possibilities)                                                                                                                                                                                                                                          
      --help           Display this help and exit.                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                               
twistd reads a twisted.application.service.Application out of a file and runs                                                                                                                                                                                                  
it.                                                                                                                                                                                                                                                                            
Commands:                                                                                                                                                                                                                                                                      
    conch            A Conch SSH service.                                                                                                                                                                                                                                      
    dns              A domain name server.                                                                                                                                                                                                                                     
    ftp              An FTP server.                                                                                                                                                                                                                                            
    inetd            An inetd(8) replacement.                                                                                                                                                                                                                                  
    mail             An email service                                                                                                                                                                                                                                          
    manhole          An interactive remote debugger service accessible via                                                                                                                                                                                                     
                     telnet and ssh and providing syntax coloring and basic line                                                                                                                                                                                               
                     editing functionality.                                                                                                                                                                                                                                    
    news             A news server.                                                                                                                                                                                                                                            
    portforward      A simple port-forwarder.                                                                                                                                                                                                                                  
    procmon          A process watchdog / supervisor                                                                                                                                                                                                                           
    socks            A SOCKSv4 proxy service.                                                                                                                                                                                                                                  
    web              A general-purpose web server which can serve from a                                                                                                                                                                                                       
                     filesystem or application resource.                                                                                                                                                                                                                       
    words            A modern words server                                                                                                                                                                                                                                     
    xmpp-router      An XMPP Router server                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                               
/usr/bin/twistd: Unknown command: tribler           

running from the commandline:

tribler

does launch tribler.

Must be missing something obvious, but there you go.
Any ideas?

cheers

Hi,

You should navigate to the directory where you have installed Tribler (which is /usr/share/tribler usually on Linux) and execute the twistd command from there. I will consider adding a --headless flag or something like that to make things like this more convenient. :slight_smile:

Please let me know whether this works for you!

Thank you very much for your response! I had already tried this:

whoop@UBUTEST:/usr/share/tribler$ ls /usr/share/tribler/
logger.conf  run_tribler.py  run_tribler.pyc  Tribler  TriblerGUI  twisted
whoop@UBUTEST:/usr/share/tribler$ twistd -n tribler
Usage: twistd [options]
Options:
      --savestats      save the Stats object rather than the text output of the
                       profiler.
  -o, --no_save        do not save state on shutdown
  -e, --encrypted      The specified tap/aos file is encrypted.
  -n, --nodaemon       don't daemonize, don't use default umask of 0077
      --originalname   Don't try to change the process name
      --syslog         Log to syslog, not to file
      --euid           Set only effective user-id rather than real user-id.
                       (This option has no effect unless the server is running
                       as root, in which case it means not to shed all
                       privileges after binding ports, retaining the option to
                       regain privileges in cases such as spawning processes.
                       Use with caution.)
  -l, --logfile=       log to a specified file, - for stdout
      --logger=        A fully-qualified name to a log observer factory to use
                       for the initial log observer.  Takes precedence over
                       --logfile and --syslog (when available).
  -p, --profile=       Run in profile mode, dumping results to specified file.
      --profiler=      Name of the profiler to use (profile, cprofile).
                       [default: cprofile]
  -f, --file=          read the given .tap file [default: twistd.tap]
  -y, --python=        read an application from within a Python file (implies
                       -o)
  -s, --source=        Read an application from a .tas file (AOT format).
  -d, --rundir=        Change to a supplied directory before running [default:
                       .]
      --prefix=        use the given prefix when syslogging [default: twisted]
      --pidfile=       Name of the pidfile [default: twistd.pid]
      --chroot=        Chroot to a supplied directory before running
  -u, --uid=           The uid to run as.
  -g, --gid=           The gid to run as.
      --umask=         The (octal) file creation mask to apply.
      --help-reactors  Display a list of possibly available reactor names.
      --version        Print version information and exit.
      --spew           Print an insanely verbose log of everything that happens.
                       Useful when debugging freezes or locks in complex code.
  -b, --debug          Run the application in the Python Debugger (implies
                       nodaemon),         sending SIGUSR2 will drop into
                       debugger
  -r, --reactor=       Which reactor to use (see --help-reactors for a list of
                       possibilities)
      --help           Display this help and exit.

twistd reads a twisted.application.service.Application out of a file and runs
it.
Commands:
    conch            A Conch SSH service.
    dns              A domain name server.
    ftp              An FTP server.
    inetd            An inetd(8) replacement.
    mail             An email service
    manhole          An interactive remote debugger service accessible via
                     telnet and ssh and providing syntax coloring and basic line
                     editing functionality.
    news             A news server.
    portforward      A simple port-forwarder.
    procmon          A process watchdog / supervisor
    socks            A SOCKSv4 proxy service.
    web              A general-purpose web server which can serve from a
                     filesystem or application resource.
    words            A modern words server
    xmpp-router      An XMPP Router server

/usr/bin/twistd: Unknown command: tribler
whoop@UBUTEST:/usr/share/tribler$ 

cheers

I am really at a loss here: I can get the command running (on an ubuntu 16.04 machine) only as root and then what?
I can see this with nmap:

PORT     STATE SERVICE VERSION
8085/tcp open  http    TwistedWeb httpd 16.0.0
|_http-server-header: TwistedWeb/16.0.0
|_http-title: 404 - No Such Resource

But there is a 404 behind this. I seem to be missing the knowledge on
how to operate in this mode.

Any help much appreciated.

1 Like

It’s been 3 and half year. Any new updates on this?

if you are running on pi0/1, no luck there is not enough cpu power, it runs but it does not function well. but may be you can with decent versions of pi3 or pi4 it works but still expect performance limit on download

you can create binaries for raspian with https://github.com/hbiyik/triblerd-buildsys. Side note: this is not an official repo

1 Like