Opened 2 years ago

Closed 4 months ago

Last modified 4 months ago

#66031 closed defect (fixed)

selfupdate throws error changing directory permissions on Monterey and Big Sur

Reported by: petermichor Owned by:
Priority: Normal Milestone: MacPorts 2.10.0
Component: base Version: 2.8.0
Keywords: catalina bigsur monterey Cc: FaradayLight (Faraday Light), ballapete (Peter "Pete" Dyballa), iay (Ian Young), p-bro
Port:

Description (last modified by jmroot (Joshua Root))

Error: Couldn't change permissions of the MacPorts sources at /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/base to root: child killed: kill signal
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
Error: /opt/local/bin/port: port selfupdate failed: Couldn't change permissions of the MacPorts sources at /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/base to root: child killed: kill signal

Under Monterey 12.6, on 2 Computers

Change History (32)

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

Component: portsbase
Description: modified (diff)

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

Seems to only be affecting Monterey systems. Fortunately the permissions change is the last thing that the selfupdate procedure does, so MacPorts should work fine in spite of the error.

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

Summary: sudo port -v selfupdate failedselfupdate throws error changing directory permissions on Monterey

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

Summary: selfupdate throws error changing directory permissions on Montereyselfupdate throws error changing directory permissions on Monterey and Big Sur

Nope, also seen on Big Sur. And the odd thing is it succeeds on subsequent selfupdates (the chown -R is run regardless of whether a new base version was actually built). That code has been more or less the same since DarwinPorts 1.0.

Last edited 2 years ago by jmroot (Joshua Root) (previous) (diff)

comment:5 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: bigsur monterey added
Version: 2.8.0

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

"Version: 2.8" isn't entirely accurate, since the error would have been thrown by the 2.7.2 code that had just built 2.8. Running a forced selfupdate with 2.8.0 would be a useful experiment. Maybe there's something unusual about some of the files in the 2.8.0 build dir that chown doesn't like?

Last edited 2 years ago by jmroot (Joshua Root) (previous) (diff)

comment:7 Changed 2 years ago by FaradayLight (Faraday Light)

Cc: FaradayLight added

comment:8 Changed 2 years ago by FaradayLight (Faraday Light)

I can confirm that port command functions without error after the first instance of the error is reported.

Last edited 2 years ago by FaradayLight (Faraday Light) (previous) (diff)

comment:9 Changed 2 years ago by jculpon (Jamie Culpon)

I can confirm that I was also impacted by this on Monterey and Big Sur x86; it looked like the specific error I hit was:

% sudo port -v selfupdate
Password:
--->  Updating MacPorts base sources using rsync

Willkommen auf dem RSYNC-server auf ftp.fau.de.
Nicht all unsere Mirror sind per rsync verfuegbar.

Welcome to the RSYNC daemon on ftp.fau.de.
Not all of our mirrors are available through rsync.


receiving file list ... done
./

sent 66 bytes  received 98 bytes  65.60 bytes/sec
total size is 113716736  speedup is 693394.73
MacPorts base version 2.8.0 installed,
MacPorts base version 2.8.0 downloaded.
--->  Updating the ports tree
Synchronizing local ports tree from rsync://rsync.macports.org/macports/release/tarballs/ports.tar

Willkommen auf dem RSYNC-server auf ftp.fau.de.
Nicht all unsere Mirror sind per rsync verfuegbar.

Welcome to the RSYNC daemon on ftp.fau.de.
Not all of our mirrors are available through rsync.


receiving file list ... done
./

sent 68 bytes  received 99 bytes  66.80 bytes/sec
total size is 100107776  speedup is 599447.76
Creating port index in /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports
Warning: Failed to open old entry for python/py-wheel, making a new one
Adding port python/py-wheel
Failed to parse file python/py-wheel/Portfile with subport 'py27-wheel': wrong # args: extra words after "else" clause in "if" command
Failed to parse file python/py-wheel/Portfile with subport 'py34-wheel': wrong # args: extra words after "else" clause in "if" command
Failed to parse file python/py-wheel/Portfile with subport 'py35-wheel': wrong # args: extra words after "else" clause in "if" command
Failed to parse file python/py-wheel/Portfile with subport 'py36-wheel': wrong # args: extra words after "else" clause in "if" command
Failed to parse file python/py-wheel/Portfile with subport 'py37-wheel': wrong # args: extra words after "else" clause in "if" command
Failed to parse file python/py-wheel/Portfile with subport 'py38-wheel': wrong # args: extra words after "else" clause in "if" command
Failed to parse file python/py-wheel/Portfile with subport 'py39-wheel': wrong # args: extra words after "else" clause in "if" command
Failed to parse file python/py-wheel/Portfile with subport 'py310-wheel': wrong # args: extra words after "else" clause in "if" command

Total number of ports parsed:	9 
Ports successfully parsed:	1 
Ports failed:			8 
Up-to-date ports skipped:	29923

--->  MacPorts base is already the latest version

The ports tree has been updated. To upgrade your installed ports, you should run
  port upgrade outdated

After rerunning self update another time the tree updated fine.

Version 0, edited 2 years ago by jculpon (Jamie Culpon) (next)

comment:10 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: catalina added

It happened on my Catalina machine.

comment:11 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

Cc: ballapete added

comment:12 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

On my Monterey (12.6) Mac the second selfupdate leads to:

EBUG: euid/egid changed to: 501/0, env: HOME=/opt/local/var/macports/home SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.6zAVX3We7g/Listeners
DEBUG: couldn't change working directory to "": no such file or directory
    while executing
"cd $oldPWD"
    (procedure "macports::GetVCSUpdateCmd" line 33)
    invoked from within
"macports::GetVCSUpdateCmd $portdir"
Could not access contents of /opt/local_ports
DEBUG: euid/egid restored to: 0/0, env restored
DEBUG: Couldn't sync the ports tree: Synchronization of 1 source failed
    while executing
"error "Couldn't sync the ports tree: $eMessage""
    (procedure "selfupdate::main" line 118)
    invoked from within
"selfupdate::main {options_global_order {} options_selfupdate_order {}} base_updated"
    ("uplevel" body line 1)
    invoked from within
"uplevel [list selfupdate::main $optionslist $updatestatusvar]"
    (procedure "macports::selfupdate" line 2)
    invoked from within
"macports::selfupdate [array get options] base_updated"
Error: Couldn't sync the ports tree: Synchronization of 1 source failed
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
Error: /opt/local/bin/port: port selfupdate failed: Couldn't sync the ports tree: Synchronization of 1 source failed
root 238 /\ .
.
/var/root
root 239 /\ port -v
port -v
MacPorts 2.8.0
Entering shell mode... ("help" for help, "quit" to quit)
[var/root] > 
^D
Goodbye
root 240 /\ 

Besides this the stty setting are changed and commands now are echoed.

comment:13 Changed 2 years ago by JDLH (Jim DeLaHunt)

Me too, on macOS Monterey 12.6 also. Symptoms observed on first sudo port selfupdate after 2.8.0 released. Symptoms not observed in a sudo port -v selfupdate immediately after.

And are ownerships on the named directory and its contents in fact correct, after the second port selfupdate? Yes:

% ls -ld /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/base{,/*}
drwxr-xr-x   30 root  polkitd     960 19 Oct 23:02 /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/base
-rw-r--r--    1 root  polkitd  124597 19 Oct 23:02 /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/base/ChangeLog
...[elided: another 23 files and directories, all owned by "root:polkitd"]... 

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

I can't reproduce when doing a forced selfupdate starting from 2.8.0. Too much to hope the problem is gone forever once you're updated to 2.8, I suppose.

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

In b405fee11b22f07d23b78e0a0197661b2568ffed/mpbb (master):

mpbb: Temporarily ignore selfupdate errors

See: #66031

comment:16 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

I invoked manually

sudo gchown -R 501:0 /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/base 

which also works with /usr/sbin/chown instead of /opt/local/bin/gchown from coreutils.

(It reminds me of a situation when I tried to manually copy files from a TimeMachine volume and were not allowed to do so. Or that GNU Emacs app needs extra permissions to access some directories that I own…)

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

Another useful bit of data would be if there's anyone who didn't get this error selfupdating to 2.8.0 on Catalina or later.

comment:18 Changed 2 years ago by iay (Ian Young)

Cc: iay added

comment:19 Changed 2 years ago by mouse07410 (Mouse)

Well, on one of my Monterey systems (iMac), self-update went through without an error. On several other ones, it errored - but re-running selfupdate remedied it for good.

comment:20 Changed 2 years ago by p-bro

Cc: p-bro added

comment:21 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

Running the command port -vd selfupdate (of version 2.8) as user root in a *shell* buffer in GNU Emacs in root's home directory /var/root on macOS Monterey, Version 12.6 leads to errors:

total size is 18150409  speedup is 58.21
DEBUG: successful verification with key /opt/local/share/macports/macports-pubkey.pem
DEBUG: system: chmod -R a+r /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs
Synchronizing local ports tree from file:///opt/local_ports
DEBUG: euid/egid changed to: 501/0, env: HOME=/opt/local/var/macports/home SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.6zAVX3We7g/Listeners
DEBUG: couldn't change working directory to "": no such file or directory
    while executing
"cd $oldPWD"
    (procedure "macports::GetVCSUpdateCmd" line 33)
    invoked from within
"macports::GetVCSUpdateCmd $portdir"
Could not access contents of /opt/local_ports
DEBUG: euid/egid restored to: 0/0, env restored
DEBUG: Couldn't sync the ports tree: Synchronization of 1 source failed
    while executing
"error "Couldn't sync the ports tree: $eMessage""
    (procedure "selfupdate::main" line 118)
    invoked from within
"selfupdate::main {options_global_order {} options_selfupdate_order {}} base_updated"
    ("uplevel" body line 1)
    invoked from within
"uplevel [list selfupdate::main $optionslist $updatestatusvar]"
    (procedure "macports::selfupdate" line 2)
    invoked from within
"macports::selfupdate [array get options] base_updated"
Error: Couldn't sync the ports tree: Synchronization of 1 source failed
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
Error: /opt/local/bin/port: port selfupdate failed: Couldn't sync the ports tree: Synchronization of 1 source failed

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

@ballapete: Your issue seems to be different to the one this ticket is about.

Last edited 2 years ago by jmroot (Joshua Root) (previous) (diff)

comment:23 in reply to:  22 ; Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

Replying to jmroot:

I am assuming a permissions problem for both cases. There exist in the file systems areas which some applications are not allowed to access without giving them explicit permission – although my user account can own them and the application runs under my user account.

Of course I can be wrong and can open a new case.

comment:24 in reply to:  23 Changed 2 years ago by jmroot (Joshua Root)

Replying to ballapete:

Replying to jmroot:

I am assuming a permissions problem for both cases. There exist in the file systems areas which some applications are not allowed to access without giving them explicit permission – although my user account can own them and the application runs under my user account.

Your output doesn't mention anything to do with permissions; it's trying to cd back to a previous working directory when there wasn't one, similar to #40035.

comment:25 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

I am not sure where the reporter was when cd was invoked, I was in root's home directory, /var/root. And this directory is not accessible by mortal users…

comment:26 in reply to:  25 ; Changed 2 years ago by petermichor

Replying to ballapete:

I am not sure where the reporter was when cd was invoked, I was in root's home directory, /var/root. And this directory is not accessible by mortal users…

The reporter (me) was in his home directory.

comment:27 in reply to:  26 Changed 2 years ago by jmroot (Joshua Root)

Replying to petermichor:

Replying to ballapete:

I am not sure where the reporter was when cd was invoked, I was in root's home directory, /var/root. And this directory is not accessible by mortal users…

The reporter (me) was in his home directory.

And there is no evidence of any cd failure for you, which is why I'm saying that @ballapete's issue is completely different to yours. Discussing them both in the same ticket is just going to confuse people.

comment:28 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

Interestingly (?) port has no problem running from ~root on PPC Mac OS X 10.5.8, Leopard.

comment:29 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

The same is true for macOS High Sierra, Version 10.13.6 – it works all from ~root.

comment:30 Changed 22 months ago by ballapete (Peter "Pete" Dyballa)

On macOS Monterey, Version 12.6, it also does not work from /var/root/.emacs.d:

root 260 /\ port -vd selfupdate
DEBUG: Copying /var/root/Library/Preferences/com.apple.dt.Xcode.plist to /opt/local/var/macports/home/Library/Preferences
DEBUG: MacPorts sources location: /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs
--->  Updating MacPorts base sources using rsync
DEBUG: system: /usr/bin/rsync -rtzvl --delete-after --include=/base.tar --include=/base.tar.rmd160 --exclude=* rsync://rsync.macports.org/macports/release/tarballs/ /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs

Willkommen auf dem RSYNC-server auf ftp.fau.de.
Nicht all unsere Mirror sind per rsync verfuegbar.

Welcome to the RSYNC daemon on ftp.fau.de.
Not all of our mirrors are available through rsync.


receiving file list ... done
./

sent 66 bytes  received 98 bytes  328.00 bytes/sec
total size is 113716736  speedup is 693394.73
DEBUG: successful verification with key /opt/local/share/macports/macports-pubkey.pem
DEBUG: system: /usr/bin/tar -C /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/tmp -xf /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/base.tar
MacPorts base version 2.8.0 installed,
DEBUG: Rebuilding and reinstalling MacPorts if needed
MacPorts base version 2.8.0 downloaded.
--->  Updating the ports tree
Synchronizing local ports tree from rsync://rsync.macports.org/macports/release/tarballs/ports.tar
DEBUG: system: /usr/bin/rsync -rtzvl --delete-after --include=/ports.tar --include=/ports.tar.rmd160 --exclude=* rsync://rsync.macports.org/macports/release/tarballs/ /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs

Willkommen auf dem RSYNC-server auf ftp.fau.de.
Nicht all unsere Mirror sind per rsync verfuegbar.

Welcome to the RSYNC daemon on ftp.fau.de.
Not all of our mirrors are available through rsync.


receiving file list ... done
./
ports.tar
ports.tar.rmd160

sent 70650 bytes  received 494005 bytes  376436.67 bytes/sec
total size is 101424128  speedup is 179.62
DEBUG: successful verification with key /opt/local/share/macports/macports-pubkey.pem
DEBUG: system: /usr/bin/tar -C /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/tmp -xf /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports.tar
DEBUG: system: /usr/bin/rsync -rtzvl --delete-after --include=/PortIndex.rmd160 --include=/PortIndex --exclude=* rsync://rsync.macports.org/macports/release/tarballs/PortIndex_darwin_21_i386/ /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs

Willkommen auf dem RSYNC-server auf ftp.fau.de.
Nicht all unsere Mirror sind per rsync verfuegbar.

Welcome to the RSYNC daemon on ftp.fau.de.
Not all of our mirrors are available through rsync.


receiving file list ... done
./
PortIndex
PortIndex.rmd160

sent 26092 bytes  received 123551 bytes  99762.00 bytes/sec
total size is 18718157  speedup is 125.09
DEBUG: failed verification with key /opt/local/share/macports/macports-pubkey.pem
DEBUG: openssl output: Verification Failure
child process exited abnormally
DEBUG: system: chmod -R a+r /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs
DEBUG: system: /opt/local/bin/portindex /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports
Creating port index in /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports
Adding port audio/abcde
Adding port audio/audacity
Adding subport audacity-manual
Adding subport audacity-legacy
Adding subport audacity-devel
Adding port audio/audiofile
…
Adding port textproc/miller
Adding port textproc/ov
Adding port textproc/qsv
Adding port textproc/yj
Adding port x11/tk

Total number of ports parsed:	438 
Ports successfully parsed:	438 
Ports failed:			0 
Up-to-date ports skipped:	30260

Synchronizing local ports tree from file:///opt/local_ports
DEBUG: euid/egid changed to: 501/0, env: HOME=/opt/local/var/macports/home SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.XxtVAThczQ/Listeners
DEBUG: couldn't change working directory to "": no such file or directory
    while executing
"cd $oldPWD"
    (procedure "macports::GetVCSUpdateCmd" line 33)
    invoked from within
"macports::GetVCSUpdateCmd $portdir"
Could not access contents of /opt/local_ports
DEBUG: euid/egid restored to: 0/0, env restored
DEBUG: Couldn't sync the ports tree: Synchronization of 1 source failed
    while executing
"error "Couldn't sync the ports tree: $eMessage""
    (procedure "selfupdate::main" line 118)
    invoked from within
"selfupdate::main {options_global_order {} options_selfupdate_order {}} base_updated"
    ("uplevel" body line 1)
    invoked from within
"uplevel [list selfupdate::main $optionslist $updatestatusvar]"
    (procedure "macports::selfupdate" line 2)
    invoked from within
"macports::selfupdate [array get options] base_updated"
Error: Couldn't sync the ports tree: Synchronization of 1 source failed
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
Error: /opt/local/bin/port: port selfupdate failed: Couldn't sync the ports tree: Synchronization of 1 source failed

comment:31 Changed 4 months ago by jmroot (Joshua Root)

Milestone: MacPorts Future
Resolution: fixed
Status: newclosed

This shouldn't be able to happen any more since the chown was removed entirely in [dd3acc4b974d274d922b705a9115ba1dc786104f/macports-base].

comment:32 Changed 4 months ago by jmroot (Joshua Root)

Milestone: MacPorts FutureMacPorts 2.10.0
Note: See TracTickets for help on using tickets.