Bug 51673

Summary: mysqld exits if 'db' in /etc/nsswitch.conf
Product: [Retired] Red Hat Linux Reporter: John Dalbec <jpdalbec>
Component: nss_dbAssignee: Trond Eivind Glomsrxd <teg>
Status: CLOSED NOTABUG QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: nalin
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-08-13 19:59:03 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description John Dalbec 2001-08-13 19:45:00 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.4.3-12 i686)

Description of problem:
I had been using the nss_db package with 'db' in the appropriate services
lines in nsswitch.conf.  Mysqld appears to start OK but exits immediately
if 'db' is used for passwd/shadow/group.

How reproducible:
Always

Steps to Reproduce:
1.Install nss-db and mysql-server
2.cd /var/db; make; edit /etc/nsswitch.conf to add 'db' to the beginning of
the passwd, shadow, and group lines
3./etc/rc.d/init.d/mysqld start
	

Actual Results:  [ OK ], but 'ps ax' shows no mysqld.

Expected Results:  I should see several copies of mysqld running.

Additional info:

Adding 'db' to the beginning of the 'services' line in /etc/nsswitch.conf
causes getservbyname() to crash.  This was preventing mysql_install_db from
running.

Comment 1 John Dalbec 2001-08-13 19:58:07 UTC
Sorry, forgot version info.
db3-3.1.17-7
mysql-server-3.23.36-1
BTW main(){getservbyname("mysql","tcp");} doesn't segfault with 'db' at the
beginning of the 'passwd' 'shadow' 'group' 'protocols' 'rpc' and 'services'
lines.  Maybe a conflict between the libraries?

Comment 2 Trond Eivind Glomsrxd 2001-08-13 19:58:58 UTC
MySQL comes with it's own version of db, causing namespace collision (a generic
problem with using db as an authentication method with apps using db). Not
really fixable, but you should be able to work around it by using nscd or
avoiding the use of db as an authentication method.

Comment 3 John Dalbec 2001-08-13 20:12:16 UTC
Hm, starting nscd doesn't work around this problem.  Is there more that I need to do to "use" nscd?  (I see the lack of documentation for nscd has already 
been reported.)

Comment 4 Trond Eivind Glomsrxd 2001-08-13 20:15:30 UTC
No, starting it should be sufficient and should run the lookups in a different
space (which also helps when using static rpms using methods with dynamic
modules). The mysql user can be looked up in the db?

Comment 5 John Dalbec 2001-08-13 21:03:53 UTC
Mysqld uses the nscd socket, if present.  However, it also loads /etc/nsswitch.conf and reads the files/databases directly.
This behavior is probably buried in some header file.
[pid 16112] open("/etc/nsswitch.conf", O_RDONLY) = 3
[pid 16112] fstat64(3, {st_mode=S_IFREG|0644, st_size=1759, ...}) = 0
[pid 16112] mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40018000
[pid 16112] read(3, "#\n# /etc/nsswitch.conf\n#\n# An ex"..., 4096) = 1759
[pid 16112] read(3, "", 4096)           = 0
[pid 16112] close(3)                    = 0
[pid 16112] munmap(0x40018000, 4096)    = 0
[pid 16112] open("/etc/ld.so.cache", O_RDONLY) = 3
[pid 16112] fstat64(3, {st_mode=S_IFREG|0644, st_size=35199, ...}) = 0
[pid 16112] old_mmap(NULL, 35199, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40018000
[pid 16112] close(3)                    = 0
[pid 16112] open("/lib/libnss_files.so.2", O_RDONLY) = 3
[pid 16112] read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0`\"\0\000"..., 1024) = 1024
[pid 16112] fstat64(3, {st_mode=S_IFREG|0755, st_size=275531, ...}) = 0
[pid 16112] old_mmap(NULL, 43432, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x40225000
[pid 16112] mprotect(0x4022f000, 2472, PROT_NONE) = 0
[pid 16112] old_mmap(0x4022f000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x9000) = 0x4022f000
[pid 16112] close(3)                    = 0
[pid 16112] munmap(0x40018000, 35199)   = 0
[pid 16112] open("/etc/services", O_RDONLY) = 3
[pid 16112] fcntl64(3, F_GETFD)         = 0
[pid 16112] fcntl64(3, F_SETFD, FD_CLOEXEC) = 0
[pid 16112] fstat64(3, {st_mode=S_IFREG|0644, st_size=17639, ...}) = 0
[pid 16112] mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40018000
[pid 16112] read(3, "# /etc/services:\n# $Id: services"..., 4096) = 4096
[pid 16112] read(3, "ios-ns\t137/udp\nnetbios-dgm\t138/t"..., 4096) = 4096
[pid 16112] read(3, "ell\t\t514/tcp\t\tcmd\t\t# no password"..., 4096) = 4096
[pid 16112] close(3)                    = 0
[pid 16112] munmap(0x40018000, 4096)    = 0
[pid 16112] socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
[pid 16112] setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
[pid 16112] bind(3, {sin_family=AF_INET, sin_port=htons(3306), sin_addr=inet_addr("0.0.0.0")}}, 16) = 0
[pid 16112] listen(3, 50)               = 0
[pid 16112] geteuid32()                 = 0
[pid 16112] socket(PF_UNIX, SOCK_STREAM, 0) = 4
[pid 16112] connect(4, {sin_family=AF_UNIX, path="                             
                                                         /var/run/.nscd_socket"}, 110) = 0
[pid 16112] write(4, "\2\0\0\0\0\0\0\0\6\0\0\0", 12) = 12
[pid 16112] write(4, "mysql\0", 6)      = 6
[pid 16112] read(4, "\10_\27@\1\0\0\0\6\0\0\0\2\0\0\0\33\0\0\0\33\0\0\0\r\0"..., 36) = 36
[pid 16112] read(4, "mysql\0x\0MySQL Server\0/var/lib/my"..., 46) = 46
[pid 16112] close(4)                    = 0
[pid 16112] open("/etc/ld.so.cache", O_RDONLY) = 4
[pid 16112] fstat64(4, {st_mode=S_IFREG|0644, st_size=35199, ...}) = 0
[pid 16112] old_mmap(NULL, 35199, PROT_READ, MAP_PRIVATE, 4, 0) = 0x40018000
[pid 16112] close(4)                    = 0
[pid 16112] open("/lib/libnss_db.so.2", O_RDONLY) = 4
[pid 16112] read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0 \30\0\000"..., 1024) = 1024
[pid 16112] fstat64(4, {st_mode=S_IFREG|0755, st_size=250631, ...}) = 0
[pid 16112] old_mmap(NULL, 21648, PROT_READ|PROT_EXEC, MAP_PRIVATE, 4, 0) = 0x40230000
[pid 16112] mprotect(0x40235000, 1168, PROT_NONE) = 0
[pid 16112] old_mmap(0x40235000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 4, 0x4000) = 0x40235000
[pid 16112] close(4)                    = 0
[pid 16112] open("/lib/libdb-3.1.so", O_RDONLY) = 4
[pid 16112] read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\200\364"..., 1024) = 1024
[pid 16112] fstat64(4, {st_mode=S_IFREG|0755, st_size=555898, ...}) = 0
[pid 16112] old_mmap(NULL, 495084, PROT_READ|PROT_EXEC, MAP_PRIVATE, 4, 0) = 0x40236000
[pid 16112] mprotect(0x402ad000, 7660, PROT_NONE) = 0
[pid 16112] old_mmap(0x402ad000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 4, 0x76000) = 0x402ad000
[pid 16112] close(4)                    = 0
[pid 16112] munmap(0x40018000, 35199)   = 0
[pid 16112] --- SIGSEGV (Segmentation fault) ---


Comment 6 Trond Eivind Glomsrxd 2001-08-13 21:14:53 UTC
It will still look at the file, but shouldn't use the information...