tcsetpgrp failed重新编译tini

18 篇文章 0 订阅

1 Overview

在启动 Spark Operator 的时候出现了一个意想不到的问题。

[root@sholdmix01node1 /data/runzhliu/spark]# kubectl log  -n kube-system spark-sparkoperator-86f6c889cd-ggbmc
log is DEPRECATED and will be removed in a future version. Use logs instead.
++ id -u
+ myuid=185
++ id -g
+ mygid=0
+ set +e
++ getent passwd 185
+ uidentry=
+ set -e
+ echo 185
185
0

+ echo 0
+ echo
+ [[ -z '' ]]
+ [[ -w /etc/passwd ]]
+ echo '185:x:185:0:anonymous uid:/opt/spark:/bin/false'
+ exec /usr/bin/tini -s -- /usr/bin/spark-operator
[FATAL tini (9)] tcsetpgrp failed: Permission denied

因为本人在腾讯,这是因为开发环境的 tlinux 的问题,导致 tini 出错了。寻找了很久,也没找到 特别有效的信息,于是查看一下 tini 的源码,看看 这个 错误是如何产生的。

2 tini 源码

大家可以看到这行代码,错误信息就是由他打印的。

// Doing it in the child process avoids a race condition scenario
// if Tini is calling Tini (in which case the grandparent may make the
// parent the foreground process group, and the actual child ends up...
// in the background!)
if (tcsetpgrp(STDIN_FILENO, getpgrp())) {
	if (errno == ENOTTY) {
		PRINT_DEBUG("tcsetpgrp failed: no tty (ok to proceed)");
	} else if (errno == ENXIO) {
		// can occur on lx-branded zones
		PRINT_DEBUG("tcsetpgrp failed: no such device (ok to proceed)");
	} else {
		PRINT_FATAL("tcsetpgrp failed: %s", strerror(errno));
		return 1;
	}
}

可以直接把这段代码注释掉,然后重新编译 cmake . && make

3 Summary

将重新编译后的 tini 替换原来镜像的 tini 即可。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值