Amanda-Users

Re: planner: could not lock log file

2008-09-12 08:03:36
Subject: Re: planner: could not lock log file
From: Taalaibek Ashirov <tashirov AT unido-ichet DOT org>
To: John Hein <jhein AT timing DOT com>
Date: Fri, 12 Sep 2008 14:58:28 +0300
On Thu, 2008-09-11 at 09:27 -0600, John Hein wrote:
> John Hein wrote at 07:19 -0600 on Sep 11, 2008:
>  > Taalaibek Ashirov wrote at 10:31 +0300 on Sep 11, 2008:
>  >  > On Wed, 2008-09-10 at 09:56 -0600, John Hein wrote:
>  >  > > What happens when you compile and run this (as the backup user)?
>  >  > > 
>  >  > > #include <err.h>
>  >  > > #include <fcntl.h>
>  >  > > #include <stdio.h>
>  >  > > int
>  >  > > main()
>  >  > > {
>  >  > >     struct flock lock;
>  >  > >     int fd = open("/var/log/amanda/dotProject/foo", O_RDWR | O_CREAT);
>  >  > >     if (fd < 0) err(1, "open");
>  >  > > 
>  >  > >     lock.l_type = F_WRLCK;
>  >  > >     lock.l_whence = SEEK_SET;
>  >  > >     int r = fcntl(fd, F_SETLKW, &lock);
>  >  > >     if (r < 0) err(1, "fnctl");
>  >  > >     return 0;
>  >  > > }
>  >  > 
>  >  > Hi John! Thank you for your efforts. I got the same error:
>  >  > 
>  >  > $ ./test
>  >  > test: fnctl: Invalid argument
>  > 
>  > Then it's an issue with your system somehow, not amanda.
>  > 
>  > Looking at src/sys/kern/kern_descrip.c, you can get EINVAL is if you
>  > pass in l_type that is not F_RDLCK, F_WRLCK or F_UNLCK.
>  > 
>  > Try adding the printf below and rebuilding your kernel.  Then run the
>  > above test.  Look for the printf in dmesg (or /var/log/messages if you
>  > are using a default syslog.conf).
>  > 
>  > Index: kern_descrip.c
>  > ===================================================================
>  > RCS file: /base/FreeBSD-CVS/src/sys/kern/kern_descrip.c,v
>  > retrieving revision 1.279.2.15.2.1
>  > diff -u -p -r1.279.2.15.2.1 kern_descrip.c
>  > --- kern_descrip.c 14 Feb 2008 11:46:40 -0000      1.279.2.15.2.1
>  > +++ kern_descrip.c 11 Sep 2008 13:17:25 -0000
>  > @@ -533,6 +533,7 @@ kern_fcntl(struct thread *td, int fd, in
>  >                        flp, F_POSIX);
>  >                    break;
>  >            default:
>  > +printf("invalid l_type: %#x\n", flp->l_type);
>  >                    error = EINVAL;
>  >                    break;
>  >            }
> 
> Let me recant, it may be amanda at fault or a combination.  If you add
> the following to the initialization of 'lock' in the test, does your
> problem go away?
> 
>     lock.l_start = 0;
>     lock.l_len = 0;
> 
> If the short test passes, add those lines to amflock() in amanda's
> common-src/amflock.c, rebuild amanda and give it another shot.

Yes, in the test the problem goes away. Actually, I've installed amanda
from ports. Now I deinstalled amanda and got latest source version from
amandas website, added those lines to amflock(). When I did make it gave
me error like "lock is not declared". I declared lock same as test
(struct flock lock;). This time I got this:

...
creating amflock-test
make: don't know how to make amgpgcrypt. Stop
*** Error code 2
Stop in /root/amanda-2.6.0p2/common-src.
*** Error code 1
Stop in /root/amanda-2.6.0p2.
web# 

Is there any thing else I missed?