[Samba] Samba 4.2.0rc4 fails to start up

Thomas Schulz schulz at adi.com
Tue Feb 10 20:25:06 MST 2015

I added debuging as follows:

        /* no O_EXCL, existence check is via the fcntl lock */

        lockfile_fd = open(lockfile_name.buf, O_NONBLOCK|O_CREAT|O_WRONLY,
        if (lockfile_fd == -1) {
                ret = errno;
                DEBUG(1, ("%s: open failed: %s\n", __func__, strerror(errno)));
                return ret;
        DEBUG(1, ("lock file name is: %s\n",lockfile_name.buf));

        lck = (struct flock) {
                .l_type = F_WRLCK,
                .l_whence = SEEK_SET

        ret = fcntl(lockfile_fd, F_SETLK, &lck);
        if (ret == -1) {
                ret = errno;
                DEBUG(1, ("%s: fcntl failed: %s\n", __func__, strerror(ret)));
                goto fail_close;

        DEBUG(1, ("unique is %u\n", unique));
        unique_len = snprintf(buf, sizeof(buf), "%ju\n", (uintmax_t)unique);
        DEBUG(1, ("unique_len is: %i\n", unique_len));

        /* shorten a potentially preexisting file */

        ret = ftruncate(lockfile_fd, unique_len);
        if (ret == -1) {
                ret = errno;
                DEBUG(1, ("%s: ftruncate failed: %s\n", __func__,
                goto fail_unlink;

And the output of ./smbd -i -d 2 is:

lock file name is: /opt/local/samba4/var/cache/lck/7561
unique is 0
unique_len is: -1
messaging_dgm_lockfile_create: ftruncate failed: Invalid argument
messaging_dgm_init: messaging_dgm_create_lockfile failed: Invalid argument
messaging_dgm_init failed: Invalid argument

Tom Schulz
Applied Dynamics Intl.
schulz at adi.com

More information about the samba mailing list