It is a really weird problem, but on new systems(Fedora, Ubuntu) ctrl+c has no effect for certain tools:
if I execute yum list which runs for almost a minute I can't interrupt to run with ctrl+c
$time yum list >/dev/null
^C^C^C^C^C^C^C^C^C
The command execution won't stop.
However to interrupt find is possible.
$ time find / >/dev/null 2>&1
^C
real 0m0.741s
user 0m0.033s
sys 0m0.124s
I am curious what is causing this.
I have to following settings:
$ stty -a
speed 38400 baud; rows 36; columns 158; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke
I couldn't find the description of the problem yet, I appreciate if somebody would be that kind to shed some light.
Thanks in advance.
Some applications trap
SIGINT
because of strange interactions with other libraries. You can try sending them aSIGQUIT
instead (via Ctrl\ as given by yourstty
output).Some applications just trap
SIGINT
as Ignacio mentioned, others capture all keyboard input.If C-c doesn't work, you may try the already mentioned C-\ and if this doesn't work, then just try to background the process: C-z. and then kill it with
kill -s SIGKILL <pid>
This is a yum bug. It seems there are more and more linux developers think it is a good idea to ignore standard signal handling and make their app to not react to standard signals.
man 7 signal
This is a bad habit.
Definitely related to signal handling in the command you're calling. See a number of open yum bugs around the handling:
Seems like Ctrl-C (
SIGINT
) might have been used to control other behavior (skipping to the next mirror) rather than the usual intention (killing the process).Re: why
SIGQUIT
doesn't seem to do anything useful -- there may not be a defined handler.This usually happens when the application is in a state where it's not actually able to respond to signals because it's not able to resume running from the CPU scheduler queue. A good example is when the application is hung waiting for a blocking operation (synchronous disk I/O in the main thread, swap in/out, blocking network I/O, etc.) Given that this is yum, I'm guessing that it's timing out connecting to one or more of the sources defined in your repository/mirrorlist configs, but it could easily be a disk I/O issue accessing its caches, the RPM database (including BDB corruption), or any number of other things.
A good way to test behavior this with any arbitrary application: hard-mount an NFS share, then pull the NFS server offline, then try to use any program that tries to open that directory (find or /bin/ls are good examples). It won't respond to anything beyond a SIGKILL while it waits for the kernel to figure out what's up with the share.
Actually, rpmlib, used by yum, is grabbing and ignoring the ctrl-c signal handler. There's only so much can be done about this at yum's level. It's annoying, but I'm not sure it's worth getting all worked up about. Newer and newer versions of Fedora have successfully improved the handling of this, to the point where yum under Rawhide (which will become F15) does this for your test case:
It still will not let you interrupt changes to the RPM database with SIGINT, which is hard to really argue with.