MacPorts 2.0.3 uninstalling package gives error "this entry does not own the given file" I'm hitting an error while trying to uninstall some packages in my MacPorts 2.0.3 installation, and I can't figure out what's causing them or how to resolve them.  Googling around lead to nothing addressing this case, so I'm hoping that fellow users here will have an answer.

Here is an example of the command and the error (where this is all done in a sudo'ed shell, so the problem is unrelated to root permissions):


port uninstall sleuthkit
--->  Deactivating sleuthkit @3.2.3_0+universal
Error: Target org.macports.deactivate returned: this entry does not own the given file
Log for sleuthkit is at: /opt/local/var/macports/logs/_opt_local_var_macports_registry_portfiles_sleuthkit_3.2.3_0+universal/sleuthkit/main.log
Warning: Failed to execute portfile from registry for sleuthkit @3.2.3_0+universal
--->  Deactivating sleuthkit @3.2.3_0+universal
Error: Target org.macports.uninstall returned: this entry does not own the given file
Warning: Failed to execute portfile from registry for sleuthkit @3.2.3_0+universal
--->  Deactivating sleuthkit @3.2.3_0+universal
Error: Target org.macports.deactivate returned: this entry does not own the given file
Log for sleuthkit is at: /opt/local/var/macports/logs/_opt_local_var_macports_registry_portfiles_sleuthkit_3.2.3_0+universal/sleuthkit/main.log
Warning: Failed to execute portfile from registry for sleuthkit @3.2.3_0+universal
--->  Deactivating sleuthkit @3.2.3_0+universal
Error: port uninstall failed: this entry does not own the given file


Looking in the file /opt/local/var/macports/logs/_opt_local_var_macports_registry_portfiles_sleuthkit_3.2.3_0+universal/sleuthkit/main.log reveals nothing particularly useful to me:



version:1 
:debug:main Executing org.macports.main (sleuthkit) 
:debug:deactivate deactivate phase started at Tue Jan 31 19:18:24 EST 2012 
:debug:deactivate Executing org.macports.deactivate (sleuthkit) 
:msg:deactivate --->  Deactivating sleuthkit @3.2.3_0+universal 
:error:deactivate Target org.macports.deactivate returned: this entry does not own the given file 
:debug:deactivate Backtrace: this entry does not own the given file 
    while executing 
"$port deactivate $imagefiles" 
    invoked from within 
"registry::write { 
            $port deactivate $imagefiles 
            foreach file $files { 
                _deactivate_file $file 
            } 
    ..." 
    (procedure "_deactivate_contents" line 37) 
    invoked from within 
"_deactivate_contents $requested [$requested files] $force" 
    (procedure "portimage::deactivate" line 54) 
    invoked from within 
"registry_deactivate $subport $version $revision $portvariants [array get user_options]" 
    (procedure "portdeactivate::deactivate_main" line 3) 
    invoked from within 
"$procedure $targetname" 
:info:deactivate Warning: the following items did not execute (for sleuthkit): org.macports.deactivate 
:notice:deactivate Log for sleuthkit is at: /opt/local/var/macports/logs/_opt_local_var_macports_registry_portfiles_sleuthkit_3.2.3_0+univ\
ersal/sleuthkit/main.log 


Does anyone know what is behind these errors?  More importantly, how can I fix my installation so that this doesn't happen anymore?
Re install the required package then restart the computer and then run the uninstall.

Get into an elevated shell by using sudo -su firstly each time.