Discussion:
nscd exited with status 1, many files not found
(too old to reply)
Marco Moock
2024-08-01 19:44:29 UTC
Permalink
Hello!

I wanna run nscd to cache DNS entries.

After reinstalling glibc, I can properly start it. If I do a
system restart, I can't anymore. I haven't changed any config files. I
can reproduce that.

I get error 1 when trying to start it manually.

***@localhost:~# LANG=C /usr/sbin/nscd
child exited with status 1
***@localhost:~#

openat(AT_FDCWD, "/etc/nscd.conf", O_RDONLY) = 3
statx(3, "", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT|AT_EMPTY_PATH, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=2717, ...}) = 0
read(3, "#\n# /etc/nscd.conf\n#\n# An exampl"..., 4096) = 2717
read(3, "", 4096) = 0
close(3) = 0
openat(AT_FDCWD, "/var/run/nscd/nscd.pid", O_RDONLY) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
pipe([3, 4]) = 0

I think it is normal that the pid file doesn't exist when the process
isn't running, isn't it?

clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7f276e8) = 1115
close(4) = 0
read(3, "\1\0\0\0", 4) = 4
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0, NULL) = 1115
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=1115, si_uid=0, si_status=1, si_utime=0, si_stime=0} ---
openat(AT_FDCWD, "/usr/share/locale/de_DE.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
openat(AT_FDCWD, "/usr/share/locale/de_DE.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
openat(AT_FDCWD, "/usr/share/locale/de_DE/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
openat(AT_FDCWD, "/usr/share/locale/de.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
openat(AT_FDCWD, "/usr/share/locale/de.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
openat(AT_FDCWD, "/usr/share/locale/de/LC_MESSAGES/libc.mo", O_RDONLY) = 4
statx(4, "", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT|AT_EMPTY_PATH, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=149079, ...}) = 0
mmap2(NULL, 149079, PROT_READ, MAP_PRIVATE, 4, 0) = 0xb7c9a000
close(4) = 0
write(2, "Der Kind-Prozess endete mit Stat"..., 37Der Kind-Prozess endete mit Status 1
) = 37
close(3) = 0
exit_group(1) = ?
+++ exited with 1 +++



This is the init script.
#!/bin/sh
#
# nscd: Name Service Cache Daemon
#
# /etc/rc.d/rc.nscd
#
# Start/stop the nscd daemon

case "$1" in
start)
echo "Starting nscd..."
/usr/sbin/nscd
;;
stop)
echo "Stopping nscd..."
killall nscd
;;
restart)
$0 stop
$0 start
;;
status)
if pgrep nscd > /dev/null; then
echo "nscd is running."
else
echo "nscd is not running."
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac

exit 0
-------

What causes the problem here?
After reinstalling glibc, I can start and stop nscd without problem
until I do a restart.
--
kind regards
Marco

Send spam to ***@cartoonies.org
Henrik Carlqvist
2024-08-02 05:41:42 UTC
Permalink
Post by Marco Moock
Hello!
I wanna run nscd to cache DNS entries.
I think that nscd is more intended to cache NIS and LDAP maps. There are
other ways to configure caching DNS servers, anything from a full
featured bind configured as a caching DNS server only to lightweight
things like dnsmasq (included in Slackware) and pdnsd (not included in
Slackware).
Post by Marco Moock
openat(AT_FDCWD, "/var/run/nscd/nscd.pid", O_RDONLY) = -1 ENOENT (Datei
oder Verzeichnis nicht gefunden)
pipe([3, 4]) = 0
I think it is normal that the pid file doesn't exist when the process
isn't running, isn't it?
Yes, that should not be a problem, but what about the directory /var/run/
nscd? Maybe that could be a problem.
Post by Marco Moock
This is the init script.
#!/bin/sh #
# nscd: Name Service Cache Daemon #
# /etc/rc.d/rc.nscd #
# Start/stop the nscd daemon
case "$1" in start)
echo "Starting nscd..."
/usr/sbin/nscd ;;
stop)
echo "Stopping nscd..."
killall nscd ;;
restart)
$0 stop $0 start ;;
status)
if pgrep nscd > /dev/null; then echo "nscd is running."
else echo "nscd is not running."
fi ;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1 ;;
esac
exit 0 -------
What causes the problem here?
After reinstalling glibc, I can start and stop nscd without problem
until I do a restart.
I have a more simple aproach:

1) My /etc/rc.d/rc.local calls a custom /usr/local/etc/rc.d/rc.local
2) My /usr/local/etc/rc.d/rc.local has the following lines:

if [ -x /usr/local/etc/rc.d/rc.nscd ]; then
. /usr/local/etc/rc.d/rc.nscd
fi

3) My /usr/local/etc/rc.d/rc.nscd simply contains:

#!/bin/sh

if [ -x /usr/sbin/nscd ]; then
/usr/sbin/nscd
fi

But again, that configuration are for machines in a LDAP or NIS domain.
For those systems I have created a custom Slackware package containing
settings in a /etc/nscd.conf and that package also contains a var/run/
nscd directory.

Maybe nscd could also be used to cache DNS, but for that purpose I have
instead mostly used pdnsd during the years. If I would start from scratch
today I would probably use dnsmasq for that purpose, bind can be rather
cumbersome to configure.

regards Henrik
Petri Kaukasoina
2024-08-02 08:35:48 UTC
Permalink
...
Post by Henrik Carlqvist
Post by Marco Moock
After reinstalling glibc, I can start and stop nscd without problem
until I do a restart.
...
Post by Henrik Carlqvist
For those systems I have created a custom Slackware package containing
settings in a /etc/nscd.conf and that package also contains a var/run/
nscd directory.
Henrik, you have 14.2, don't you? In 14.2 /var/run was a directory on the
root file system. But in 15.0 it's a symlink to /run which is a tmpfs. The
directory /var/run/nscd is in the Slackware package but it does not survive
boot on the tmpfs. Maybe Marco should add this line to the /etc/rc.d/rc.nscd
script:

mkdir -p -m 0755 /var/run/nscd
Marco Moock
2024-08-02 17:04:00 UTC
Permalink
Post by Petri Kaukasoina
Henrik, you have 14.2, don't you? In 14.2 /var/run was a directory on
the root file system. But in 15.0 it's a symlink to /run which is a
tmpfs. The directory /var/run/nscd is in the Slackware package but it
does not survive boot on the tmpfs. Maybe Marco should add this line
I will try that.
Although, isn't that something that should be done by nscd itself?
--
kind regards
Marco

Send spam to ***@cartoonies.org
Henrik Carlqvist
2024-08-04 08:50:31 UTC
Permalink
Post by Marco Moock
Although, isn't that something that should be done by nscd itself?
I agree and googling on this will point to a number of bug reports in
different distributions about rather silently crasching without creating
the directory that it needs.

Depending on your level of laziness you might find it easier to adjust a
startup script than to patch source code and recompile.

Depending on the project, you might also find it easier to create and use
your own patches than to have the patches accepted upstream. However,
mostly it is easier to get patchs accepted if they are for buxfixes
rather than new features.

regards Henrik
Henrik Carlqvist
2024-08-05 17:03:54 UTC
Permalink
Post by Henrik Carlqvist
I agree and googling on this will point to a number of bug reports in
different distributions about rather silently crasching without creating
the directory that it needs.
After having studied how things look on Slackware 15.0 I kind of start to
reconsider this to be a bit buggy in Slackware.

On one hand, since 15.0 /var/run has become a symbolic link to /run which
is mounted as tmpfs by /etc/rc.d/rc.S

On the other hand, the glibc-2.33 package contains the directory
/var/run/nscd which for obvious reason will be lost after the reboot at
the end of the installation phase.

It seems to also be other packages trying to create things below (/var)/
run, like stunnel, samba, rpcbind, pam, mariadb, krb5, etc, dbus, cups. I
don't claim that all of these packages are broken like nscd, but I they
have been fixed to create anything needed below /run there should be no
need to have the installer install anything there.

regards Henrik

Henrik Carlqvist
2024-08-04 08:41:13 UTC
Permalink
Post by Petri Kaukasoina
Henrik, you have 14.2, don't you?
Yes, that is right, I originally configured nscd for 14.2 systems and
still have a 14.2 system at home (though not running nscd at home).
Post by Petri Kaukasoina
In 14.2 /var/run was a directory on
the root file system. But in 15.0 it's a symlink to /run which is a
tmpfs.
Whoops, I think that my nscd configuration in 15.0 was inherited from my
14.2 configuration. When I get to such a system I will need to check if
nscd is running... If it is not running, no user will probably notice as
the services are still reachable, but without local caching.

Thanks for pointing this out!
Post by Petri Kaukasoina
mkdir -p -m 0755 /var/run/nscd
I will probably also have to add such a line to my rc.nscd .

regards Henrik
Rich
2024-08-02 15:50:42 UTC
Permalink
Post by Henrik Carlqvist
Post by Marco Moock
Hello!
I wanna run nscd to cache DNS entries.
I think that nscd is more intended to cache NIS and LDAP maps. There are
other ways to configure caching DNS servers, anything from a full
featured bind configured as a caching DNS server only to lightweight
things like dnsmasq (included in Slackware) and pdnsd (not included in
Slackware).
Slackware ships with example config files for bind/named that provide a
caching server. The examples are in /var/named/caching-example/ and
the default /etc/named.conf is preset (at least on 15, likely was the
same on some number of prior releases) to make use of the caching
files. One just has to make /etc/rc.d/rc.bind executable, then run

/etc/rc.d/rc.bind start

to get a caching named running.

Then one would edit /etc/resolv.conf to point to the local caching
server to start using it.
Loading...