Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tribler 8.0.7 Does Not Launch on Alpine Linux 3.21.2 x86_64 #8388

Open
crftbt opened this issue Jan 14, 2025 · 17 comments · Fixed by #8401
Open

Tribler 8.0.7 Does Not Launch on Alpine Linux 3.21.2 x86_64 #8388

crftbt opened this issue Jan 14, 2025 · 17 comments · Fixed by #8401

Comments

@crftbt
Copy link

crftbt commented Jan 14, 2025

There doesn't appear to be an Alpine Linux package for Tribler, but flatpak does work on Alpine. When attempting to launch Tribler through flatpak, the following error is output and Tribler fails to launch. Running as root has a similar message. What would be advised in this situation?

~ $ tribler 
Starting Tribler...
/usr/share/tribler ~
mktemp: : Invalid argument
/usr/bin/tribler: line 7: `mktemp /tmp/$USER-tribler-XXXXXXXX.log`: ambiguous redirect
~
~ $
~ $ doas tribler
Starting Tribler...
/usr/share/tribler /home/user
mktemp: : Invalid argument
/usr/bin/tribler: line 7: `mktemp /tmp/$USER-tribler-XXXXXXXX.log`: ambiguous redirect
/home/user
~ $ 
~ $ uname -a
Linux hotsname 6.12.9-0-lts #1-Alpine SMP PREEMPT_DYNAMIC 2025-01-09 18:01:12 x86_64 Linux
@qstokkink
Copy link
Contributor

I'm not entirely sure (I don't use Alpine), but I think this means that the /tmp directory does not exist or has odd permissions. I found another issue that suggests this: http s://github. com/srvrco/ getssl/issues/612#issuecomment-740694339

@crftbt
Copy link
Author

crftbt commented Jan 16, 2025

I'm not entirely sure (I don't use Alpine), but I think this means that the /tmp directory does not exist or has odd permissions. I found another issue that suggests this: http s://github. com/srvrco/ getssl/issues/612#issuecomment-740694339

Hello @qstokkink appreciate you taking the time to comment. The /tmp/ directory exists and the permissions appear to be fine. I believe the error message is pointing to the ambiguous redirect.

$ ls -lad /tmp/
drwxrwxrwt   21 root     root           520 Jan 16 12:49 /tmp/

$ tribler 
Starting Tribler...
/usr/share/tribler ~
mktemp: : Invalid argument
/usr/bin/tribler: line 7: `mktemp /tmp/$USER-tribler-XXXXXXXX.log`: ambiguous redirect
~

$ doas chmod 777 /tmp/

$ ls -lad /tmp/
drwxrwxrwx   21 root     root           520 Jan 16 12:49 /tmp/

$ tribler 
Starting Tribler...
/usr/share/tribler ~
mktemp: : Invalid argument
/usr/bin/tribler: line 7: `mktemp /tmp/$USER-tribler-XXXXXXXX.log`: ambiguous redirect
~
$ 

@qstokkink
Copy link
Contributor

Thanks for checking. Another thing I'm spotting on the Internet, is that some versions of mktemp require exactly 6 X's (we have 8).

exec /usr/share/tribler/tribler "$@" > `mktemp /tmp/$USER-tribler-XXXXXXXX.log` 2>&1

@qstokkink qstokkink added this to the 8.1.0 milestone Jan 20, 2025
@qstokkink qstokkink self-assigned this Jan 20, 2025
@crftbt
Copy link
Author

crftbt commented Jan 21, 2025

Thanks for checking. Another thing I'm spotting on the Internet, is that some versions of mktemp require exactly 6 X's (we have 8).

tribler/build/debian/tribler/usr/bin/tribler

Line 7 in bb7aa54
exec /usr/share/tribler/tribler "$@" > mktemp /tmp/$USER-tribler-XXXXXXXX.log 2>&1

I don't see a difference with 6 X's:

~$ doas vi /usr/bin/tribler 

~$ tribler 
Starting Tribler...
/usr/share/tribler ~
mktemp: : Invalid argument
/usr/bin/tribler: line 7: `mktemp /tmp/$USER-tribler-XXXXXX.log`: ambiguous redirect
~

~$ grep X /usr/bin/tribler 
exec /usr/share/tribler/tribler "$@" > `mktemp /tmp/$USER-tribler-XXXXXX.log` 2>&1

~$ 

@qstokkink
Copy link
Contributor

Another reason, I found when searching, was that a lack of block quotes could cause the "ambiguous redirect", I also made that a part of #8401. If that also doesn't fix it, I'll reopen this.

So, essentially, the standalone fix is mktemp "/tmp/$USER-tribler-XXXXXX.log", instead of mktemp /tmp/$USER-tribler-XXXXXXXX.log.

@crftbt
Copy link
Author

crftbt commented Jan 22, 2025

Another reason, I found when searching, was that a lack of block quotes could cause the "ambiguous redirect", I also made that a part of #8401. If that also doesn't fix it, I'll reopen this.

So, essentially, the standalone fix is mktemp "/tmp/$USER-tribler-XXXXXX.log", instead of mktemp /tmp/$USER-tribler-XXXXXXXX.log.

Still seeing ambiguous redirect when adding double quotes around the path in the /usr/bin/tribler bash script.

$ tribler 
Starting Tribler...
/usr/share/tribler ~
mktemp: : Invalid argument
/usr/bin/tribler: line 7: `mktemp "/tmp/$USER-tribler-XXXXXX.log"`: ambiguous redirect
~

~$ cat /usr/bin/tribler 
#!/bin/bash
# Startup script for Ubuntu Linux

echo "Starting Tribler..."

pushd "/usr/share/tribler"
exec /usr/share/tribler/tribler "$@" > `mktemp "/tmp/$USER-tribler-XXXXXX.log"` 2>&1
popd

~$ 

@qstokkink qstokkink reopened this Jan 23, 2025
@qstokkink
Copy link
Contributor

That is quite odd. That said, there are only so many things that can possibly go wrong here.

Could you try running through the following options?

  1. mktemp "/tmp/tribler-XXXXXX.log"
  2. mktemp "~/$USER-tribler-XXXXXX.log"
  3. mktemp "~/tribler-XXXXXX.log"

In the very worst case, you could replace the line with exec /usr/share/tribler/tribler "$@" > ~/tribler.log 2>&1 But, you'll end up with the log file in your home folder instead of your tmp directory, of course.

@qstokkink qstokkink removed their assignment Jan 23, 2025
@crftbt
Copy link
Author

crftbt commented Jan 24, 2025

That is quite odd. That said, there are only so many things that can possibly go wrong here.

Could you try running through the following options?

1. `mktemp "/tmp/tribler-XXXXXX.log"`

2. `mktemp "~/$USER-tribler-XXXXXX.log"`

3. `mktemp "~/tribler-XXXXXX.log"`

In the very worst case, you could replace the line with exec /usr/share/tribler/tribler "$@" > ~/tribler.log 2>&1 But, you'll end up with the log file in your home folder instead of your tmp directory, of course.

It appears to not like the .log extension for this version of mktemp/busybox on the latest version of Alpine 3.21.2.

~$ mktemp "/tmp/tribler-XXXXXX.log"
mktemp: : Invalid argument

~$ mktemp "~/$USER-tribler-XXXXXX.log"
mktemp: : Invalid argument

~$ mktemp "~/tribler-XXXXXX.log"
mktemp: : Invalid argument

~$ mktemp /tmp/test
mktemp: : Invalid argument

~$ mktemp --help
BusyBox v1.37.0 (2025-01-17 18:12:01 UTC) multi-call binary.

Usage: mktemp [-dt] [-p DIR] [TEMPLATE]

Create a temporary file with name based on TEMPLATE and print its name.
TEMPLATE must end with XXXXXX (e.g. [/dir/]nameXXXXXX).
Without TEMPLATE, -t tmp.XXXXXX is assumed.

        -d      Make directory, not file
        -q      Fail silently on errors
        -t      Prepend base directory name to TEMPLATE
        -p DIR  Use DIR as a base directory (implies -t)
        -u      Do not create anything; print a name

Base directory is: -p DIR, else $TMPDIR, else /tmp

~$ mktemp /tmp/testXXXXXX
/tmp/testeEjNnK

~$ mktemp "/tmp/testbXXXXXX"
/tmp/testbIIOoOm

~$ mktemp "/tmp/testcXXXXXX.log"
mktemp: : Invalid argument

~$ 

@qstokkink
Copy link
Contributor

Thanks for testing! We'll just pick one of the options that does work then: mktemp "/tmp/tribler-XXXXXX".

@crftbt
Copy link
Author

crftbt commented Jan 25, 2025

Thanks for testing! We'll just pick one of the options that does work then: mktemp "/tmp/tribler-XXXXXX".

So you're aware, that may address the mktemp, however updating the log file name leads to a Segmentation fault. What would be advised for Linux users on Alpine Linux 3.21.2 in this case?

$ cat `which tribler`
#!/bin/bash
# Startup script for Ubuntu Linux

echo "Starting Tribler..."

pushd "/usr/share/tribler"
exec /usr/share/tribler/tribler "$@" > `mktemp /tmp/$USER-tribler-XXXXXXXX` 2>&1
popd

$ tribler 
Starting Tribler...
/usr/share/tribler ~/Downloads
Segmentation fault

$ 

@qstokkink
Copy link
Contributor

Indeed, at this point this is more than just a mktemp issue that we can simply fix. If we're very lucky, perhaps your log file has useful information? Assuming we're not lucky, I'll have to do a deep dive into what is causing this.

@crftbt
Copy link
Author

crftbt commented Jan 27, 2025

Indeed, at this point this is more than just a mktemp issue that we can simply fix. If we're very lucky, perhaps your log file has useful information? Assuming we're not lucky, I'll have to do a deep dive into what is causing this.

Unfortunately I don't see any tribler files in /tmp/. Not sure if the file is never being created, or the segmentation fault is preventing mktemp from writing to file. Executing directly doesn't have any additional output.

If it helps, tried executing in both LXQt and Sway. This is the .deb version installed.

$ /usr/share/tribler/tribler
Segmentation fault

$ file /usr/share/tribler/tribler
/usr/share/tribler/tribler: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=730cb2e165413ad1bfe35beb27e607b7af1751b1, for GNU/Linux 2.6.32, stripped

$ 

@qstokkink
Copy link
Contributor

Alright, so much for an easy fix. I can set up a VM from an Alpine image (using the alpine-virt-3.21.2-x86_64.iso image) to figure out what is going wrong.

@crftbt
Copy link
Author

crftbt commented Jan 28, 2025

Alright, so much for an easy fix. I can set up a VM from an Alpine image (using the alpine-virt-3.21.2-x86_64.iso image) to figure out what is going wrong.

Appreciate you taking the time to look into this, @qstokkink. Just wanted to confirm that the architecture is x86_64.

@qstokkink
Copy link
Contributor

I tried running the flatpak on Alpine (alpine-virt-3.21.2-x86_64) and Tribler works for me:

There is probably something wrong with your setup, somehow.

For reference, what I did. After installing flatpak, I installed tribler using flatpak install org.tribler.Tribler and then ran it using flatpak run org.tribler.Tribler -s.

@crftbt
Copy link
Author

crftbt commented Jan 30, 2025

I tried running the flatpak on Alpine (alpine-virt-3.21.2-x86_64) and Tribler works for me:

There is probably something wrong with your setup, somehow.

For reference, what I did. After installing flatpak, I installed tribler using flatpak install org.tribler.Tribler and then ran it using flatpak run org.tribler.Tribler -s.

Appreciate you taking the time to look into this. I realize now that what I was debugging was the deb version. Should I open a new issue regarding the deb version?

@qstokkink
Copy link
Contributor

I spent another few hours on this. Essentially, Alpine really - and I mean really - does not like executables built with glibc.

I think flatpak, as suggested by https://wiki.alpinelinux.org/wiki/Running_glibc_programs, is the only reasonable option to run Tribler on Alpine, for now at least. Perhaps in the future we can create a musl build for Tribler, but that would be a long-term enhancement.

@qstokkink qstokkink removed this from the 8.1.0 milestone Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants