主题 : /bin/sh: can't access tty; job control turned off(was: 求助:busybox启动时碰到的问题) 复制链接 | 浏览器收藏 | 打印
用过的Linux发行版:Arch,Gentoo,Debian,Fedora,RHEL,CentOS,Ubuntu,OpenSUSE,RedFlag,Ylmf,De ..
级别: 骑士
UID: 12662
精华: 0
发帖: 181
金钱: 955 两
威望: 191 点
综合积分: 362 分
注册时间: 2010-01-11
最后登录: 2014-02-14
楼主  发表于: 2010-02-10 15:04

 /bin/sh: can't access tty; job control turned off(was: 求助:busybox启动时碰到的问题)

我的busybox的initab文件内容是这样的:

::sysinit:/etc/init.d/rcS
::respawn:-/bin/sh
tty2::askfirst:-/bin/sh
::ctrlaltdel:/bin/umount -a -r

开机时出现错误提示(最后一行)

VFS: Mounted root (cramfs filesystem) readonly on device 31:3.
Freeing init memory: 176K
cramfs: bad compressed blocksize 4273664864
Failed to execute /linuxrc.  Attempting defaults...
cramfs: bad compressed blocksize 4273664840
s3c2440-sdi s3c2440-sdi: running at 0kHz (requested: 0kHz).
s3c2440-sdi s3c2440-sdi: running at 198kHz (requested: 197kHz).
s3c2440-sdi s3c2440-sdi: running at 198kHz (requested: 197kHz).
s3c2440-sdi s3c2440-sdi: running at 198kHz (requested: 197kHz).
s3c2440-sdi s3c2440-sdi: powered down.
/bin/sh: can't access tty; job control turned off
#

请问是什么原因?
[ 此帖被kasim在2010-02-10 16:03重新编辑 ]
业余Linux爱好者。
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
1楼  发表于: 2010-02-10 17:00
(http://www.uclibc.org/FAQ.html#job_control)
Why do I keep getting "sh: can't access tty; job control turned off" errors? Why doesn't Control-C work within my shell?

This isn't really a uClibc question, but I'll answer it here anyways. Job control will be turned off since your shell can not obtain a controlling terminal. This typically happens when you run your shell on /dev/console. The kernel will not provide a controlling terminal on the /dev/console device. Your should run your shell on a normal tty such as tty1 or ttyS0 and everything will work perfectly. If you REALLY want your shell to run on /dev/console, then you can hack your kernel (if you are into that sortof thing) by changing drivers/char/tty_io.c to change the lines where it sets "noctty = 1;" to instead set it to "0". I recommend you instead run your shell on a real console...
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
用过的Linux发行版:Arch,Gentoo,Debian,Fedora,RHEL,CentOS,Ubuntu,OpenSUSE,RedFlag,Ylmf,De ..
级别: 骑士
UID: 12662
精华: 0
发帖: 181
金钱: 955 两
威望: 191 点
综合积分: 362 分
注册时间: 2010-01-11
最后登录: 2014-02-14
2楼  发表于: 2010-02-10 17:50

 回 1楼(kasim) 的帖子

前辈的意思是 将 tty2::askfirst:-/bin/sh
改为 tty1?
业余Linux爱好者。
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
3楼  发表于: 2010-02-11 10:18

 回 2楼(curay) 的帖子

不管是tty什么,你要确保
1. 这是一个tty设备节点;
2. 这个设备节点在运行init进程的时候可以访问的到(可以是通过mknod在cramfs文件系统镜像中创建或mdev动态地在启动过程中创建)
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 23855
精华: 0
发帖: 17
金钱: 85 两
威望: 17 点
综合积分: 34 分
注册时间: 2010-06-28
最后登录: 2017-09-13
4楼  发表于: 2010-07-17 17:16
相同的问题
我的解决方法如下;
inittab里面改为ttySAC0::/bin/sh

rootfs/dev下面创建节点ttySAC0 mknod ttySAC0 c 204 64<-----这个是我在Documentation下面的一个文档上看到的

Please press Enter to activate this console.
Starting pid 301, console /dev/ttySAC0: '/bin/sh'


BusyBox v1.1.3 (2010.07.17-04:17+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.