[Samba] AW: Unable to open configuration file "/etc/smb.conf" (or whereve r i specify)

Uli Luckas Uli.Luckas at abakusag.de
Tue Aug 13 08:02:00 GMT 2002


Hi,
it looks like you have something really messed up on your system.
The size of the file is 1243 bytes (from strace) but 0 bytes are being read.
If you had no permission to read the strace would have looked like this:
open("/etc/samba/smb.conf", O_RDONLY|O_LARGEFILE) = -1 EACCES (Permission
denied)

A quick look at the source code reveals:
/etc/samba/smb.conf is opened in file_load (lib/util_file.c) which is being
called from OpenConfFile (param/params.c). Then fd_load tries to read the
file into memory.
"Unable to open configuration file" is only being printed if file_load
returns NULL which is being called if fd_load returns NULL which it does as
the read returns 0 instead of 1243 (strace).

This code is not verry complex but I really can't see how this can fail...
May be your filesystem is broken. Can you "strace cat /etc/samba/smb.conf"
and compare the open fstat and read calls?

char *fd_load(int fd, size_t *size)
{
        SMB_STRUCT_STAT sbuf;
        char *p;

        if (sys_fstat(fd, &sbuf) != 0) return NULL;

        p = (char *)malloc(sbuf.st_size+1);
        if (!p) return NULL;

        if (read(fd, p, sbuf.st_size) != sbuf.st_size) {
                SAFE_FREE(p);
                return NULL;
        }
        p[sbuf.st_size] = 0;

        if (size) *size = sbuf.st_size;

        return p;
}

Uli

> -----Ursprüngliche Nachricht-----
> Von: nero one [mailto:nero_oner at yahoo.com]
> Gesendet: Dienstag, 13. August 2002 18:14
> An: Uli Luckas
> Cc: samba at lists.samba.org
> Betreff: Unable to open configuration file "/etc/smb.conf" 
> (or wherever
> i specify)
> 
> 
> --- Uli Luckas <Uli.Luckas at abakusag.de> wrote:
> > Try these two:
> > bash> which testparam
> > should tell you which testparam is being started. Is it 
> where you expect it
> > to be?
> > bash> strace /full/path/testparam
> > Gives you information on all system calls called from 
> within testparam. It
> > will give quite a bit of output and somewhere near the end 
> you will find
> > something like:
> > open("/usr/lib/smb.conf", O_RDONLY|O_LARGEFILE) = ...
> > 
> > This would give you a hint to what testparam is trying to 
> open and why it
> > fails.
> > Of course you need strace to be installed and you need to be root.
> 
> Good idea.  Here's the result of the strace.  I can't really 
> figure out why it borks.
> 
> "open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT (No such 
> file or directory)"
> It seems to look for this file in /etc . . only I don't have 
> any mention of any ld.so.preload* on
> my system.  
> 
> write(1, "Load smb config files from /etc/"..., 47Load smb 
> config files from /etc/samba/smb.conf
> ) = 47
> stat64("/etc/samba/smb.conf", {st_mode=S_IFREG|0644, 
> st_size=1243, ...}) = 0
> open("/etc/samba/smb.conf", O_RDONLY|O_LARGEFILE) = 3
> fstat64(3, {st_mode=S_IFREG|0644, st_size=1243, ...}) = 0
> read(3, "", 0)                          = 0
> close(3)                                = 0
> write(1, "params.c:OpenConfFile() - Unable"..., 
> 83params.c:OpenConfFile() - Unable to open
> configuration file "/etc/samba/smb.conf":
> ) = 83
> write(1, "\tSuccess\n", 9       Success
> )              = 9
> brk(0x80c0000)                          = 0x80c0000
> write(1, "Error loading services.\n", 24Error loading services.
> ) = 24
> munmap(0x129000, 4096)                  = 0
> _exit(1)                                = ?
> 
> Would it be broken due to the "..." as opposed to specifying 
> /etc/samba/smb.conf?
> Seems that the fstat isn't returning with anything, and the 
> read is expecting the fstat to do so?
> 
> If anyone can help shed light on this - it'd be much 
> appreciated.  If there's anything else I can
> do to further help in resolving the problem, please let me 
> know.  We have already determined in
> prior emails that the configuration file is operational on 
> other systems.  Once again, the
> description of the issue is the following.  The full result 
> of the strace follows:
> 
> [root][/etc/samba]: pwd && ls -all && testparm
> /etc/samba
> total 12
> drwxr-xr-x    2 root     root         4096 Aug 12 19:38 .
> drwxr-xr-x   32 root     root         4096 Aug 12 19:33 ..
> -rw-r--r--    1 root     root         1243 Aug 12 19:38 smb.conf
> Load smb config files from /etc/samba/smb.conf
> params.c:OpenConfFile() - Unable to open configuration file 
> "/etc/samba/smb.conf":
>         Success
> Error loading services.
> 
> [root][/etc/samba]: testparm /etc/samba/smb.conf
> Load smb config files from /etc/samba/smb.conf
> params.c:OpenConfFile() - Unable to open configuration file 
> "/etc/samba/smb.conf":
>         Success
> Error loading services.
> [root][/etc/samba]:
> 
> [root][~]: strace /usr/bin/testparm
> execve("/usr/bin/testparm", ["/usr/bin/testparm"], [/* 26 
> vars */]) = 0
> uname({sys="Linux", node="maddog1", ...}) = 0
> brk(0)                                  = 0x80be148
> open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT (No such 
> file or directory)
> open("/etc/ld.so.cache", O_RDONLY)      = 3
> fstat64(3, {st_mode=S_IFREG|0644, st_size=10769, ...}) = 0
> old_mmap(NULL, 10769, PROT_READ, MAP_PRIVATE, 3, 0) = 0x129000
> close(3)                                = 0
> open("/lib/libdl.so.2", O_RDONLY)       = 3
> read(3, 
> "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\340!\0"..., 
> 1024) = 1024
> fstat64(3, {st_mode=S_IFREG|0755, st_size=66114, ...}) = 0
> old_mmap(NULL, 14072, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) 
> = 0x12c000
> mprotect(0x12f000, 1784, PROT_NONE)     = 0
> old_mmap(0x12f000, 4096, PROT_READ|PROT_WRITE, 
> MAP_PRIVATE|MAP_FIXED, 3, 0x2000) = 0x12f000
> close(3)                                = 0
> open("/lib/libnsl.so.1", O_RDONLY)      = 3
> read(3, 
> "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0pB\0\000"..., 
> 1024) = 1024
> fstat64(3, {st_mode=S_IFREG|0755, st_size=390111, ...}) = 0
> old_mmap(NULL, 98304, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) 
> = 0x130000
> mprotect(0x145000, 12288, PROT_NONE)    = 0
> old_mmap(0x145000, 4096, PROT_READ|PROT_WRITE, 
> MAP_PRIVATE|MAP_FIXED, 3, 0x14000) = 0x145000
> old_mmap(0x146000, 8192, PROT_READ|PROT_WRITE, 
> MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) =
> 0x146000
> close(3)                                = 0
> open("/lib/libcrypt.so.1", O_RDONLY)    = 3
> read(3, 
> "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0P\22\0\000"...
> , 1024) = 1024
> fstat64(3, {st_mode=S_IFREG|0755, st_size=78762, ...}) = 0
> old_mmap(NULL, 187356, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 
> 0) = 0x148000
> mprotect(0x14e000, 162780, PROT_NONE)   = 0
> old_mmap(0x14e000, 4096, PROT_READ|PROT_WRITE, 
> MAP_PRIVATE|MAP_FIXED, 3, 0x5000) = 0x14e000
> old_mmap(0x14f000, 158684, PROT_READ|PROT_WRITE, 
> MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) =
> 0x14f000
> close(3)                                = 0
> open("/usr/lib/libpopt.so.0", O_RDONLY) = 3
> read(3, 
> "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\300\23"..., 
> 1024) = 1024
> fstat64(3, {st_mode=S_IFREG|0755, st_size=32507, ...}) = 0
> old_mmap(NULL, 29820, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) 
> = 0x176000
> mprotect(0x17d000, 1148, PROT_NONE)     = 0
> old_mmap(0x17d000, 4096, PROT_READ|PROT_WRITE, 
> MAP_PRIVATE|MAP_FIXED, 3, 0x6000) = 0x17d000
> close(3)                                = 0
> open("/lib/libc.so.6", O_RDONLY)        = 3
> read(3, 
> "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\314\316"..., 
> 1024) = 1024
> fstat64(3, {st_mode=S_IFREG|0755, st_size=5077798, ...}) = 0
> old_mmap(NULL, 1351940, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 
> 0) = 0x17e000
> mprotect(0x2be000, 41220, PROT_NONE)    = 0
> old_mmap(0x2be000, 28672, PROT_READ|PROT_WRITE, 
> MAP_PRIVATE|MAP_FIXED, 3, 0x13f000) = 0x2be000
> old_mmap(0x2c5000, 12548, PROT_READ|PROT_WRITE, 
> MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) =
> 0x2c5000
> close(3)                                = 0
> open("/lib/libc.so.6", O_RDONLY)        = 3
> read(3, 
> "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\314\316"..., 
> 1024) = 1024
> fstat64(3, {st_mode=S_IFREG|0755, st_size=5077798, ...}) = 0
> close(3)                                = 0
> open("/lib/libc.so.6", O_RDONLY)        = 3
> read(3, 
> "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\314\316"..., 
> 1024) = 1024
> fstat64(3, {st_mode=S_IFREG|0755, st_size=5077798, ...}) = 0
> close(3)                                = 0
> open("/lib/libc.so.6", O_RDONLY)        = 3
> read(3, 
> "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\314\316"..., 
> 1024) = 1024
> fstat64(3, {st_mode=S_IFREG|0755, st_size=5077798, ...}) = 0
> close(3)                                = 0
> open("/lib/libc.so.6", O_RDONLY)        = 3
> read(3, 
> "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\314\316"..., 
> 1024) = 1024
> fstat64(3, {st_mode=S_IFREG|0755, st_size=5077798, ...}) = 0
> close(3)                                = 0
> old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, 
> MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2c9000
> mprotect(0x17e000, 1310720, PROT_READ|PROT_WRITE) = 0
> mprotect(0x17e000, 1310720, PROT_READ|PROT_EXEC) = 0
> munmap(0x129000, 10769)                 = 0
> getpid()                                = 23563
> time(NULL)                              = 1029254406
> brk(0)                                  = 0x80be148
> brk(0x80be170)                          = 0x80be170
> brk(0x80bf000)                          = 0x80bf000
> open("/etc/localtime", O_RDONLY)        = 3
> fstat64(3, {st_mode=S_IFREG|0644, st_size=1218, ...}) = 0
> old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, 
> MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x129000
> read(3, 
> "TZif\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\2\0\0\0\2\0"..., 
> 4096) = 1218
> close(3)                                = 0
> munmap(0x129000, 4096)                  = 0
> gettimeofday({1029254406, 741487}, NULL) = 0
> fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
> old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, 
> MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x129000
> ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
> write(1, "Load smb config files from /etc/"..., 47Load smb 
> config files from /etc/samba/smb.conf
> ) = 47
> stat64("/etc/samba/smb.conf", {st_mode=S_IFREG|0644, 
> st_size=1243, ...}) = 0
> open("/etc/samba/smb.conf", O_RDONLY|O_LARGEFILE) = 3
> fstat64(3, {st_mode=S_IFREG|0644, st_size=1243, ...}) = 0
> read(3, "", 0)                          = 0
> close(3)                                = 0
> write(1, "params.c:OpenConfFile() - Unable"..., 
> 83params.c:OpenConfFile() - Unable to open
> configuration file "/etc/samba/smb.conf":
> ) = 83
> write(1, "\tSuccess\n", 9       Success
> )              = 9
> brk(0x80c0000)                          = 0x80c0000
> write(1, "Error loading services.\n", 24Error loading services.
> ) = 24
> munmap(0x129000, 4096)                  = 0
> _exit(1)                                = ?
> [root][~]:
> 
> 
> __________________________________________________
> Do You Yahoo!?
> HotJobs - Search Thousands of New Jobs
> http://www.hotjobs.com
> 



More information about the samba mailing list