mahrez4 / IOTracer

GNU General Public License v2.0
1 stars 0 forks source link

Missing installation instructions #1

Open khannurien opened 5 months ago

khannurien commented 5 months ago

Hi,

I'm trying to deploy the tools on an Ubuntu 24.04 VM. I went through the following steps to setup the environment:

sudo apt install bpfcc-tools linux-headers-$(uname -r)
sudo apt install python3-pip python3-venv
python3 -m venv .venv
./.venv/bin/pip3 install prometheus-client bcc pytest

When I try to run the MongoDB example, I hit the following error:

ImportError: cannot import name 'BPF' from 'bcc'

Any clue?

Thanks!

Vincent

mahrez4 commented 5 months ago

Hello,

The only requirements should be bpfcc-tools, linux-headers and prometheus-client according to my tests on Ubuntu 22.04. However after trying with a virtual environment I managed to get the same issue. It turns out that bpfcc installs a certain version of the pip package bcc, but if I run pip install bcc in the virtual environment I get a different version of the package. I'm not sure if this is the best solution but i've managed to solve it by using a link to the system-wide package

To get the path of bcc: (run before activating the virtual env)

python3 -c "import bcc; print(bcc.__file__);"

You probably have to adjust this next command accordingly with the path from the previous command as well as the python version used in the virtual env: (or you can run the previous command while the virtual env is activated and bcc is installed to get the other path, remember to uninstall bcc in the venv)

ln -s /usr/lib/python3/dist-packages/bcc .venv/lib/python3.10/site-packages/bcc

You also might have an issue if you're using ext4 instead of btrfs so you should also run this if that's the case.

sed -i 's/event="btrfs/event="ext4/g' bcc_iotracer.py

I have updated the README files with more instructions, mainly for Ubuntu 22.04 and there's been some changes to other files as well.