can't foreground job (Suspended (tty input))

Steven W. Orr steveo at syslang.net
Fri Jan 5 14:38:06 EST 2007


On Friday, Jan 5th 2007 at 13:28 -0500, quoth Bill McGonigle:

=>Here's a strange job control problem.  I don't understand what the root cause
=>was.  The original command was:
=>
=> sudo emacs -nw /etc/yum.repos.d/rpmforge.repo
=>
=>and after backgrounding it (ctrl-z) I couldn't foreground it again.  I do this
=>all the time normally, but obviously something was different here.
=>
=>Anybody see what happened?:

The proper term is not backgrounding. It's suspending. Backgrounding is 
when it's started with an ampersand or you hit it with the bg command. 
Suspending is when the process gets hit with some type of SIGSTOP or 
SIGTSTP usually via ^Z.

You're not allowed to access %1 from sudo because %1 is not a suspended 
child process of sudo. You are allowed to try to kill your own child 
sub-processes but you can't in this case because the process is owned by 
root and you're not. Congratulations, you have painted yourself into a new 
kind of corner. The best you can do is to do a
sudo kill 6271

:-)

=>
=>-----
=>[bfccomputing at foo ~]$ jobs
=>[1]  + Suspended (tty input)         sudo emacs -nw
=>/etc/yum.repos.d/rpmforge.repo
=>
=>[bfccomputing at foo ~]$ kill %1
=>%1: Operation not permitted
=>
=>[bfccomputing at foo ~]$ sudo kill %1
=>kill: can't find process "%1"
=>[1]  + Suspended (tty input)         sudo emacs -nw
=>/etc/yum.repos.d/rpmforge.repo
=>
=>[bfccomputing at foo ~]$ ps
=> PID TTY          TIME CMD
=>6138 pts/0    00:00:00 tcsh
=>6382 pts/0    00:00:00 ps
=>
=>[bfccomputing at foo ~]$ ps ax | grep sudo
=>6405 pts/0    S+     0:00 grep sudo
=>
=>[bfccomputing at foo ~]$ ps ax | grep emacs
=>6270 pts/0    T      0:00 /usr/sbin/sesh /usr/bin/emacs -nw
=>/etc/yum.repos.d/rpmforge.repo
=>6271 pts/0    T      0:00 /usr/bin/emacs-x -nw /etc/yum.repos.d/rpmforge.repo
=>6425 pts/0    R+     0:00 grep emacs
=>
=>[bfccomputing at foo ~]$ kill 6270
=>6270: Operation not permitted
=>
=>[bfccomputing at foo ~]$ ps aux | grep emacs
=>root      6270  0.0  0.0   1404   284 pts/0    T    13:08   0:00
=>/usr/sbin/sesh /usr/bin/emacs -nw /etc/yum.repos.d/rpmforge.repo
=>root      6271  0.1  0.1  12972  6320 pts/0    T    13:08   0:00
=>/usr/bin/emacs-x -nw /etc/yum.repos.d/rpmforge.repo
=>500       6565  0.0  0.0   3776   688 pts/0    S+   13:10   0:00 grep emacs
=>
=>[bfccomputing at foo ~]$ sudo kill 6270
=>
=>[bfccomputing at foo ~]$ ps aux | grep emacs
=>root      6270  0.0  0.0   1404   284 pts/0    T    13:08   0:00
=>/usr/sbin/sesh /usr/bin/emacs -nw /etc/yum.repos.d/rpmforge.repo
=>root      6271  0.1  0.1  12972  6320 pts/0    T    13:08   0:00
=>/usr/bin/emacs-x -nw /etc/yum.repos.d/rpmforge.repo
=>500       6578  0.0  0.0   3772   668 pts/0    R+   13:10   0:00 grep emacs
=>
=>[bfccomputing at foo ~]$ sudo kill 6270 6271
=>
=>[bfccomputing at foo ~]$ sudo kill -9 6270 6271
=>[1]  + Killed                        sudo emacs -nw
=>/etc/yum.repos.d/rpmforge.repo
=>
=>[bfccomputing at foo ~]$ ps aux | grep emacs
=>500       6637  0.0  0.0   3772   680 pts/0    R+   13:10   0:00 grep emacs
=>------
=>
=>Not a big deal, but there's a whole in my mind about job control here.  That
=>could be about how the hand-off from sudo to sesh happens.
=>
=>-Bill
=>
=>-----
=>Bill McGonigle, Owner           Work: 603.448.4440
=>BFC Computing, LLC              Home: 603.448.1668
=>bill at bfccomputing.com           Cell: 603.252.2606
=>http://www.bfccomputing.com/    Page: 603.442.1833
=>Blog: http://blog.bfccomputing.com/
=>VCard: http://bfccomputing.com/vcard/bill.vcf
=>
=>_______________________________________________
=>gnhlug-discuss mailing list
=>gnhlug-discuss at mail.gnhlug.org
=>http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/

-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net


More information about the gnhlug-discuss mailing list