请问一下openresty在docker的环境下怎样安装systemtap

641 views
Skip to first unread message

何裕发

unread,
May 17, 2016, 11:34:47 PM5/17/16
to openresty
系统是centos7,内核是3.10.0-327.18.2.el7.x86_64

把rpm包装在主机上,docker挂载/lib和/sys/kernel/debug
容器内安装systemtap,然后运行stap -v -e 'probe vfs.read {printf("read performed\n"); exit()}'

最后测试输出:
Pass 1: parsed user script and 110 library script(s) using 116404virt/37308res/2996shr/34824data kb, in 180usr/10sys/316real ms.
Pass 2: analyzed script: 1 probe(s), 1 function(s), 4 embed(s), 0 global(s) using 242920virt/163036res/2144shr/161340data kb, in 1580usr/590sys/5989real ms.
Pass 3: using cached /root/.systemtap/cache/95/stap_950c338b7b83d7b479c4b9227ccc8621_1659.c
Pass 4: using cached /root/.systemtap/cache/95/stap_950c338b7b83d7b479c4b9227ccc8621_1659.ko
Pass 5: starting run.
ERROR: Couldn't insert module '/tmp/stapfYXduB/stap_950c338b7b83d7b479c4b9227ccc8621_1659.ko': Operation not permitted
WARNING: /usr/bin/staprun exited with status: 1
Pass 5: run completed in 0usr/0sys/166real ms.
Pass 5: run failed.  [man error::pass5]

权限是:
drwxrwxrwx.   7 root root  4096 May 17 23:29 tmp

不知道我安装的方法是不是有问题,求正确的安装方法!

Yichun Zhang (agentzh)

unread,
May 18, 2016, 12:47:11 AM5/18/16
to openresty
Hello!

On Tue, May 17, 2016 at 8:34 PM, 何裕发 wrote:
[...]
> ERROR: Couldn't insert module
> '/tmp/stapfYXduB/stap_950c338b7b83d7b479c4b9227ccc8621_1659.ko': Operation
> not permitted
> WARNING: /usr/bin/staprun exited with status: 1
> Pass 5: run completed in 0usr/0sys/166real ms.
> Pass 5: run failed. [man error::pass5]

显然,你这里没有足够的权限。container 应该以 privileged mode 来运行,同时你应使用 root 或者
stapdev/stapusr 用户组里的帐户来运行 stap.

这个问题和 openresty 没什么关系,毕竟 systemtap 和 container 都不是 openresty 创造的 :)

更多细节可以参考下面这篇 google 到的文章:

http://rhelblog.redhat.com/2015/11/10/architecting-containers-part-3-how-the-user-space-affects-your-application/

Regards,
-agentzh

Chris.Ho

unread,
May 18, 2016, 2:22:41 AM5/18/16
to openresty


在 2016年5月18日星期三 UTC+8下午12:47:11,agentzh写道:
章大神真的是一席话胜搞十年的技术,我以为我一直都在运行root权限!!谢谢 

青涵

unread,
Oct 20, 2017, 12:51:02 AM10/20/17
to openresty
怎么在docker中安装linux内核呢?




在此输入代码...Pass 1: parsed user script and 465 library scripts using 137520virt/45936res/7464shr/38580data kb, in 250usr/10sys/267real ms.
Pass 2: analyzed script: 1 probe, 1 function, 7 embeds, 0 globals using 161192virt/70968res/8844shr/62252data kb, in 440usr/2020sys/2474real ms.
Pass 3: using cached /root/.systemtap/cache/06/stap_067a0a98f6ea25e7d7b27f5447433998_2546.c
Pass 4: using cached /root/.systemtap/cache/06/stap_067a0a98f6ea25e7d7b27f5447433998_2546.ko
Pass 5: starting run.
ERROR: module version mismatch (#1 SMP Fri Oct 20 04:35:41 UTC 2017 vs #1 SMP Wed Sep 6 00:05:16 UTC 2017), release 4.9.41-moby
WARNING: /usr/bin/staprun exited with status: 1
Pass 5: run completed in 0usr/10sys/174real ms.
Pass 5: run failed.  [man error::pass5]

在 2016年5月18日星期三 UTC+8下午12:47:11,agentzh写道:
Hello!

Kwanhur Huang

unread,
Oct 20, 2017, 4:49:37 AM10/20/17
to openresty
ERROR: module version mismatch

这提示了版本对不上

在 2017年10月20日,下午12:51,青涵 <yester...@gmail.com> 写道:

ERROR: module version mismatch

青涵

unread,
Oct 22, 2017, 9:49:00 PM10/22/17
to openresty
对啊,但是只有这么一种安装内核的方式,linux-kernel, 但是在docker中显示的是moby-kernel
所以,有没有办法在docker中使用呢?

在 2017年10月20日星期五 UTC+8下午4:49:37,Kwanhur Huang写道:

smallfish

unread,
Oct 22, 2017, 9:55:35 PM10/22/17
to open...@googlegroups.com
docker 用的是宿主机的内核,只是一种隔离技术,并不是完整的虚拟化

--
--
邮件来自列表“openresty”,专用于技术讨论!
订阅: 请发空白邮件到 openresty+subscribe@googlegroups.com
发言: 请发邮件到 open...@googlegroups.com
退订: 请发邮件至 openresty+unsubscribe@googlegroups.com
归档: http://groups.google.com/group/openresty
官网: http://openresty.org/
仓库: https://github.com/agentzh/ngx_openresty
教程: http://openresty.org/download/agentzh-nginx-tutorials-zhcn.html

青涵

unread,
Oct 23, 2017, 1:48:39 AM10/23/17
to openresty
也就是说在windows的docker中无法使用火焰图?



在 2017年10月23日星期一 UTC+8上午9:55:35,smallfish写道:
docker 用的是宿主机的内核,只是一种隔离技术,并不是完整的虚拟化

2017-10-23 9:49 GMT+08:00 青涵 <yester...@gmail.com>:
对啊,但是只有这么一种安装内核的方式,linux-kernel, 但是在docker中显示的是moby-kernel
所以,有没有办法在docker中使用呢?

在 2017年10月20日星期五 UTC+8下午4:49:37,Kwanhur Huang写道:
ERROR: module version mismatch

这提示了版本对不上

在 2017年10月20日,下午12:51,青涵 <yester...@gmail.com> 写道:

ERROR: module version mismatch

--
--
邮件来自列表“openresty”,专用于技术讨论!
订阅: 请发空白邮件到 openresty...@googlegroups.com
发言: 请发邮件到 open...@googlegroups.com
退订: 请发邮件至 openresty+...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages