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