Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 407571

Summary: sys-apps/util-linux-2.20.1-r1 - authpriv.err: Mar 9 20:20:43 agetty[26171]: /dev/tty1: cannot get controlling tty: Operation not permitted
Product: Gentoo Linux Reporter: Alex Efros <powerman-asdf>
Component: [OLD] Core systemAssignee: Anthony Basile <blueness>
Status: RESOLVED OBSOLETE    
Severity: normal CC: base-system
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: .config

Description Alex Efros 2012-03-09 18:26:41 UTC
After upgrading from 2.19.1-r1 to 2.20.1-r1 agetty stop working. When it started as:
    /sbin/agetty 38400 tty1 linux
it print to logs this:
    authpriv.err: Mar  9 20:20:43 agetty[26171]: /dev/tty1: cannot get controlling tty: Operation not permitted
and exit.

Workaround is degrade both util-linux and sysvinit (because latest sysvinit require util-linux-2.20):
    emerge -av '<sys-apps/util-linux-2.20' '<sys-apps/sysvinit-2.88-r3'
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2012-03-12 12:06:48 UTC
Isn't there an agetty already running on tty1? What if you sent that a TERM signal? Does it come back up?
Comment 2 Alex Efros 2012-03-12 13:32:20 UTC
(In reply to comment #1)
> Isn't there an agetty already running on tty1? What if you sent that a TERM
> signal? Does it come back up?

There is no other *getty running at all. There is no conflicts and restarting agetty doesn't helps. It's as simple as agetty from util-linux-2.19.1 works, and agetty from util-linux-2.20.1 doesn't works.
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2012-03-13 20:26:27 UTC
(In reply to comment #2)
> It's as simple as agetty from util-linux-2.19.1 works, and agetty from 
> util-linux-2.20.1 doesn't works.

Of course it isn't that simple! For example, 2.20.1's agetty has been working for months on several of my systems without any problems. :)

1) Please post your `emerge --info' output in a comment.
2) Please post your `emerge -vpq sys-apps/util-linux' output in a comment.
Comment 4 Alex Efros 2012-03-13 20:59:55 UTC
I know at least one other person with same issue. He was installing Gentoo (in way similar to mine, also with hardened and many other settings copied from my system) and noticed broken agetty after install.


[ebuild   R   ] sys-apps/util-linux-2.19.1-r1  USE="cramfs crypt ncurses nls perl unicode -loop-aes -old-linux (-selinux) -slang (-uclibc)" 


Portage 2.1.10.44 (hardened/linux/amd64, gcc-4.5.3, glibc-2.13-r4, 3.2.2-hardened-r1 x86_64)
=================================================================
System uname: Linux-3.2.2-hardened-r1-x86_64-Intel-R-_Core-TM-_i7-2600K_CPU_@_3.40GHz-with-gentoo-2.0.3
Timestamp of tree: Thu, 08 Mar 2012 16:15:01 +0000
app-shells/bash:          4.1_p9
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.7.2-r3, 3.2.2
dev-util/cmake:           2.8.6-r4
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.0.3
sys-apps/openrc:          0.9.8.4
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.11.1
sys-devel/binutils:       2.21.1-r1
sys-devel/gcc:            4.5.3-r2
sys-devel/gcc-config:     1.5-r2
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r1
sys-kernel/linux-headers: 3.1 (virtual/os-headers)
sys-libs/glibc:           2.13-r4
Repositories: gentoo perl-experimental vmware powerman local
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /opt/upsmon-usb/EXT/DownOS /opt/upsmon-usb/EXT/JSystem /service /usr/inferno/keydb /usr/inferno/lib /usr/inferno/services /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/openvpn/easy-rsa /var/log /var/qmail/alias /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/usr/portage-distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync webrsync-gpg"
FFLAGS="-march=native -O2 -pipe"
GENTOO_MIRRORS="http://portage.org.ua/ http://gentoo.iteam.net.ua/ http://mirror.mdfnet.se/gentoo http://gentoo.mneisen.org/ http://gentoo.wheel.sk/"
LANG="ru_RU.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en ru"
MAKEOPTS="-j9"
PKGDIR="/usr/portage-packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="--exclude ChangeLog --delete-excluded"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/perl-experimental /var/lib/layman/vmware /var/lib/layman/powerman /usr/local/portage"
SYNC="rsync://rsync4.ua.gentoo.org/gentoo-portage"
USE="X a52 aac acl alac alsa amd64 avx bash-completion berkdb bzip2 cdda cddb cli cracklib crypt cxx dbus dri dts dvd flac gdbm gif gnutls gpg gpm hardened iconv id3tag idn jpeg jpeg2k justify libnotify mac mad matroska mbox mmx mng modules mp3 mpeg mudflap multilib musepack mysql ncurses network-cron nls nptl nptlonly nsplugin ogg opengl openmp pam pax_kernel pcre perl png pppd qt3support readline session spell sse sse2 sse3 sse4_1 sse4_2 ssl ssse3 svg sysfs tcpd theora tiff truetype unicode urandom vdpau vim-syntax vorbis wavpack x264 xorg xosd xv xvid xvmc zlib" 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" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="log_config vhost_alias autoindex alias rewrite dir deflate filter mime negotiation auth_basic authn_file authz_host authz_user authz_groupfile cgi actions headers env setenvif" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" 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 ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en ru" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia nv nouveau" 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:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS
Comment 5 Alex Efros 2012-03-13 21:02:24 UTC
after unmasking current versions:

# emerge -vpq sys-apps/util-linux sys-apps/sysvinit
[ebuild     U ] sys-apps/util-linux-2.20.1-r1 [2.19.1-r1] USE="cramfs crypt ncurses nls perl unicode -ddate% -loop-aes -old-linux (-selinux) -slang -static-libs% (-uclibc)" 
[ebuild     U ] sys-apps/sysvinit-2.88-r3 [2.88-r2] USE="(-ibm) (-selinux) -static" 
[blocks b     ] <sys-apps/sysvinit-2.88-r3 ("<sys-apps/sysvinit-2.88-r3" is blocking sys-apps/util-linux-2.20.1-r1)
Comment 6 SpanKY gentoo-dev 2012-10-10 04:28:25 UTC
can't help but assume it's a kernel setting getting in the way
Comment 7 Alex Efros 2012-10-10 08:06:11 UTC
I've found a workaround: instead of running
    /sbin/agetty [opts]
run
    /usr/bin/setsid /sbin/agetty [opts]

Looks like code which call setsid(2) was removed from agetty since util-linux-2.20. I don't know is it needed when agetty started from /etc/inittab, but I'm using runit instead of sysvinit and agetty started just like all other services under runsv supervisor utility, and in this use case agetty process surely doesn't session leader by default and thus require setsid(2) call.
Comment 8 SpanKY gentoo-dev 2012-10-11 05:10:56 UTC
(In reply to comment #7)

yes, upstream changed from calling setsid() to using ioctl() and termios calls.  maybe the hardened patchset interferes with that method ?

what if you add --hangup to the agetty command line ?  does that help ?

http://git.kernel.org/?p=utils/util-linux/util-linux.git;a=commitdiff;h=3aa6b68f7e19fa3e1c2bba75bee921a98b7b46af
Comment 9 Alex Efros 2012-10-11 10:42:56 UTC
(In reply to comment #8)
> what if you add --hangup to the agetty command line ?  does that help ?

No:

authpriv.warn: Oct 11 13:41:50 agetty[6077]: /dev/tty2: cannot get controlling tty: Operation not permitted
authpriv.warn: Oct 11 13:41:50 agetty[6077]: /dev/tty2: cannot get controlling tty: Operation not permitted
authpriv.err: Oct 11 13:41:50 agetty[6077]: /dev/tty2: cannot set process group: Inappropriate ioctl for device
Comment 10 SpanKY gentoo-dev 2012-10-11 15:41:54 UTC
could you attach your kernel .config ?  if you boot a kernel with various features turned off, does this start working ?
Comment 11 Alex Efros 2012-10-11 16:08:05 UTC
(In reply to comment #10)
> could you attach your kernel .config ?  if you boot a kernel with various
> features turned off, does this start working ?

I've tried to find kernel option which may affect this behavior, but failed. If you've ideas about which kernel options I should try to switch on/off - let me know.
Comment 12 Alex Efros 2012-10-11 16:08:47 UTC
Created attachment 326296 [details]
.config