-
Notifications
You must be signed in to change notification settings - Fork 558
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
Hardcoded tc command is not found on NixOS #6426
Comments
Thanks for reporting this. Can you try the below patch and report back if that fixes traffic shaping on NixOS? $ cat nixos-fshaper.patch
--- a/src/fshaper/fshaper.sh
+++ b/src/fshaper/fshaper.sh
@@ -3,13 +3,10 @@
# Copyright (C) 2014-2024 Firejail Authors
# License GPL v2
-TCFILE=""
-if [ -x "/usr/sbin/tc" ]; then
- TCFILE="/usr/sbin/tc"
-elif [ -x "/sbin/tc" ]; then
- TCFILE="/sbin/tc";
+if [ "$(command -v tc >/dev/null)" ]; then
+ TCFILE="$(command -v tc)"
else
- echo "Error: traffic control utility (tc) not found";
+ echo "Error: traffic control utility (tc) not found"
exit 1
fi |
No, it's still broken with that patch. I messed around with it a bit, and it looks like the |
Thanks for testing! Here's attempt 2: $ cat nixos-fshaper.patch
--- a/src/fshaper/fshaper.sh
+++ b/src/fshaper/fshaper.sh
@@ -7,9 +7,13 @@
if [ -x "/usr/sbin/tc" ]; then
TCFILE="/usr/sbin/tc"
elif [ -x "/sbin/tc" ]; then
- TCFILE="/sbin/tc";
+ TCFILE="/sbin/tc"
+elif [ -x "/run/current-system/sw/bin/tc" ]; then
+ TCFILE="/run/current-system/sw/bin/tc"
+elif [ -x "$(readlink -e $(which tc))" ]; then
+ TCFILE="$(readlink -e $(which tc))"
else
- echo "Error: traffic control utility (tc) not found";
+ echo "Error: traffic control utility (tc) not found"
exit 1
fi HTH |
Suggestion to use |
I'll have to test it later today, but that should work given that it's basically what I did locally to get things functioning. However, I imagine the |
Description
It seems that
fshaper.sh
hardcodes the path totc
, which causes setting bandwidth to fail on NixOS given that it has neither/sbin
nor/usr/sbin
. I think this could resolved fairly easily by just letting users set a variable with the path totc
or something like that. Alternatively, you could just allow configuring the path when building the project.Steps to Reproduce
firejail --noprofile --name=blah --net=eth0
firejail --bandwidth=blah set eth0 1 1
Expected behavior
The bandwidth to be set properly.
Actual behavior
An error saying that
tc
could not be found.Behavior without a profile
No difference since this is an issue with the script's paths.
Additional context
This is basically the same issue as:
Environment
Checklist
/usr/bin/vlc
) "fixes" it).Log
Output of
LC_ALL=C firejail --bandwidth=blah set enp5s0 1 1
Output of
LC_ALL=C firejail --debug --bandwidth=blah set enp5s0 1 1
The text was updated successfully, but these errors were encountered: