Re: rpmdatabse error in installation

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

 



> On Thu, 2004-08-05 at 08:21, garima@xxxxxxxxxxxxxx wrote:
>> error: cannot get exclusive lock on /users/extra/plusers/rpmdb/Packages
>
> I have found the place in the source of rpm where this message
> apparently comes from.
>   struct flock l;
>   memset(&l, 0, sizeof(l));
>   l.l_whence = 0;
>   l.l_start = 0;
>   l.l_len = 0;
>   l.l_type = (dbi->dbi_mode & (O_RDWR|O_WRONLY))
> 		? F_WRLCK : F_RDLCK;
>   l.l_pid = 0;
>
>   rc = fcntl(fdno, F_SETLK, (void *) &l);
>
> This means the program has already opened the file, presumably for
> write, so there cannot be a write permissions issue.
>
>>From what I can see in the man page for fcntl(2), the only possibility
> left is that some other process is having a lock on the file. If the
> same process already holds a lock, the call will not fail.
>
> I suggest you try again, and if it fails again, run
>
>   /usr/sbin/lsof | grep Packages
>
> This command is not foolproof in your case, since you cannot run it as
> root, but it is likely that the process having the lock is running as
> you, and then lsof is allowed to se the process' open files. If there
> are hard links to the Packages file, you have to grep for those names
> too.
>
> Failing that, the following C program can tell you the process ID of the
> process that holds the lock:
>
> #include <unistd.h>
> #include <fcntl.h>
> #include <stdio.h>
> #include <errno.h>
>
> main(int argc, char *argv[])
> {
>     struct flock l;
>     int ret;
>     int fd = open(argv[1], O_RDWR, 0666);
>     if (fd < 0) {
> 	fprintf(stderr, "Cannot open %s for read-write: %s.\n",
> 		argv[1] ? argv[1] : "(null)", strerror(errno));
> 	exit(1);
>     }
>     bzero((void*)&l, sizeof(l));
>     l.l_type = F_WRLCK;
>
>     ret = fcntl(fd, F_GETLK, &l);
>     if (ret < 0) {
> 	fprintf(stderr, "Unable to get file lock information on %s: %s.\n",
> 		argv[1], strerror(errno));
> 	exit(1);
>     }
>     if (l.l_type == F_UNLCK) {
> 	printf("%s: not locked.\n", argv[1]);
> 	exit(0);
>     }
>     printf("%s: Process %d has %s lock ", argv[1], l.l_pid,
> 	   l.l_type == F_WRLCK ? "an exclusive" : "a shared");
>     if (!l.l_start && !l.l_len)
> 	printf("on the entire file.\n");
>     else if (!l.l_len)
> 	printf("on the tail starting from byte number %d.\n", l.l_start);
>     else
> 	printf("on %d bytes starting from byte number %d.\n", l.l_len,
> l.l_start);
>     exit(0);
> }
>

thanks a lot
but this program is giving the following message on the machine i want to
install:

Unable to get file lock information on
/users/extra/plusers/rpmdb/Packages: Permission denied.

and the following mesaage on the machine on which installation was
successful:
/home/users/garima/rpmdb/Packages: not locked.

but again when i unistall it from the above machine in the following ways
these errors are found:
[garima@pc33 garima]$ rpm -e optex-1.0-1.i386.rpm
error: cannot get exclusive lock on /var/lib/rpm/Packages
error: cannot open Packages index using db3 - Operation not permitted (1)
error: cannot open /var/lib/rpm/packages.rpm
[garima@pc33 garima]$ rpm -e --dbpath $HOME/rpmdb optex-1.0-1.i386.rpm
error: package optex-1.0-1.i386.rpm is not installed

what i interpret from above errors is that database entry for the rpm was
made in the /var/lib/rpm databse not in $HOME/rpmdb . but at the
installation time it could be easily installed.

what do u say about this.i dont no why so many problems are coming.plz help!!


_______________________________________________
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