Bug#772641: apt: "E: Setting TIOCSCTTY for slave fd <fd> failed" when run as a session leader
Package: apt
Version: 1.0.9.4
Severity: serious
Justification: Regression, breaks other software (e.g. puppet)
Dear Maintainer,
apt 1.0.9.4 does not work correctly when run as a session leader,
reporting a failed ioctl on the pty used by dpkg. When called by puppet,
it emits the following output:
Error: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install ntpdate' returned : Reading package lists...
Building dependency tree...
Reading state information...
Recommended packages:
lockfile-progs
The following NEW packages will be installed:
ntpdate
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/74.1 kB of archives.
After this operation, 233 kB of additional disk space will be used.
E: Setting TIOCSCTTY for slave fd 18 failed! - ioctl (1: Operation not permitted)
Selecting previously unselected package ntpdate.
(Reading database ... 46412 files and directories currently installed.)
Preparing to unpack .../ntpdate_1%3a4.2.6.p5+dfsg-3.1+b1_amd64.deb ...
Unpacking ntpdate (1:4.2.6.p5+dfsg-3.1+b1) ...
Processing triggers for man-db (2.7.0.2-3) ...
E: Setting TIOCSCTTY for slave fd 18 failed! - ioctl (1: Operation not permitted)
Setting up ntpdate (1:4.2.6.p5+dfsg-3.1+b1) ...
Apart from the error message, it also appears that apt is trying to close its
own control terminal, thus SIGHUP'ing itself, signaling an unclean exit:
23631 open("/dev/pts/2", O_RDWR|O_CLOEXEC) = 19
...
23631 close(19) = 0
23631 close(18) = 0
23631 --- SIGHUP {si_signo=SIGHUP, si_code=SI_KERNEL} ---
23631 +++ killed by SIGHUP +++
This has the side-effect of puppet marking the package installation as failed
and all downstream dependencies as unsatisfied.
This behavior was introduced in commit 299aea924c and can be trivially
reproduced using setsid:
# setsid -w apt-get install sm </dev/null
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
sm
0 upgraded, 1 newly installed, 0 to remove and 203 not upgraded.
Need to get 0 B/21,3 kB of archives.
After this operation, 108 kB of additional disk space will be used.
dpkg-preconfigure: unable to re-open stdin: No such file or directory
E: Setting TIOCSCTTY for slave fd 38 failed! - ioctl (1: Operation not permitted)
Selecting previously unselected package sm.
(Reading database ... 411612 files and directories currently installed.)
Preparing to unpack .../archives/sm_0.22.1-2_amd64.deb ...
Unpacking sm (0.22.1-2) ...
Processing triggers for hicolor-icon-theme (0.13-1) ...
Processing triggers for man-db (2.7.0.2-3) ...
Processing triggers for menu (2.1.47) ...
Processing triggers for mime-support (3.57) ...
Processing triggers for desktop-file-utils (0.22-1) ...
E: Setting TIOCSCTTY for slave fd 38 failed! - ioctl (1: Operation not permitted)
Setting up sm (0.22.1-2) ...
Processing triggers for menu (2.1.47) ...
setsid: child 5136 did not exit normally: Success
Regards,
Apollon
-- Package-specific info:
-- (no /etc/apt/preferences present) --
-- (/etc/apt/sources.list present, but not submitted) --
-- System Information:
Debian Release: 8.0
APT prefers testing
APT policy: (500, 'testing'), (90, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=el_GR.UTF-8, LC_CTYPE=el_GR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages apt depends on:
ii debian-archive-keyring 2014.3
ii gnupg 1.4.18-4
ii libapt-pkg4.12 1.0.9.4
ii libc6 2.19-13
ii libgcc1 1:4.9.1-19
ii libstdc++6 4.9.1-19
apt recommends no packages.
Versions of packages apt suggests:
pn apt-doc <none>
ii aptitude 0.6.11-1+b1
ii dpkg-dev 1.17.21
ii python-apt 0.9.3.11
-- debconf-show failed
Reply to: