# [SOLVED] CTRL-C no longer working

## Anarcho

Hi all,

since at least 2 weeks I have a strange problem on one of my servers. CTRL-C is not working on the shell. I couldn't test local but the problem exists via SSH and I also tested via telnet.

Every other CTRL-Key-Combination I tried is still working (e.g. CTRL-D, CTRL-Z).

I checked what I have emerged in the last weeks:

```
Mon Oct 26 12:32:55 2015 >>> sys-libs/glibc-2.21-r1

Mon Oct 26 12:32:59 2015 >>> virtual/libintl-0-r2

Mon Oct 26 12:33:38 2015 >>> dev-libs/gmp-6.0.0a

Mon Oct 26 12:33:51 2015 >>> media-libs/libpng-1.6.18

Mon Oct 26 12:34:09 2015 >>> dev-libs/mpfr-3.1.3_p4

Mon Oct 26 12:54:34 2015 >>> sys-devel/gcc-4.9.3

Mon Oct 26 12:54:56 2015 >>> dev-libs/elfutils-0.163

Mon Oct 26 12:55:50 2015 >>> dev-libs/nettle-3.1.1

Mon Oct 26 12:56:21 2015 >>> sys-apps/util-linux-2.26.2

Mon Oct 26 12:57:32 2015 >>> x11-libs/pixman-0.32.8

Mon Oct 26 13:01:00 2015 >>> dev-lang/python-2.7.10

Mon Oct 26 13:03:05 2015 >>> dev-lang/python-3.4.3

Mon Oct 26 13:03:18 2015 >>> dev-python/pyasn1-0.1.8

Mon Oct 26 13:03:26 2015 >>> dev-python/ply-3.6-r1

Mon Oct 26 13:03:35 2015 >>> dev-python/pycparser-2.14

Mon Oct 26 13:03:51 2015 >>> dev-python/cffi-1.2.1

Mon Oct 26 13:05:12 2015 >>> dev-python/cryptography-1.0.2

Mon Oct 26 13:05:41 2015 >>> sys-fs/lvm2-2.02.116

Mon Oct 26 13:35:29 2015 >>> net-libs/gnutls-3.3.17.1

Fri Nov  6 21:42:01 2015 >>> dev-python/packaging-15.3-r2

Fri Nov  6 21:43:43 2015 >>> app-crypt/mit-krb5-1.13.2-r2

Fri Nov  6 21:44:00 2015 >>> sys-process/procps-3.3.10-r1

Fri Nov  6 21:44:14 2015 >>> sys-apps/kmod-21

Fri Nov  6 21:46:14 2015 >>> dev-util/cmake-3.3.1-r1

Fri Nov  6 21:46:49 2015 >>> net-misc/openssh-7.1_p1-r2

Fri Nov  6 21:46:56 2015 >>> net-nds/rpcbind-0.2.3-r1

Fri Nov  6 21:47:10 2015 >>> dev-python/setuptools-18.4

Fri Nov  6 21:47:16 2015 >>> dev-python/certifi-2015.9.6.2

Fri Nov  6 21:47:23 2015 >>> dev-python/pypax-0.9.2

Fri Nov  6 21:47:30 2015 >>> dev-python/six-1.10.0

Fri Nov  6 21:47:38 2015 >>> dev-python/pytest-2.8.2

Fri Nov  6 21:47:46 2015 >>> sys-apps/elfix-0.9.2

Mon Nov 16 12:25:36 2015 >>> media-libs/libpng-1.6.19

Mon Nov 16 12:25:46 2015 >>> sys-apps/less-481

Mon Nov 16 12:25:52 2015 >>> dev-perl/IO-Socket-SSL-2.12.0

Mon Nov 16 12:26:22 2015 >>> dev-libs/libxml2-2.9.2-r4

Mon Nov 16 12:26:42 2015 >>> dev-libs/libxslt-1.1.28-r5

Mon Nov 16 12:31:44 2015 >>> dev-libs/glib-2.44.1-r1
```

Another strange thing is that I can't quit from screen anymore. Screens hangs after CTRL-D. When this happens I can see ^C chars in the shell, so the key code itself seems to go through.

I installed zsh and in zsh CTRL-C is working, but bash is broken (I already re-emerged bash and readline).

Does anyone have an idea? Do you need some more information?

Greets,

Matthias

EDIT: ksh is also working, but emerging gettext hangs on "checking for working sleep..." (if I kill the conftest process, it continues). So there seems to be a little more broken.

----------

## khayyam

Matthias ... within and without screen what is the interupt key?

```
$ awk -F";" '/intr/{print $1}' <(stty -a)
```

Also, what TERM is set, again, both within and without screen.

It might also be worth providing 'emerge --info'. 

 *Anarcho wrote:*   

> EDIT: ksh is also working, but emerging gettext hangs on "checking for working sleep..." (if I kill the conftest process, it continues). So there seems to be a little more broken.

 

The fact that zsh and ksh work suggests its not a deeper issue, the above may not be related ... btw, zsh doesn't use readline.

best ... khayLast edited by khayyam on Mon Nov 23, 2015 3:48 pm; edited 1 time in total

----------

## Anarcho

Hi,

without screen:

```
maz@server ~ $ awk -F";" '/intr/{print $1}' <(stty -a)

intr = ^C

maz@server ~ $ echo $TERM

xterm
```

In screen only TERM changes to screen. But in screen CTRL-C is also non-working. The same settings are set in ksh/zsh where is is working.

And emerge --info:

```
maz@server ~ $ emerge --info

Portage 2.2.20.1 (python 2.7.10-final-0, hardened/linux/amd64, gcc-4.8.4, glibc-2.20-r2, 4.1.6-hardened x86_64)

=================================================================

System uname: Linux-4.1.6-hardened-x86_64-Intel-R-_Xeon-R-_CPU_E3-1241_v3_@_3.50GHz-with-gentoo-2.2

KiB Mem:    32864184 total,   1092528 free

KiB Swap:   31250424 total,  29703144 free

Timestamp of repository gentoo: Mon, 23 Nov 2015 02:00:01 +0000

sh bash 4.3_p42

ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1

app-shells/bash:          4.3_p42::gentoo

dev-java/java-config:     2.2.0::gentoo

dev-lang/perl:            5.20.2::gentoo

dev-lang/python:          2.7.10::gentoo, 3.3.5-r1::gentoo, 3.4.3::gentoo

dev-util/cmake:           3.3.1-r1::gentoo

dev-util/pkgconfig:       0.28-r2::gentoo

sys-apps/baselayout:      2.2::gentoo

sys-apps/openrc:          0.17::gentoo

sys-apps/sandbox:         2.6-r1::gentoo

sys-devel/autoconf:       2.69::gentoo

sys-devel/automake:       1.13.4::gentoo, 1.14.1::gentoo, 1.15::gentoo

sys-devel/binutils:       2.25.1-r1::gentoo

sys-devel/gcc:            4.8.4::gentoo, 4.9.3::gentoo

sys-devel/gcc-config:     1.7.3::gentoo

sys-devel/libtool:        2.4.6::gentoo

sys-devel/make:           4.1-r1::gentoo

sys-kernel/linux-headers: 3.18::gentoo (virtual/os-headers)

sys-libs/glibc:           2.20-r2::gentoo

Repositories:

gentoo

    location: /usr/portage

    sync-type: rsync

    sync-uri: rsync://rsync.gentoo.org/gentoo-portage

    priority: -1000

dfreise

    location: /var/lib/layman/dfreise

    masters: gentoo

    priority: 0

x-portage

    location: /usr/local/portage

    masters: gentoo

    priority: 1

gt-overlay

    location: /var/lib/layman/gt-overlay

    masters: gentoo

    priority: 2

ACCEPT_KEYWORDS="amd64"

ACCEPT_LICENSE="* -@EULA"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=native -O2 -pipe"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/lib64/fax /usr/share/gnupg/qualified.txt /var/spool/fax/etc"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.6/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cli-php5.6/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-march=native -O2 -pipe"

DISTDIR="/usr/portage/distfiles"

FCFLAGS="-O2 -pipe"

FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"

FFLAGS="-O2 -pipe"

GENTOO_MIRRORS="http://distfiles.gentoo.org"

LANG="de_DE.utf8"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

MAKEOPTS="-j8"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

USE="acl amd64 avx avx2 berkdb bindist bzip2 cli cracklib crypt cxx dnssec dri gdbm hardened iconv iproute2 ipv6 jpeg justify lxc mmx mmxext modules multilib mysql ncurses nls nptl openmp pam pax_kernel pcre pie png postgres readline seccomp session sse sse2 sse4_1 sse4_2 ssl ssp ssse3 tcpd threads tiff unicode urandom xattr xtpax zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="proxy proxy_http actions alias auth_basic authn_alias authn_anon authn_core authn_dbm authn_file authz_core authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif socache_shmcb speling status unique_id unixd userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext avx ssse3 avx2 sse sse2 sse3 sse4_1 sse4_2" ELIBC="glibc" FRITZCAPI_CARDS="fcpci" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="de" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4 python3_3" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64" RUBY_TARGETS="ruby20 ruby21" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
```

I tried to downgrade glibc but without success, that's why it's not the current version in emerge --info.

----------

## khayyam

 *Anarcho wrote:*   

> In screen only TERM changes to screen. But in screen CTRL-C is also non-working. The same settings are set in ksh/zsh where is is working.

 

Mathias ... as I said, zsh doesn't use readline (not sure about ksh, but it likely doesn't either ... at least there is no dependency on it). The fact that this is hardened makes it more difficult for me to debug, as I'm fairly unfamilar with it, nor how various components (and useflags) interact. So, I'm not sure what to suggest, or where you might look (other than perhaps your logs).

best ... khay

----------

## Ant P.

I'd say it's related to the bash-completion bug, but you don't have that use flag enabled. May be the same root cause though.

----------

## khayyam

 *Ant P. wrote:*   

> I'd say it's related to the bash-completion bug, but you don't have that use flag enabled. May be the same root cause though.

 

Ant ... I was thinking the same after reading your post, and re-reading that thread.

@matthias ... you might try 'bash --noprofile' to disable the reading of /etc/profile and so test if anything set there, including profile.d/*.sh, are effecting tty.

best ... khay

----------

## Anarcho

Thanks khay and ant for your answers.

bash --noprofile doesn't make a change.

EDIT: OK, another strange thing that seems related: I can't kill e.g. watch using normal SIGTERM, I have to send SIGKILL. It seems like the SIGTERM is somehow broken? Maybe I need a restart...

----------

## Hu

What is the output of cat /proc/PID/status where PID is a process that survives a signal that should have killed it?

----------

## Anarcho

Hi Hu,

status is (watch in this example):

```
Name:   watch

State:   S (sleeping)

Tgid:   5240

Ngid:   0

Pid:   5240

PPid:   5196

TracerPid:   0

Uid:   1000   1000   1000   1000

Gid:   410   410   410   410

FDSize:   256

Groups:   10 16 248 410 1312 1313 

NStgid:   5240

NSpid:   5240

NSpgid:   5240

NSsid:   5196

VmPeak:      10908 kB

VmSize:      10904 kB

VmLck:          0 kB

VmPin:          0 kB

VmHWM:       2996 kB

VmRSS:       2996 kB

VmData:        580 kB

VmStk:        132 kB

VmExe:         20 kB

VmLib:       2232 kB

VmPTE:         40 kB

VmPMD:         12 kB

VmSwap:          0 kB

Threads:   1

SigQ:   1/128211

SigPnd:   0000000000000000

ShdPnd:   0000000000000000

SigBlk:   fffffffe3bfae207

SigIgn:   0000000001000000

SigCgt:   0000000008084003

CapInh:   0000000000000000

CapPrm:   0000000000000000

CapEff:   0000000000000000

CapBnd:   0000003fffffffff

Seccomp:   0

Cpus_allowed:   ff

Cpus_allowed_list:   0-7

Mems_allowed:   1

Mems_allowed_list:   0

voluntary_ctxt_switches:   34

nonvoluntary_ctxt_switches:   2
```

----------

## Hu

Your watch has many signals blocked that should not be blocked.  From the low end, you have SIGHUP, SIGINT, SIGQUIT, SIGUSR1 blocked.  I suggest you examine the status of the parent of watch to see if it has those signals blocked.  If yes, examine the parent of that process.  Repeat until you find the eldest process in the tree with those signals blocked, then show us the /proc/PID/status for that process.

----------

## Anarcho

Thank you Hu for pointing me to the correct direction!

SSHD was the evil process with the signal block mask.

I tried to start a second SSHD (from the ssh-session) with another Port which was attached to the init-process but still has the same signal mask. I then startet the second SSHD using a cronjob, because the crond has a correct signal mask. This sshd was working as expected. I could then restart the first sshd from the second one and had a working sshd again.

Thanks again all of you for your fast help!

Greetings,

Matthias

----------

