Skip to content
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

Add snapcraft script to package up bcc as a snap #835

Merged
merged 1 commit into from
Dec 21, 2016

Conversation

ColinIanKing
Copy link
Contributor

This supports packaging using snapcraft; to create a snap
install snapcraft and in the snapcraft directory run
snapcraft to generate a snap. This script was originally
written by Evan Dandrea and updated by Colin King.

Signed-off-by: Colin Ian King [email protected]

@brendangregg
Copy link
Member

[buildbot, ok to test]

@brendangregg
Copy link
Member

It builds and installs ok (different version number than in the README, but that's ok), but the tools don't run. I don't know where I should be running them from, here?:

# /snap/bin/bcc.opensnoop
chdir(/lib/modules/4.9.0-rc5-virtual/build): No such file or directory
Traceback (most recent call last):
  File "/snap/bcc/100001/usr/share/bcc/tools/opensnoop", line 126, in <module>
    b = BPF(text=bpf_text)
  File "/snap/bcc/100001/usr/lib/python2.7/dist-packages/bcc/__init__.py", line 240, in __init__
    raise Exception("Failed to compile BPF module %s" % src_file)
Exception: Failed to compile BPF module 

(I couldn't find the snap command to list what it had installed.)

That directory does exist. Is this doing a chroot or openat or something?

@ColinIanKing
Copy link
Contributor Author

ColinIanKing commented Dec 1, 2016 via email

@brendangregg
Copy link
Member

Commands don't work. Am I on an old snap version? Just did an apt-get...

# snap connect bcc:mount-observe
error: the required argument `<snap>:<slot>` was not provided
# dpkg -l | grep snap
ii  snapcraft                          2.22.1                              all          easily craft snaps
ii  snapd                              2.0.3                               amd64        Tool to interact with Ubuntu Core Snappy.
ii  ubuntu-core-launcher               1.0.27.1                            amd64        Launcher for ubuntu-core (snappy) apps

@brendangregg
Copy link
Member

I tried again on a more stock Xenial 4.4, with the same errors.

@ColinIanKing
Copy link
Contributor Author

ColinIanKing commented Dec 2, 2016

This is from a clean 64 bit xenial, updated with:

sudo apt-get update && sudo apt-get dist-upgrade:

lsb_release  -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.1 LTS
Release:	16.04
Codename:	xenial

$ dpkg -l | grep snap
ii  snap-confine                       1.0.43-0ubuntu1~16.04.1            amd64        Support executable to apply confinement for snappy apps
ii  snapcraft                          2.22.1                             all          easily craft snaps
ii  snapd                              2.16ubuntu3                        amd64        Tool to interact with Ubuntu Core Snappy.
ii  ubuntu-core-launcher               1.0.43-0ubuntu1~16.04.1            amd64        Launcher for ubuntu-core (snappy) apps

I installed the snap using the --devmode switch to snap install too.

@brendangregg
Copy link
Member

Ok, after the "sudo apt-get update && sudo apt-get dist-upgrade", it works on my stock 4.4.

It's not working on my 4.9-rc5 kernel.

@ColinIanKing
Copy link
Contributor Author

OK, I'll look at that 4.9 issue first thing on Tuesday (it's EOD UK time and I'm out on Monday).

@ColinIanKing
Copy link
Contributor Author

I've tried out 4.9-rc8 mainline kernel and also the latest pre-release Zesty 4.9-rc8 kernel with bcc generated from the bcc git repo using the snapcraft script and it works OK on the zesty development release. I'll now re-test this on Xenial and Yakkety releases with these two 4.9 kernels and see if I can reproduce the problem you are seeing.

@ColinIanKing
Copy link
Contributor Author

I've now tested Xenial, Yakkety and Zesty releases using their current kernels and the 4.9-rc8 mainline kernel with a snap of today's bcc and they all work fine. I've put the mainline 4.9-rc8 kernel debs here: http:https://kernel.ubuntu.com/~cking/kernel-4.9-rc8 if you could re-test using that kernel. If you can report where it is failing perhaps I can figure out whats wrong.

@brendangregg
Copy link
Member

I'll test, but my guess is that it was failing because I was building and installing my own kernel. ie, make, make modules_install, make install, make headers_install. Maybe that misses something? Maybe we don't care so much, as if you're building your own kernel, you should be on the lookout for breakage?

@ColinIanKing
Copy link
Contributor Author

I'm suspect it maybe because of the different environment, not sure really. Anyhow, will this be tested and merged at some point Brendan?

@brendangregg
Copy link
Member

We can merge it; just was wondering what will happen for people who build their own kernel. If it's expected not to work, could we put a note in the README?

@ColinIanKing
Copy link
Contributor Author

OK good idea. shall I re-submit with an updated README?

@brendangregg
Copy link
Member

If you just push a commit, it should auto-join onto the existing PR. Makes it easier.

This supports packaging using snapcraft; to create a snap
install snapcraft and in the snapcraft directory run
make to generate a snap.  This script was originally
written by Evan Dandrea and updated by Colin King.

Signed-off-by: Colin Ian King <[email protected]>
@ColinIanKing
Copy link
Contributor Author

ColinIanKing commented Dec 15, 2016

Hi Brendan, I've re-worked the README file, and to make life easier with the versioning, building and installation I've added a simple Makefile too. No major changes. 96875c5

@brendangregg
Copy link
Member

Thanks, LGTM. @drzaeus77 might want to take a look.

@ColinIanKing
Copy link
Contributor Author

Hi there, any news on this commit? It would be great to get it accepted if possible. Thanks!

@4ast 4ast merged commit dd5799b into iovisor:master Dec 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants