Subject: Re: How to delete log files
To: David Albert <david_albert@comcast.net>
From: Simon Burge <simonb@NetBSD.org>
List: port-cobalt
Date: 03/03/2007 16:16:30
David Albert wrote:

> Simon Burge wrote:
> > David Albert wrote:
> >   
> >> Unfortunately, newsyslog does not do the trick.  Do you have any other 
> >> ideas?
> >>     
> >
> > What is the contents of your /etc/newsyslog.conf ?
> >
> > Also, what does "newsyslog -n" show when you run it?
> >
> > Cheers,
> > Simon.
> >
> >   
> Everything looks good with -n, but when I actually run the command,
> it aborts with an "Operation not permitted" error.  This is the same error
> I get when I try to manually delete any file in /var/log.  See trace below:
> 
> raq2: {55} newsyslog -n /var/log/maillog
> 
> /var/log/maillog <7Z>: --> trim log (log age > interval)
>  [ .... ]
> 
> raq2: {56} newsyslog -v /var/log/maillog
> 
> /var/log/maillog <7Z>: --> trim log (log age > interval)
>   rm -f /var/log/maillog.6
>   rm -f /var/log/maillog.6.gz
>   mv /var/log/maillog.5.gz /var/log/maillog.6.gz
> newsyslog: /var/log/maillog.5.gz: Operation not permitted
> 
> raq2: {57} whoami
> root
> raq2: {58} rm -f /var/log/maillog.5.gz
> rm: /var/log/maillog.5.gz: Operation not permitted

This last almost sounds like you've got some funny flags set on
the file and/or directory (clutching at straws here!).  What
does "ls -loa /var/log" show?  "mount -vv" and "df" output may be
helpful too...

One more option might be to boot to single user mode and
"fsck -f /dev/..." for the partition where your /var lives to
make sure there's nothing wrong with the filesystem.

Cheers,
Simon.