1*387f9dfdSAndroid Build Coastguard WorkerQ: while running 'make test' I'm seeing: 2*387f9dfdSAndroid Build Coastguard Worker 'ImportError: No module named pyroute2' 3*387f9dfdSAndroid Build Coastguard WorkerA: Install pyroute2: 4*387f9dfdSAndroid Build Coastguard Worker git clone https://github.com/svinota/pyroute2.git 5*387f9dfdSAndroid Build Coastguard Worker cd pyroute2; sudo make install 6*387f9dfdSAndroid Build Coastguard Worker 7*387f9dfdSAndroid Build Coastguard WorkerQ: hello_world.py fails with: 8*387f9dfdSAndroid Build Coastguard Worker OSError: libbcc.so: cannot open shared object file: No such file or directory 9*387f9dfdSAndroid Build Coastguard WorkerA: make sure to 'make install' and add the directory 10*387f9dfdSAndroid Build Coastguard Worker where libbcc.so was installed into your LD_LIBRARY_PATH 11*387f9dfdSAndroid Build Coastguard Worker export LD_LIBRARY_PATH=$(dirname `find /usr -name libbcc.so`):$LD_LIBRARY_PATH 12*387f9dfdSAndroid Build Coastguard Worker 13*387f9dfdSAndroid Build Coastguard WorkerQ: hello_world.py fails with: 14*387f9dfdSAndroid Build Coastguard Worker ImportError: No module named bcc 15*387f9dfdSAndroid Build Coastguard WorkerA: checkout "sudo make install" output to find out bpf package installation site, 16*387f9dfdSAndroid Build Coastguard Worker add it to the PYTHONPATH env variable before running the program. 17*387f9dfdSAndroid Build Coastguard Worker export PYTHONPATH=$(dirname `find /usr/lib -name bcc`):$PYTHONPATH 18*387f9dfdSAndroid Build Coastguard Worker 19*387f9dfdSAndroid Build Coastguard WorkerQ: hello_world.py still fails with: 20*387f9dfdSAndroid Build Coastguard Worker bpf: Operation not permitted 21*387f9dfdSAndroid Build Coastguard Worker Exception: Failed to load BPF program hello 22*387f9dfdSAndroid Build Coastguard WorkerA: sudo 23*387f9dfdSAndroid Build Coastguard Worker 24*387f9dfdSAndroid Build Coastguard WorkerQ: hello_world.py fails with 25*387f9dfdSAndroid Build Coastguard Worker bpf: Failed to load program: Operation not permitted 26*387f9dfdSAndroid Build Coastguard Worker despite running as root, and strace shows each `bpf()` system call failing with an EPERM. 27*387f9dfdSAndroid Build Coastguard WorkerA: The so-called Kernel lockdown might be the root cause. Try disabling it with the so-called 28*387f9dfdSAndroid Build Coastguard Worker sysrq mechanism: 29*387f9dfdSAndroid Build Coastguard Worker echo 1 > /proc/sys/kernel/sysrq 30*387f9dfdSAndroid Build Coastguard Worker echo x > /proc/sysrq-trigger 31*387f9dfdSAndroid Build Coastguard Worker Also see https://github.com/iovisor/bcc/issues/2525 32*387f9dfdSAndroid Build Coastguard Worker 33*387f9dfdSAndroid Build Coastguard Worker If you have Secure Boot enabled you need to press Alt-PrintScr-x on the keyboard instead: 34*387f9dfdSAndroid Build Coastguard Worker ``` 35*387f9dfdSAndroid Build Coastguard Worker This sysrq operation is disabled from userspace. 36*387f9dfdSAndroid Build Coastguard Worker sysrq: Disabling Secure Boot restrictions 37*387f9dfdSAndroid Build Coastguard Worker Lifting lockdown 38*387f9dfdSAndroid Build Coastguard Worker ``` 39*387f9dfdSAndroid Build Coastguard Worker 40*387f9dfdSAndroid Build Coastguard WorkerQ: How do I fulfill the Linux kernel version requirement? 41*387f9dfdSAndroid Build Coastguard WorkerA: You need to obtain a recent version of the Linux source code 42*387f9dfdSAndroid Build Coastguard Worker (please look at the README for the exact version), enable the 43*387f9dfdSAndroid Build Coastguard Worker configuration options listed in the README file, install the image, 44*387f9dfdSAndroid Build Coastguard Worker modules and headers, update your bootloader and reboot into the new 45*387f9dfdSAndroid Build Coastguard Worker kernel. 46*387f9dfdSAndroid Build Coastguard Worker 47*387f9dfdSAndroid Build Coastguard Worker If you want to compile your own kernel, you can fetch the sources 48*387f9dfdSAndroid Build Coastguard Worker from kernel.org or through your Linux distribution. 49*387f9dfdSAndroid Build Coastguard Worker To install, you need all of the following: 50*387f9dfdSAndroid Build Coastguard Worker make install 51*387f9dfdSAndroid Build Coastguard Worker make modules_install 52*387f9dfdSAndroid Build Coastguard Worker make headers_install INSTALL_HDR_PATH=/usr/local/ 53*387f9dfdSAndroid Build Coastguard Worker 54*387f9dfdSAndroid Build Coastguard WorkerQ: hello_world.py fails with: 55*387f9dfdSAndroid Build Coastguard Worker ImportError: No module named past.builtins 56*387f9dfdSAndroid Build Coastguard WorkerA: sudo pip install future 57*387f9dfdSAndroid Build Coastguard Worker 58*387f9dfdSAndroid Build Coastguard WorkerQ: Running one of the bcc tools produces an import error: 59*387f9dfdSAndroid Build Coastguard Worker Traceback (most recent call last): 60*387f9dfdSAndroid Build Coastguard Worker File "./execsnoop", line 20, in <module> 61*387f9dfdSAndroid Build Coastguard Worker from bcc import BPF 62*387f9dfdSAndroid Build Coastguard Worker ImportError: No module named bcc 63*387f9dfdSAndroid Build Coastguard WorkerA: Make sure the python bcc bindings package (python2-bcc) is installed. 64