Unable to install on Debian 12
Problem
When running ./install-linux.sh on Debian 12, the serial program failed to run due to a linking error.
./serial-ubuntu-latest/serial: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.38' not found (required by ./serial-ubuntu-latest/serial)
Solution
Include a version of serial with the release package that will work with Debian 12 (and other distros with the same version of GLIBC).
Edit to add: Code to compile for Debian 12, Ubuntu 22.04, and macOS (ARM64 and x86_64) has been written and releases are available in the latest pipeline, the latest run is currently here (download button is on the right).
Workaround
Compile serial from source and use the resulting executable.
# Start from the directory that you unpacked the release into
sudo apt install -y cargo
git clone https://github.com/EFForg/rayhunter
cd rayhunter/serial
cargo build
cd ../..
sed -i 's|./serial-ubuntu-latest/serial|./rayhunter/target/debug/serial|g' install-linux.sh
./install-linux.sh
I'm not much of a Microsoft fan, but I think getting serial compiled for Debian might just be a matter of adding a few lines here and waiting for Microsoft to run the CI job.
The linux-install.sh script would still need to be updated, perhaps by looking at the output of lsb_release -a or similar to determine which version of serial should be used.
I think that we don't want to support the many varied versions of libc. I think the better solution here is to improve the documentation on how to build from scratch for people on systems we don't support.
this is a sub issue of #29
This issue of releases not supporting Debian seems like it is orthogonal to improving the documentation. Asking people to set up an entire rust development environment is a lot to ask, let alone to ask it of journalists and activists. Maybe we can find some way we can make this easier for people to use, particularly those who are not developers.
Would you be willing to add RUSTFLAGS="-C target-feature=+crt-static" to the compilation so serial will run everywhere with a single executable?
If not, would you be willing to add --target x86_64-unknown-linux-musl to the cargo build command to create a statically linked release? This option would require one additional command before compilation (rustup target add x86_64-unknown-linux-musl) but musl is more stable than glibc when it comes to static linking.
If not, would you accept a pull request that compiles a version of serial that functions on Debian (in addition to the exiting executable in the release)?
If neither of those are acceptable, would you be willing to switch to binaries that work on Debian, which is reportedly more popular the Ubuntu?
I think adding the static compilation flag to serial or switching to MUSL would be the ideal solution here as it would make Serial more portablle and robust in line with my goals for #88 . It would also increase the number of systems we support installing on. So yes, that would be my ideal solution.
Static compilation using glibc results in an executable that can't run (tested on Debian 12 and 13). I didn't do a deep dive into why since the musl route is probably going to be better.
Static compilation using musl is something I'm still working on and am trying to collaborate with developers of rusb and udev-rs. Hopefully someone who is familiar with rust can help out on this one (I'm just a hacker, I don't actually know Rust)
ohh right the rusb dependency might make this hard actually, I forgot about that!
Cooper Quintin Senior Staff Technologist EFF.org is member supported. Join today!https://www.eff.org/donate
Signal: hunter.02 Find me on bluesky @cooperq.com or @@.*** exchange on mastodon
From: Adam @.> Sent: Thursday, January 30, 2025 2:38 PM To: EFForg/rayhunter @.> Cc: Cooper Quintin @.>; Assign @.> Subject: Re: [EFForg/rayhunter] Unable to install on Debian 12 (Issue #93)
Static compilation using glibc results in an executable that can't run (tested on Debian 12 and 13). I didn't do a deep dive into why since the musl route is probably going to be better.
Static compilation using musl is something I'm still working on and am trying to collaborate with developers of rusb and udev-rs. Hopefully someone who is familiar with rust can help out on this one (I'm just a hacker, I don't actually know Rust)
— Reply to this email directly, view it on GitHubhttps://github.com/EFForg/rayhunter/issues/93#issuecomment-2625743776, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAAP3VNYHTAS645TAQHBKVT2NKSVXAVCNFSM6AAAAABVOH5G4WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMRVG42DGNZXGY. You are receiving this because you were assigned.Message ID: @.***>
Consider extending this issue to support Ubuntu 22.04 LTS, which is still quite active, and impacted by the same glibc issue.
The workaround in the original post (to build serial from source) worked for me.
Umm, can anyone else try that the workaround in my first post and tell me if it still works for you?
I've tried it with 21c839678b996bf65a600813eb0e0da9343ae7ad (latest as of now) on Debian 12 & 13 and 30323b83293fe010a0d8943ad6dedff6d21c3e00 (the latest at the time of my original post) on Debian 12. Now running serial --root fails to initialize libusb in all those cases.
I discovered this after I wrote a GitLab CI job that compiles serial for Ubuntu, Debian, macOS ARM, and macOS x86_64. You can get the full release on the latest working pipeline and see if you have the same libusb problems that I'm having.
The irony is that now I'm getting a failure to initialize libusb even when I manually compile and run serial. That workaround was in my first post and worked for me at the time I posted it (and was confirmed to work on someone else's machine too). ldd isn't showing libusb in my compilation, but to be fair that also doesn't show up in the official release from this repo either. My guess is that this is something simple that a Rust developer could probably solve in 20 minutes, but that ain't me. 😕
Here's a sample run:
user@disp2302:~/rayhunter/serial$ cargo build
Compiling cc v1.0.86
Compiling pkg-config v0.3.30
Compiling libc v0.2.155
Compiling rusb v0.9.3
Compiling libusb1-sys v0.6.4
Compiling serial v0.1.0 (/home/user/rayhunter/serial)
Finished dev [unoptimized + debuginfo] target(s) in 4.43s
user@disp2302:~/rayhunter/serial$ ../target/debug/serial --root
thread 'main' panicked at 'Failed to initialize libusb: Other error', serial/src/main.rs:46:19
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
user@disp2302:~/rayhunter/serial$ RUST_BACKTRACE=1 ../target/debug/serial --root
thread 'main' panicked at 'Failed to initialize libusb: Other error', serial/src/main.rs:46:19
stack backtrace:
0: rust_begin_unwind
at /usr/src/rustc-1.63.0/library/std/src/panicking.rs:584:5
1: core::panicking::panic_fmt
at /usr/src/rustc-1.63.0/library/core/src/panicking.rs:142:14
2: serial::main
at ./src/main.rs:46:19
3: core::ops::function::FnOnce::call_once
at /usr/src/rustc-1.63.0/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
user@disp2302:~/rayhunter/serial$ ldd ../target/debug/serial
linux-vdso.so.1 (0x00007ffc77bd2000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007c161f121000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007c161ef40000)
/lib64/ld-linux-x86-64.so.2 (0x00007c161f1d8000)
Using a release instead of debug build has the same issue, and trying to sneak the library in there with LD_PRELOAD also didn't work.
user@disp2302:~/rayhunter/serial$ ls -l /usr/lib/x86_64-linux-gnu/libusb-1.0.so.0
lrwxrwxrwx 1 root root 19 Apr 10 2022 /usr/lib/x86_64-linux-gnu/libusb-1.0.so.0 -> libusb-1.0.so.0.3.0
user@disp2302:~/rayhunter/serial$ LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libusb-1.0.so.0 ../target/release/serial --root
thread 'main' panicked at 'Failed to initialize libusb: Other error', serial/src/main.rs:46:19
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
user@disp2302:~/rayhunter/serial$ LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libusb-1.0.so.0.3.0 ../target/release/serial --root
thread 'main' panicked at 'Failed to initialize libusb: Other error', serial/src/main.rs:46:19
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Edit to add: I tried rust 1.63.0 (latest in stable Debian) and 1.85 (latest from rust's install page using rustup), so I don't think this is a matter of using an incompatible version of the compiler.
OK, I got this figured out: the failure to initialize was because I didn't have any USB devices plugged in.
According to the developer of rusb, this initialization error comes from libusb. I've reported this upstream to the libusb developers to try to improve the error message. https://github.com/libusb/libusb/issues/1621
This also means that my existing scripts were fine. I've also offered these changes upstream (here) via a merge request. https://github.com/EFForg/rayhunter/pull/172
This has been fixed as of v0.2.7