Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Samba] Attempting to expunge tombstones with samba-tool

214 views
Skip to first unread message

lingpanda101 via samba

unread,
Oct 26, 2016, 11:50:03 AM10/26/16
to
Hello,

I receive the following when I attempt to expunge deleted tombstone
records. I'm attempting to fix several dbcheck 'Not removing dangling
forward link' errors.

samba-tool domain tombstones expunge
ERROR(<type 'exceptions.AttributeError'>): uncaught exception - 'module'
object has no attribute 'time'
File
"/usr/local/samba/lib/python2.7/site-packages/samba/netcmd/__init__.py",
line 176, in _run
return self.run(*args, **kwargs)
File
"/usr/local/samba/lib/python2.7/site-packages/samba/netcmd/domain.py",
line 3791, in run
current_time = long(time.time())

I recently updated from 4.5.0 to 4.5.1. Do I need to reanimate deleted
objects before I can expunge them? Thanks.


--
- James


--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/options/samba

Rowland Penny via samba

unread,
Oct 26, 2016, 12:20:08 PM10/26/16
to
On Wed, 26 Oct 2016 11:41:23 -0400
lingpanda101 via samba <sa...@lists.samba.org> wrote:

> Hello,
>
> I receive the following when I attempt to expunge deleted tombstone
> records. I'm attempting to fix several dbcheck 'Not removing dangling
> forward link' errors.
>
> samba-tool domain tombstones expunge
> ERROR(<type 'exceptions.AttributeError'>): uncaught exception -
> 'module' object has no attribute 'time'
> File
> "/usr/local/samba/lib/python2.7/site-packages/samba/netcmd/__init__.py",
> line 176, in _run
> return self.run(*args, **kwargs)
> File
> "/usr/local/samba/lib/python2.7/site-packages/samba/netcmd/domain.py",
> line 3791, in run
> current_time = long(time.time())
>
> I recently updated from 4.5.0 to 4.5.1. Do I need to reanimate
> deleted objects before I can expunge them? Thanks.
>
>

That isn't your problem, if you look closely, you seem to have a problem
with your version of 'time'. If you look at the top of 'domain.py',
there is this line:

import time

This tells python to use the 'time' module, this module should have the
attribute 'time', you can check this with 'pydoc time.time' run in
a terminal, this should produce info about 'time.time'.

Rowland

lingpanda101 via samba

unread,
Oct 26, 2016, 12:50:04 PM10/26/16
to

I get

time.time = time(...)
time() -> floating point number

Return the current time in seconds since the Epoch.
Fractions of a second may be present if the system clock provides them.


I'm running Ubuntu 12.04 on these DC's. Python version 2.7.3. Thanks.


--
- James

Rowland Penny via samba

unread,
Oct 26, 2016, 1:30:04 PM10/26/16
to
On Wed, 26 Oct 2016 12:47:16 -0400

Hmm, that is what I get, Andrew wrote this code, perhaps he has the
answer ?

Rowland

Garming Sam via samba

unread,
Oct 26, 2016, 6:50:02 PM10/26/16
to
This is almost certainly because of a build artifact.
python/samba/netcmd/time.py was renamed to nettime.py but there is
likely to be a time.pyc file floating around in your directories.

The reason it was renamed was so that the samba tool time command wasn't
confused with the python time module, but this necessarily causes issues
with existing installs unfortunately. The fix is mostly simple, just to
remove any conflicting files but until then, it will trigger issues like
these.

Cheers,

Garming

Rowland Penny via samba

unread,
Oct 27, 2016, 4:10:02 AM10/27/16
to
On Thu, 27 Oct 2016 11:46:53 +1300
Garming Sam <gar...@catalyst.net.nz> wrote:

> This is almost certainly because of a build artifact.
> python/samba/netcmd/time.py was renamed to nettime.py but there is
> likely to be a time.pyc file floating around in your directories.
>
> The reason it was renamed was so that the samba tool time command
> wasn't confused with the python time module, but this necessarily
> causes issues with existing installs unfortunately. The fix is mostly
> simple, just to remove any conflicting files but until then, it will
> trigger issues like these.
>
> Cheers,
>
> Garming
>

If that is the case, why is there a line at the top of 'domain.py' like
this:

import time

surely, from what you are saying, it should be:

import samba.netcmd.nettime as time

Not that it would work, the only thing in nettime.py is a class called
'cmd_time'

lingpanda101 via samba

unread,
Oct 27, 2016, 12:50:02 PM10/27/16
to
On 10/26/2016 6:46 PM, Garming Sam via samba wrote:
> This is almost certainly because of a build artifact.
> python/samba/netcmd/time.py was renamed to nettime.py but there is
> likely to be a time.pyc file floating around in your directories.
>
> The reason it was renamed was so that the samba tool time command wasn't
> confused with the python time module, but this necessarily causes issues
> with existing installs unfortunately. The fix is mostly simple, just to
> remove any conflicting files but until then, it will trigger issues like
> these.
>
> Cheers,
>
> Garming
>
>
>

I removed both /samba/netcmd/time.py and time.pyc. This allowed the
command to succeed.

samba-tool domain tombstones expunge
Removed 0 objects and 0 links successfully

Unfortunately it didn't remove the errors. Is this bug
https://bugzilla.samba.org/show_bug.cgi?id=12385 patched in 4.5.1? Thanks.


--
- James

Rowland Penny via samba

unread,
Oct 27, 2016, 1:40:03 PM10/27/16
to
On Thu, 27 Oct 2016 12:39:32 -0400

lingpanda101 via samba <sa...@lists.samba.org> wrote:

> On 10/26/2016 6:46 PM, Garming Sam via samba wrote:
> > This is almost certainly because of a build artifact.
> > python/samba/netcmd/time.py was renamed to nettime.py but there is
> > likely to be a time.pyc file floating around in your directories.
> >
> > The reason it was renamed was so that the samba tool time command
> > wasn't confused with the python time module, but this necessarily
> > causes issues with existing installs unfortunately. The fix is
> > mostly simple, just to remove any conflicting files but until then,
> > it will trigger issues like these.
> >
> > Cheers,
> >
> > Garming
> >
> >
> >
>
> I removed both /samba/netcmd/time.py and time.pyc. This allowed the
> command to succeed.
>
> samba-tool domain tombstones expunge
> Removed 0 objects and 0 links successfully
>
> Unfortunately it didn't remove the errors. Is this bug
> https://bugzilla.samba.org/show_bug.cgi?id=12385 patched in 4.5.1?
> Thanks.
>
>

That explains it better, what Garming meant was that there may be an
old version of the Samba 'time.py' in 'samba.netcmd' and this would be
used instead of the correct python 'time' module. This is clearly a
bug and Samba should check to see if the Samba 'time.py' exists and
delete it on upgrade, or at least document this could happen.

You may have got the command to work, but if you had any tombstones,
they didn't appear to get deleted 'Removed 0 objects'

Rowland

Andrew Bartlett via samba

unread,
Oct 27, 2016, 9:30:04 PM10/27/16
to
On Thu, 2016-10-27 at 12:39 -0400, lingpanda101 via samba wrote:
> On 10/26/2016 6:46 PM, Garming Sam via samba wrote:
> > This is almost certainly because of a build artifact.
> > python/samba/netcmd/time.py was renamed to nettime.py but there is
> > likely to be a time.pyc file floating around in your directories.
> >
> > The reason it was renamed was so that the samba tool time command
> > wasn't
> > confused with the python time module, but this necessarily causes
> > issues
> > with existing installs unfortunately. The fix is mostly simple,
> > just to
> > remove any conflicting files but until then, it will trigger issues
> > like
> > these.
> >
> > Cheers,
> >
> > Garming
> >
> >
> >
>
> I removed both /samba/netcmd/time.py and time.pyc. This allowed the 
> command to succeed.
>
> samba-tool domain tombstones expunge
> Removed 0 objects and 0 links successfully
>
> Unfortunately it didn't remove the errors.  Is this bug 
> https://bugzilla.samba.org/show_bug.cgi?id=12385 patched in 4.5.1?
> Thanks.

Sadly no. It missed the cut and I want to fix one more thing.

Andrew Bartlett

--
Andrew Bartlett
https://samba.org/~abartlet/
Authentication Developer, Samba Team https://samba.org
Samba Development and Support, Catalyst IT
https://catalyst.net.nz/services/samba

0 new messages