Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 453514 - sys-libs/glibc-2.15-r3: nscd initscript fails while daemon starts
Summary: sys-libs/glibc-2.15-r3: nscd initscript fails while daemon starts
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-22 11:22 UTC by Roman Žilka
Modified: 2013-04-13 14:25 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Žilka 2013-01-22 11:22:31 UTC
On my amd64 laptop bootup nscd starts OK:
------ rc.log ------
 * /var/run/nscd: creating directory
 * Starting Name Service Cache Daemon ...
 [ ok ]
------ rc.log ------

But then:
# /etc/init.d/nscd restart
 * Shutting down Name Service Cache Daemon ...                                                                [ ok ]
 * Starting Name Service Cache Daemon ...
 * start-stop-daemon: caught an interrupt
 * start-stop-daemon: /usr/sbin/nscd died                                                                     [ !! ]
 * ERROR: nscd failed to start
# pidof nscd
10924
# /etc/init.d/nscd stop
 * WARNING: nscd is already stopped
# nscd -g
nscd configuration:

              0  server debug level
            11s  server runtime
              5  current number of threads
             32  maximum number of threads
              0  number of times clients had to wait
             no  paranoia mode enabled
           3600  restart internal
              5  reload count

passwd cache:

            yes  cache is enabled
(...)

# killall nscd
# pidof nscd
# /etc/init.d/nscd start
 * Starting Name Service Cache Daemon ...
 * start-stop-daemon: caught an interrupt
 * start-stop-daemon: /usr/sbin/nscd died                                                                     [ !! ]
 * ERROR: nscd failed to start
# pidof nscd
11004
# grep 11004 /var/log/syslog
Jan 22 11:55:35 palantir nscd: 11004 cannot stat() file `/var/db/passwd.db': No such file or directory
Jan 22 11:55:35 palantir nscd: 11004 cannot stat() file `/var/db/group.db': No such file or directory

On my x86 server the initscript fails even on system bootup. The daemon runs nonetheless.

Reproducible: Always




# emerge --info glibc openrc
Portage 2.1.11.31 (hardened/linux/amd64, gcc-4.6.3, glibc-2.15-r3, 3.7.0 x86_64)
=================================================================
                        System Settings
=================================================================
System uname: Linux-3.7.0-x86_64-Intel-R-_Core-TM-_i5-2520M_CPU_@_2.50GHz-with-gentoo-2.1
Timestamp of tree: Mon, 21 Jan 2013 19:45:02 +0000
ld GNU ld (GNU Binutils) 2.22
app-shells/bash:          4.2_p37
dev-lang/python:          2.7.3-r2, 3.2.3
dev-util/cmake:           2.8.9
dev-util/pkgconfig:       0.27.1
sys-apps/baselayout:      2.1-r1
sys-apps/openrc:          0.11.8
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.9.6-r3, 1.11.6
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.6.3
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.6 (virtual/os-headers)
sys-libs/glibc:           2.15-r3
Repositories: gentoo
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -fomit-frame-pointer -march=core2 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -maes -mpclmul -mpopcnt -mcx16"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -fomit-frame-pointer -march=core2 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -maes -mpclmul -mpopcnt -mcx16"
DISTDIR="/tmp/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs candy collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news noinfo parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://gentoo.mirror.dkm.cz/pub/gentoo/ http://ftp.fi.muni.cz/pub/linux/gentoo/ http://gentoo.mirror.web4u.cz/ http://gentoo.wheel.sk/ ftp://gentoo.mirror.dkm.cz/pub/gentoo/"
LANG="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--as-needed"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="--compress --compress-level=9"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/boot/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.cz.gentoo.org/gentoo-portage"
USE="X a52 aac acpi aes-ni alsa amd64 avx bash-completion berkdb bluetooth bzip2 cddb cjk cli cracklib crypt cxx dri encode ffmpeg flac fontconfig ftp gdbm geoip gif gnutls gps gzip hardened hddtemp iconv icu idn imap javascript jpeg jpeg2k justify libass lm_sensors lzma lzo matroska mbox mime mms mmx mmxext modules mp3 mp4 mpeg mplayer mudflap multilib musicbrainz ncurses nls nocd nptl ogg opengl pam pax_kernel pcre pda pdf png postscript quicktime raw readline recode session smp sockets sound spell sse sse2 sse3 sse4 sse4_1 sse4_2 ssl ssse3 svg syslog threads truetype udev unicode urandom usb v4l vdpau videos vim-syntax vorbis wifi x264 xcomposite xosd xscreensaver xv xvid 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="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets 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 keyboard mouse synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en cs ja" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="intel vesa" 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, EMERGE_DEFAULT_OPTS, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, USE_PYTHON

=================================================================
                        Package Settings
=================================================================

sys-libs/glibc-2.15-r3 was built with the following:
USE="hardened (multilib) -debug -gd -profile (-selinux) -vanilla"
CFLAGS="-pipe -march=core2 -O2 -fno-strict-aliasing -fno-stack-protector"
CXXFLAGS="-pipe -march=core2 -O2 -fno-strict-aliasing"


sys-apps/openrc-0.11.8 was built with the following:
USE="(multilib) ncurses pam unicode -debug -newnet (-prefix) (-selinux) -static-libs"
CFLAGS="-O2 -pipe -fomit-frame-pointer -march=core2 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -maes -mpclmul -mpopcnt"
CXXFLAGS="-O2 -pipe -fomit-frame-pointer -march=core2 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -maes -mpclmul -mpopcnt"
Comment 1 SpanKY gentoo-dev 2013-01-22 17:47:39 UTC
don't know why ssd is saying 'caught an interrupt'

ignoring that, nscd has been changed recently to fork less which should make it easier for ssd to keep track.  so if it starts working with that, i'm inclined to let that fix this issue.
Comment 2 Roman Žilka 2013-01-22 22:51:57 UTC
If it is of any help, I can confirm that with an strace -f /etc/init.d/nscd start:

[pid 26707] execve("/sbin/start-stop-daemon", ["start-stop-daemon", "--start", "--quiet", "--background", "--exec", "/usr/sbin/nscd", "--pidfile", "/var/run/nscd/nscd.pid", "--"], [/* 49 vars */]) = 0

(...)

[pid 26707] clone(Process 26708 attached
child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x28333b539d0) = 26708

(...)

[pid 26708] execve("/usr/sbin/nscd", ["/usr/sbin/nscd"], [/* 40 vars */]) = 0


(...)

[pid 26708] open("/var/run/nscd/nscd.pid", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 26708] clone(Process 26709 attached
child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x2e0290609d0) = 26709
[pid 26709] set_robust_list(0x2e0290609e0, 24) = 0
[pid 26708] exit_group(0)               = ?
[pid 26709] open("/var/run/nscd/nscd.pid", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
[pid 26708] +++ exited with 0 +++
[pid 26707] <... nanosleep resumed> NULL) = ? ERESTART_RESTARTBLOCK (Interrupted by signal)

(...)

PID 26709 goes on living happily. SSD (26707) is nanosleep()ing for a grace period to wait for the new daemon (26708) to settle down, but the sleep is interrupted by 26708 exiting - thus the "caught an interrupt" (EINTR). SSD doesn't see 26708's fork and considers the daemon dead.

Either nscd should wait in 26708 for more than SSD's grace period:), or it shouldn't fork into 26709 at all, or SSD should be taught to understand second forks, or the initscript shouldn't call SSD with "--background" as a quick&dirty fix (saw this tip somewhere on the net).
Comment 3 Roman Žilka 2013-04-13 14:25:26 UTC
I just found out this is fixed in glibc-2.16. I'm closing this in accordance with SpanKY's comment. Please, stabilize 2.16 it if this bug is enough of a reason.