Description
we're having some special requirements. we're using the pysoem library to communicate with ethercat devices. this means that the python executable needs cap_net_raw+ep
capability, which can be achieved by running sudo setcap cap_net_raw+ep /path/to/python
.
this works fine with the system python, but when setting it on the uv
provided python executable:
sudo setcap cap_net_raw+ep ~/.local/share/uv/python/cpython-3.11.11-linux-x86_64-gnu/bin/python3.11
i get this when i then try to run python:
[...]/python3: error while loading shared libraries: $ORIGIN/../lib/libpython3.11.so.1.0: DST not allowed in SUID/SGID programs
if i run this:
patchelf --replace-needed "\$ORIGIN/../lib/libpython3.11.so.1.0" ~/.local/share/uv/python/cpython-3.11.11-linux-x86_64-gnu/lib/libpython3.11.so.1.0 ~/.local/share/uv/python/cpython-3.11.11-linux-x86_64-gnu/bin/python3.11
it works (after re-running setcap
), so it seems to be related to the relative path. and sure, from a security point of view i can understand why that may be problematic.
i found this:
python-build-standalone/cpython-unix/build-cpython.sh
Lines 684 to 697 in f0abfc9
which is probably what causes this. but what is the right forward here? running pop!_os 22.04 lts (based on ubuntu 24.04) amd64