Re: rpmdatabse error in installation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Third continued message...

Looking back to see if I could have made a mistake. I used grep to look
for the error message "cannot get exclusive", and found none. Then I
tried grep "cannot get", and found "cannot get %s lock on %s/%s\n".
There were a few others, but they all had continuations inconsistent
with "cannot get exclusive lock on /var/lib/rpm/Packages". A possibility
remains that rpm assembles the message from even smaller pieces, but I
find that quite unlikely.  The message "cannot get %s lock on" is issued
after doing fcntl(... F_SETLK, ...) and getting a nonzero result.

 rc = fcntl(fdno, F_SETLK, (void *) &l);
 if (rc) {
    /* Warning iff using non-private CDB locking. */
    rc = ((dbi->dbi_use_dbenv &&
           (dbi->dbi_eflags & DB_INIT_CDB) &&
           !(dbi->dbi_eflags & DB_PRIVATE))
          ? 0 : 1);
    rpmError( (rc ? RPMERR_FLOCK : RPMWARN_FLOCK),
             _("cannot get %s lock on %s/%s\n"),
            ((dbi->dbi_mode & (O_RDWR|O_WRONLY))
             ? _("exclusive") : _("shared")),
            dbhome, (dbfile ? dbfile : ""));

I must assume that the variable fdno really is an open file descriptor
for the file in the error message.

This happens in the function db3open() in the file rpmdb/db3.c. It is
not easy to track where this function is called, because it is inserted
into a call table and the call table is passed around, potentially there
can be any number of varable names pointing to that table in various
functions.

The next message is 

> error: cannot open Packages index using db3 - Operation not permitted
(1)

This message has to be "cannot open %s index using db%d - %s (%d)\n" in
file rpmdb.c:

        rc = (*mydbvecs[_dbapi]->open) (db, rpmtag, &dbi);
        if (rc) {
            static int _printed[32];
            if (!_printed[dbix & 0x1f]++)
                rpmError(RPMERR_DBOPEN,
                        _("cannot open %s index using db%d - %s
(%d)\n"),
                        tagName(rpmtag), _dbapi,
                        (rc > 0 ? strerror(rc) : ""), rc);
            _dbapi = -1;
        }

This uses a table to call a suitable function, and prints an error
message if it gets a non-zero result. The string after the dash ( - ) is
gotten from the function strerror, which interprets the number rc.
Rc is not the error code from fcntl(), that code is in a variable errno.
It appears to be a bug in rpm, there is a comment in db3.c saying that
the function should return errno on failure, but the code shown above
sets rc to 1, and that explains the message text "Operation not
permitted" instead of "Permission denied". 

I think there is a quite strong case for saying that rpm does open the
file /var/lib/rpm/Packages or a corresponding one, and that the fcntl()
call fails. To be absolutely sure one would have to compile a local
version of rpm inserting some messages around the fcntl call.

The case where you run get-lock-owner is simpler, the error message is
directly derived from errno. I think you must look for a reason why
fcntl() fails with EACCES in get-lock-owner. I bet there must be a
process somewhere holding a lock on the file.

-Enrique


_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux