Opened 13 years ago

Closed 13 years ago

#30311 closed defect (worksforme)

After selfupdate to ports 2.0.0 I can no longer uninstall (unused) ports

Reported by: soehn@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: base Version: 2.0.0
Keywords: Cc: cristiano.fontana@…
Port:

Description (last modified by ryandesign (Ryan Carsten Schmidt))

When trying to uninstall a port port quits with the following error-message (example):

Error: port uninstall failed: error deleting "/opt/local/var/macports/software/bzip2/1.0.6_0": directory not empty

Change History (20)

comment:1 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)

comment:2 Changed 13 years ago by jmroot (Joshua Root)

Debug output? OS version?

comment:3 Changed 13 years ago by jmroot (Joshua Root)

Did your selfupdate complete successfully? The port image should be an archive, not a directory.

comment:4 in reply to:  3 Changed 13 years ago by soehn@…

Replying to jmr@…:

Did your selfupdate complete successfully? The port image should be an archive, not a directory.

Not sure. The first attempt lead to an error message just saying there is a log, but not saying where to find it. The next attempt said 2.0 was installed. OS is 10.6.8 If you tell me, where I will find the log file, I could attach it.

comment:5 Changed 13 years ago by jmroot (Joshua Root)

Run:

sudo port -df selfupdate

comment:6 in reply to:  5 Changed 13 years ago by soehn@…

Replying to jmr@…:

Run:

sudo port -df selfupdate

The end of the output was:

+ for file in registry.tcl registry_autoconf.tcl registry_util.tcl receipt_flat.tcl receipt_sqlite.tcl portimage.tcl portuninstall.tcl
+ /usr/bin/install -c -o root -g admin -m 444 portuninstall.tcl /opt/local/share/macports/Tcl/registry2.0/portuninstall.tcl
/usr/bin/install -c -o root -g admin -m 444 pkgIndex.tcl /opt/local/share/macports/Tcl/registry2.0
===> making install in src/darwintracelib1.0
/usr/bin/install -c -d -o root -g admin -m 755 /opt/local/share/macports/Tcl/darwintrace1.0
/usr/bin/install -c -o root -g admin -m 444 darwintrace.dylib /opt/local/share/macports/Tcl/darwintrace1.0
===> making install in src/port
< ../../doc/prefix.mtree /usr/sbin/mtree -U -d -e -p /opt/local > /dev/null
< ../../doc/base.mtree /usr/sbin/mtree -U -d -e -p /opt/local > /dev/null
/usr/bin/install -c -d -o root -g admin -m 755 /opt/local/bin
/usr/bin/install -c -d -o root -g admin -m 755 /opt/local/var/macports
/usr/bin/install -c -o root -g admin -m 555 port portindex portmirror /opt/local/bin/
/usr/bin/install -c -o root -g admin -m 444 port-help.tcl  /opt/local/var/macports/
cd /opt/local/bin && ln -s -f port portf
===> making install in src/programs
===> making install in src/programs/daemondo
mkdir -p build
/usr/bin/install -c -o root -g admin -m 555 build/daemondo /opt/local/bin
===> making install in tests
make[1]: Nothing to be done for `install'.
[ ! -f /opt/local/etc/macports/mp_version ] || rm -vf /opt/local/etc/macports/mp_version
/usr/bin/install -c -o root -g admin -m 444 setupenv.bash  /opt/local/share/macports/
/usr/bin/install -c -o root -g admin -m 444 macports-pubkey.pem  /opt/local/share/macports/
/usr/bin/tclsh src/upgrade_sources_conf_default.tcl "/opt/local"
/usr/bin/tclsh src/images_to_archives.tcl "/opt/local/share/macports/Tcl"
This could take a while...
sh: line 0: cd: /opt/local/var/macports/software/qca/2.0.2_0: No such file or directory
shell command "cd /opt/local/var/macports/software/qca/2.0.2_0 && /usr/bin/tar -cjf /opt/local/var/macports/software/qca/qca-2.0.2_0.darwin_10.i386.tbz2 * > /opt/local/var/macports/software/qca/error.log 2>&1" returned error 1
shell command failed (see log for details)
    while executing
"system "cd $location && $tarcmd -cjf $newlocation * > ${targetdir}/error.log 2>&1""
    ("foreach" body line 64)
    invoked from within
"foreach installed $ilist {
    set iname [lindex $installed 0]
    set iversion [lindex $installed 1]
    set irevision [lindex $installed 2]
    set ..."
    (file "src/images_to_archives.tcl" line 37)
make: *** [install] Error 1
shell command "cd /opt/local/var/macports/sources/rsync.macports.org/release/base && CC=/usr/bin/cc ./configure --prefix=/opt/local --with-tclpackage=/Library/Tcl --with-install-user=root --with-install-group=admin --with-directory-mode=0755 --enable-readline && make && make install" returned error 2
DEBUG: Error installing new MacPorts base: shell command failed (see log for details)
    while executing
"macports::selfupdate [array get global_options] base_updated"
Error: /opt/local/bin/port: port selfupdate failed: Error installing new MacPorts base: shell command failed (see log for details)

comment:7 Changed 13 years ago by jmroot (Joshua Root)

Resolution: worksforme
Status: newclosed

So you have qca @2.0.2_0 registered as installed, but its image directory has been deleted. Creating an empty directory there should allow the selfupdate to complete, but of course your qca port will still be broken and you should reinstall it.

sudo mkdir -p /opt/local/var/macports/software/qca/2.0.2_0
sudo port -df selfupdate

comment:8 in reply to:  7 Changed 13 years ago by soehn@…

Replying to jmr@…:

So you have qca @2.0.2_0 registered as installed, but its image directory has been deleted. Creating an empty directory there should allow the selfupdate to complete, but of course your qca port will still be broken and you should reinstall it.

sudo mkdir -p /opt/local/var/macports/software/qca/2.0.2_0
sudo port -df selfupdate

This does not work for me. qca port 2.0.2_6 is installed. Porticus says this is active, too. What can I do?

comment:9 Changed 13 years ago by soehn@…

Resolution: worksforme
Status: closedreopened

I tried again, this time adding a dummy file in the folder /opt/local/var/macports/software/qca/2.0.2_0. Now the output says:

+ for file in registry.tcl registry_autoconf.tcl registry_util.tcl receipt_flat.tcl receipt_sqlite.tcl portimage.tcl portuninstall.tcl
+ /usr/bin/install -c -o root -g admin -m 444 receipt_sqlite.tcl /opt/local/share/macports/Tcl/registry2.0/receipt_sqlite.tcl
+ for file in registry.tcl registry_autoconf.tcl registry_util.tcl receipt_flat.tcl receipt_sqlite.tcl portimage.tcl portuninstall.tcl
+ /usr/bin/install -c -o root -g admin -m 444 portimage.tcl /opt/local/share/macports/Tcl/registry2.0/portimage.tcl
+ for file in registry.tcl registry_autoconf.tcl registry_util.tcl receipt_flat.tcl receipt_sqlite.tcl portimage.tcl portuninstall.tcl
+ /usr/bin/install -c -o root -g admin -m 444 portuninstall.tcl /opt/local/share/macports/Tcl/registry2.0/portuninstall.tcl
/usr/bin/install -c -o root -g admin -m 444 pkgIndex.tcl /opt/local/share/macports/Tcl/registry2.0
===> making install in src/darwintracelib1.0
/usr/bin/install -c -d -o root -g admin -m 755 /opt/local/share/macports/Tcl/darwintrace1.0
/usr/bin/install -c -o root -g admin -m 444 darwintrace.dylib /opt/local/share/macports/Tcl/darwintrace1.0
===> making install in src/port
< ../../doc/prefix.mtree /usr/sbin/mtree -U -d -e -p /opt/local > /dev/null
< ../../doc/base.mtree /usr/sbin/mtree -U -d -e -p /opt/local > /dev/null
/usr/bin/install -c -d -o root -g admin -m 755 /opt/local/bin
/usr/bin/install -c -d -o root -g admin -m 755 /opt/local/var/macports
/usr/bin/install -c -o root -g admin -m 555 port portindex portmirror /opt/local/bin/
/usr/bin/install -c -o root -g admin -m 444 port-help.tcl  /opt/local/var/macports/
cd /opt/local/bin && ln -s -f port portf
===> making install in src/programs
===> making install in src/programs/daemondo
mkdir -p build
/usr/bin/install -c -o root -g admin -m 555 build/daemondo /opt/local/bin
===> making install in tests
make[1]: Nothing to be done for `install'.
[ ! -f /opt/local/etc/macports/mp_version ] || rm -vf /opt/local/etc/macports/mp_version
/usr/bin/install -c -o root -g admin -m 444 setupenv.bash  /opt/local/share/macports/
/usr/bin/install -c -o root -g admin -m 444 macports-pubkey.pem  /opt/local/share/macports/
/usr/bin/tclsh src/upgrade_sources_conf_default.tcl "/opt/local"
/usr/bin/tclsh src/images_to_archives.tcl "/opt/local/share/macports/Tcl"
This could take a while...
sh: line 0: cd: /opt/local/var/macports/software/qimageblitz/0.0.5_4: No such file or directory
shell command "cd /opt/local/var/macports/software/qimageblitz/0.0.5_4 && /usr/bin/tar -cjf /opt/local/var/macports/software/qimageblitz/qimageblitz-0.0.5_4.darwin_10.i386.tbz2 * > /opt/local/var/macports/software/qimageblitz/error.log 2>&1" returned error 1
shell command failed (see log for details)
    while executing
"system "cd $location && $tarcmd -cjf $newlocation * > ${targetdir}/error.log 2>&1""
    ("foreach" body line 64)
    invoked from within
"foreach installed $ilist {
    set iname [lindex $installed 0]
    set iversion [lindex $installed 1]
    set irevision [lindex $installed 2]
    set ..."
    (file "src/images_to_archives.tcl" line 37)
make: *** [install] Error 1
shell command "cd /opt/local/var/macports/sources/rsync.macports.org/release/base && CC=/usr/bin/cc ./configure --prefix=/opt/local --with-tclpackage=/Library/Tcl --with-install-user=root --with-install-group=admin --with-directory-mode=0755 --enable-readline && make && make install" returned error 2
DEBUG: Error installing new MacPorts base: shell command failed (see log for details)
    while executing
"macports::selfupdate [array get global_options] base_updated"
Error: /opt/local/bin/port: port selfupdate failed: Error installing new MacPorts base: shell command failed (see log for details)

Installed port is qimageblitz 0.0.6_0. It seems there are two lists of installed ports. A correct one used by porticus and a false (or old) one used by the port command since the upgrade????

comment:10 Changed 13 years ago by jmroot (Joshua Root)

Resolution: worksforme
Status: reopenedclosed

The list of port locations comes straight from the registry. If your registry is that badly messed up, there's probably not a lot the upgrade script can do. I don't know what Porticus might have done to your install; maybe you should ask its developer for support?

comment:11 Changed 13 years ago by cristiano.fontana@…

Resolution: worksforme
Status: closedreopened

I have the very same problem, but not with just a port. With all the ports that I tried to uninstall.

DEBUG: Changing to port directory: /opt/local/var/macports/registry/portfiles/root/5.26.00b_7+builtin_ftgl+opengl+roofit+ssl+xml
DEBUG: OS darwin/10.8.0 (Mac OS X 10.6) arch i386
DEBUG: org.macports.load registered provides 'load', a pre-existing procedure. Target override will not be provided
DEBUG: org.macports.unload registered provides 'unload', a pre-existing procedure. Target override will not be provided
DEBUG: org.macports.distfiles registered provides 'distfiles', a pre-existing procedure. Target override will not be provided
DEBUG: universal_variant is false, so not adding the default universal variant
DEBUG: Executing variant roofit provides roofit
DEBUG: Executing variant opengl provides opengl
DEBUG: Executing variant ssl provides ssl
DEBUG: Executing variant builtin_ftgl provides builtin_ftgl
DEBUG: Executing variant xml provides xml
DEBUG: Starting logging for root
DEBUG: Executing org.macports.main (root)
DEBUG: uninstall phase started at Tue Jul 26 18:25:56 CEST 2011
DEBUG: Executing org.macports.uninstall (root)
--->  Uninstalling root @5.26.00b_7+builtin_ftgl+opengl+roofit+ssl+xml
Error: Target org.macports.uninstall returned: error deleting "/opt/local/var/macports/software/root/5.26.00b_7+builtin_ftgl+opengl+roofit+ssl+xml": directory not empty
DEBUG: Backtrace: error deleting "/opt/local/var/macports/software/root/5.26.00b_7+builtin_ftgl+opengl+roofit+ssl+xml": directory not empty
    while executing
"file delete $imagefile"
    (procedure "registry_uninstall::uninstall" line 161)
    invoked from within
"registry_uninstall $subport $version $revision $portvariants [array get user_options]"
    (procedure "portuninstall::uninstall_main" line 3)
    invoked from within
"$procedure $targetname"
Warning: the following items did not execute (for root): org.macports.uninstall
Log for root is at: /opt/local/var/macports/logs/_opt_local_var_macports_registry_portfiles_root_5.26.00b_7+builtin_ftgl+opengl+roofit+ssl+xml/root/main.log
DEBUG: error deleting "/opt/local/var/macports/software/root/5.26.00b_7+builtin_ftgl+opengl+roofit+ssl+xml": directory not empty
    while executing
"file delete $imagefile"
    (procedure "registry_uninstall::uninstall" line 161)
Warning: Failed to execute portfile from registry for root @5.26.00b_7+builtin_ftgl+opengl+roofit+ssl+xml
--->  Uninstalling root @5.26.00b_7+builtin_ftgl+opengl+roofit+ssl+xml
DEBUG: error deleting "/opt/local/var/macports/software/root/5.26.00b_7+builtin_ftgl+opengl+roofit+ssl+xml": directory not empty
    while executing
"file delete $imagefile"
    (procedure "uninstall" line 161)
    invoked from within
"uninstall $portname $version $revision $variants $optionslist"
    (procedure "registry_uninstall::uninstall_composite" line 5)
    invoked from within
"registry_uninstall::uninstall_composite $portname $composite_version [array get options]"
Error: port uninstall failed: error deleting "/opt/local/var/macports/software/root/5.26.00b_7+builtin_ftgl+opengl+roofit+ssl+xml": directory not empty

comment:12 in reply to:  11 Changed 13 years ago by soehn@…

Replying to cristiano.fontana@…:

I have the very same problem, but not with just a port. With all the ports that I tried to uninstall.

DEBUG: Changing to port directory: /opt/local/var/macports/registry/portfiles/root/5.26.00b_7+builtin_ftgl+opengl+roofit+ssl+xml
DEBUG: OS darwin/10.8.0 (Mac OS X 10.6) arch i386
DEBUG: org.macports.load registered provides 'load', a pre-existing procedure. Target override will not be provided
DEBUG: org.macports.unload registered provides 'unload', a pre-existing procedure. Target override will not be provided
DEBUG: org.macports.distfiles registered provides 'distfiles', a pre-existing procedure. Target override will not be provided
DEBUG: universal_variant is false, so not adding the default universal variant
DEBUG: Executing variant roofit provides roofit
DEBUG: Executing variant opengl provides opengl
DEBUG: Executing variant ssl provides ssl
DEBUG: Executing variant builtin_ftgl provides builtin_ftgl
DEBUG: Executing variant xml provides xml
DEBUG: Starting logging for root
DEBUG: Executing org.macports.main (root)
DEBUG: uninstall phase started at Tue Jul 26 18:25:56 CEST 2011
DEBUG: Executing org.macports.uninstall (root)
--->  Uninstalling root @5.26.00b_7+builtin_ftgl+opengl+roofit+ssl+xml
Error: Target org.macports.uninstall returned: error deleting "/opt/local/var/macports/software/root/5.26.00b_7+builtin_ftgl+opengl+roofit+ssl+xml": directory not empty
DEBUG: Backtrace: error deleting "/opt/local/var/macports/software/root/5.26.00b_7+builtin_ftgl+opengl+roofit+ssl+xml": directory not empty
    while executing
"file delete $imagefile"
    (procedure "registry_uninstall::uninstall" line 161)
    invoked from within
"registry_uninstall $subport $version $revision $portvariants [array get user_options]"
    (procedure "portuninstall::uninstall_main" line 3)
    invoked from within
"$procedure $targetname"
Warning: the following items did not execute (for root): org.macports.uninstall
Log for root is at: /opt/local/var/macports/logs/_opt_local_var_macports_registry_portfiles_root_5.26.00b_7+builtin_ftgl+opengl+roofit+ssl+xml/root/main.log
DEBUG: error deleting "/opt/local/var/macports/software/root/5.26.00b_7+builtin_ftgl+opengl+roofit+ssl+xml": directory not empty
    while executing
"file delete $imagefile"
    (procedure "registry_uninstall::uninstall" line 161)
Warning: Failed to execute portfile from registry for root @5.26.00b_7+builtin_ftgl+opengl+roofit+ssl+xml
--->  Uninstalling root @5.26.00b_7+builtin_ftgl+opengl+roofit+ssl+xml
DEBUG: error deleting "/opt/local/var/macports/software/root/5.26.00b_7+builtin_ftgl+opengl+roofit+ssl+xml": directory not empty
    while executing
"file delete $imagefile"
    (procedure "uninstall" line 161)
    invoked from within
"uninstall $portname $version $revision $variants $optionslist"
    (procedure "registry_uninstall::uninstall_composite" line 5)
    invoked from within
"registry_uninstall::uninstall_composite $portname $composite_version [array get options]"
Error: port uninstall failed: error deleting "/opt/local/var/macports/software/root/5.26.00b_7+builtin_ftgl+opengl+roofit+ssl+xml": directory not empty

The problem is with all ports for me, too. Did you notice an error message when doing the selfupdate to 2.0.0? The problem I am facing is, the selfupdate should have turned all directories in /opt/var/macports/software/PORTNAME/ into archives, but it didn't. The reason is that sometimes in the past some ports have been uninstalled, but not deleted from the registry (they are marked as installed, but not active there). When trying to archive these, the selfupdate-script stops with an error. I found out so far, that after archiving the folders should be deleted. This happens obviously after all archives have been created. So in my case, there are still folders like "2.3.0_1" with content in them. When you try to uninstall a port, the script tries to remove these folders, even though they should not be there. But it does try this with the -r option. So the folders with content cannot be deleted. I am now trying to add the directories as described above for the qca-port example. Always add a dummyfile, so tar will get some food. To get rid of all the dummies after selfupdate is successfully completed, simply run:

port -u uninstall

should work. At least I hope so. Just added /opt/local/var/macports/software/zlib/1.2.3_4 and are running the selfupdate again. Will report soon.

comment:13 Changed 13 years ago by jmroot (Joshua Root)

@cristiano.fontana: so did your selfupdate succeed?

comment:14 Changed 13 years ago by jmroot (Joshua Root)

Cc: cristiano.fontana@… added

You should probably cc yourself if you're going to reopen the ticket. See question above please.

comment:15 in reply to:  13 ; Changed 13 years ago by cristiano.fontana@…

Replying to jmr@…:

You should probably cc yourself if you're going to reopen the ticket. See question above please.

I am sorry I thought it was automatic.

@cristiano.fontana: so did your selfupdate succeed?

I think so, I do not remember any warning or error. Is there a log somewhere that I can look? I did not run the selfupdate with a debug flag.

comment:16 Changed 13 years ago by soehn@…

Finally the selfupdate was successfull. I found some ports that have been registered as installed and active but were missing, too. To repair them I did:

sudo port -f uninstall PORT
sudo port install PORT

The

sudo port -u uninstall

to get rid of the dummies did not work properly. It stopped saying that perl5.8 cannot be uninstalled, bacause perl5 @5.12... depends on it.

Is it safe to use

sudo port -f uninstall perl5.8

in this case?

comment:17 in reply to:  15 ; Changed 13 years ago by jmroot (Joshua Root)

Replying to cristiano.fontana@…:

Replying to jmr@…:

@cristiano.fontana: so did your selfupdate succeed?

I think so, I do not remember any warning or error. Is there a log somewhere that I can look? I did not run the selfupdate with a debug flag.

If the conversion failed, the port image directories would still exist as you are seeing. Run the command in comment:5, and it will try again if it didn't work before.

comment:18 in reply to:  16 Changed 13 years ago by jmroot (Joshua Root)

Replying to soehn@…:

sudo port -u uninstall

to get rid of the dummies did not work properly. It stopped saying that perl5.8 cannot be uninstalled, bacause perl5 @5.12... depends on it.

Is it safe to use

sudo port -f uninstall perl5.8

in this case?

That depends completely on the value of "..." (and what other perl ports are installed).

comment:19 in reply to:  17 Changed 13 years ago by cristiano.fontana@…

Replying to jmr@…:

Replying to cristiano.fontana@…:

Replying to jmr@…:

@cristiano.fontana: so did your selfupdate succeed?

I think so, I do not remember any warning or error. Is there a log somewhere that I can look? I did not run the selfupdate with a debug flag.

If the conversion failed, the port image directories would still exist as you are seeing. Run the command in comment:5, and it will try again if it didn't work before.

I run as you suggested

sudo port -df selfupdate

and it did not complain anyhow and told me that the update was successful. After that I tried to uninstall a port and it worked! Thank you.

comment:20 Changed 13 years ago by jmroot (Joshua Root)

Resolution: worksforme
Status: reopenedclosed

OK, so since the rest of this is turning into support questions and not a bug report, please direct them to a more appropriate venue: http://www.macports.org/contact.php

Note: See TracTickets for help on using tickets.