Opened 9 years ago

Closed 7 months ago

Last modified 5 months ago

#49101 closed defect (fixed)

Ensure that macports $HOME exists and is valid

Reported by: oyamada@… Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone: MacPorts 2.9.0
Component: base Version: 2.3.4
Keywords: Cc:
Port:

Description

After I upgraded OS X to the 10.11 (El Capitan) and reinstalled the MacPorts base, I started reinstalling gimp-app. Then, building fails showing the following error message:

--->  Building gimp-app
Error: org.macports.build for port gimp-app returned: command execution failed
Please see the log file for port gimp-app for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_aqua_gimp-app/gimp-app/main.log
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
Error: Processing of port gimp-app failed

In the main.log file, I found the line which tells there is a build assertion failure:

:info:build Assertion failed: (self.serviceContext.connectionType != SimServiceConnectionTypeClient), function -[SimDeviceSet saveToDisk], file /BuildRoot/Library/Caches/com.apple.xbs/Sources/CoreSimulator/CoreSimulator-179/CoreSimulator/SimDeviceSet.m, line 312.

Is there any way to resolve this problem? Of course, "sudo port clean --all gimp-app" command is executed.

Thank you.

Attachments (4)

main.log (232.1 KB) - added by oyamada@… 9 years ago.
main.log
main2.log (232.1 KB) - added by oyamada@… 9 years ago.
xcodebuild_2015-10-13-084825_xxx-MacBook-Pro.crash (68.8 KB) - added by oyamada@… 9 years ago.
postflight.in.diff (1.6 KB) - added by ryandesign (Ryan Carsten Schmidt) 9 years ago.

Download all attachments as: .zip

Change History (48)

Changed 9 years ago by oyamada@…

Attachment: main.log added

main.log

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

Cc: ryandesign@… added
Keywords: assertion failure removed
Summary: gimp-app build assertion failuregimp-app: CoreSimulator assertion failure

That sounds a lot like a problem we saw with Yosemite:

YosemiteProblems#iphonesimulator

Does opening Xcode.app once and then closing it help?

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

Cc: ryandesign@… added; ryandesign@… removed

comment:3 Changed 9 years ago by felzmann (Ulrich Felzmann)

I see the same issue / error with the following packages: emacs-app, fugu, osxfuse.

comment:4 Changed 9 years ago by felzmann (Ulrich Felzmann)

Cc: ulrich.felzmann@… added

Cc Me!

comment:5 Changed 9 years ago by oyamada@…

Thanks Ryan for your suggestion. Unfortunately, opening and closing the Xcode.app did not work this time. While I am updating three MacBooks (new Pro, three-year-old Pro, and two-year-old Air), all are facing the same problem. Although I went through the previous tickets you kindly linked, I could not find a crucial clue.

Thanks Ulrich for your providing additional cases in a similar situation.

comment:6 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: jeremyhu@… added

This may be a thing you need to submit a bug report to Apple about.

Unless: Jeremy, do you have any ideas?

comment:7 in reply to:  3 Changed 9 years ago by smogus@…

Replying to ulrich.felzmann@…:

I see the same issue / error with the following packages: emacs-app, fugu, osxfuse.

This exact failure also happens with pinentry-mac. Curiously, changing into the work directory and executing the same (/usr/bin/xcodebuild) command that reports the error is successful (only if executed with sudo though).

comment:8 Changed 9 years ago by oyamada@…

Thanks Ryan. Based on the discussions in #45445, it seems to be a Xcode bug. Is what we can do to wait for the next (or later) update for Xcode, reporting this to Apple? There is no relevant report in the CoreSimulator.log other than the one like following:

Oct  5 19:16:10  CoreSimulatorService[804] <Notice>: com.apple.CoreSimulator.CoreSimulatorService 179~1 starting.

Thanks Ulrich. It also appens with aquaterm, too.

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

Keywords: elcapitan added

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

Cc: swordangel@… added

Has duplicate #49206 (pinentry-mac).

comment:11 Changed 9 years ago by felzmann (Ulrich Felzmann)

Hi guys,

Does anyone have a suggestion for a work-around? Not having a lot of essential ports is a bit frustrating.

Thanks!

comment:12 Changed 9 years ago by oyamada@…

Ulrich,

I am just wait for the next OSX/Xcode Updates. Based on my experience, fiddling with non-functioning apps without confidence always expands damage. Sorry for no useful information.

Let's take it easy.

comment:13 Changed 9 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Please post the full crash report.

comment:14 Changed 9 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Owner: changed from macports-tickets@… to jeremyhu@…
Status: newassigned

Also, please file a radar at http://bugreport.apple.com

Changed 9 years ago by oyamada@…

Attachment: main2.log added

Changed 9 years ago by oyamada@…

comment:15 in reply to:  13 Changed 9 years ago by oyamada@…

Replying to jeremyhu@…:

Please post the full crash report.

Jeremy, while I am not sure which crash report you mean (I am a newbie in this field), I posted the one related to xcodebuild as well as a new main.log. Thanks.

comment:16 in reply to:  14 Changed 9 years ago by oyamada@…

Replying to jeremyhu@…:

Also, please file a radar at http://bugreport.apple.com

I submitted a report to Apple Bug Reporter. When there is any progress, I will share it with you here.

comment:17 Changed 9 years ago by jeremyhu (Jeremy Huddleston Sequoia)

You do not need to share progress here. I will be the one on the other side of that radar when it eventually gets to me. Can you please tell me the radar number, so I can expedite that process?

The xcodebuild crash log you posted is exactly what I wanted, thanks.

comment:18 Changed 9 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Do you hit this crash when launching Xcode.app as your user account?

Do you hit this crash when running xcodebuild as your user account?

Do you hit this crash when running 'xcrun simctl list' as your user account?

comment:19 Changed 9 years ago by maehne (Torsten Maehne)

Cc: Torsten.Maehne@… added

Cc Me!

comment:20 Changed 9 years ago by oyamada@…

Jeremy,

The radar number is 23082246.

The replies to all of your three questions are yes. One thing that may make you feel something wrong is because of the fact that I changed the name of the xcodebuild crash log file (I did it without any specific reason). Precisely, the name is "xcodebuild_2015-10-13-084825_Siouxsie-MacBook-Pro.crash". I am the only user of my MacBook Pro, and the machine is always used with my user account "Siouxsie". The installation of gimp-app is executed by the command "sudo port install gimp-app". Other port, "inkscape" for instance, was successfully installed in a similar process "sudo port install inkscape".

Thanks for your help.

comment:21 Changed 9 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Thanks. I actually ended up triaging it last night and filed my own radar with the appropriate team, which I've duped yours to.

Unfortunately, I don't have a workaround for you right now.

comment:22 Changed 9 years ago by jeremyhu (Jeremy Huddleston Sequoia)

After a bit more triage, it looks like we can hit this particular code path if the user's home directory doesn't exist. I have a hunch that your macports user has issues. Can you do the following:

id macports
echo ~macports
ls -al ~macports

comment:23 Changed 9 years ago by felzmann (Ulrich Felzmann)

Indeed the following solved the problem:

% ls ~macports
ls: /opt/local/var/macports/home: No such file or directory

% sudo mkdir -p /opt/local/var/macports/home
% sudo chown macports:macports /opt/local/var/macports/home

After that I was able to build fugu, osxfuse and emacs-app.

Thanks heaps Jeremy for digging into this!

comment:24 Changed 9 years ago by oyamada@…

Thanks Jeremy and Ulrich. As you pointed out, my user home directory does not exist.

$ id macports
uid=502(macports) gid=501(macports) groups=501(macports),12(everyone),20(staff),61(localaccounts),100(_lpoperator)
$ echo ~macports
/Users/macports
$ ls -al ~macports
ls: /Users/macports: No such file or directory

comment:25 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

The macports user's home directory should not be /Users/macports; it should be /opt/local/var/macports/home. You may need to edit your macports user to fix this.

comment:26 in reply to:  25 ; Changed 9 years ago by ksze (Kal Sze)

Replying to ryandesign@…:

The macports user's home directory should not be /Users/macports; it should be /opt/local/var/macports/home. You may need to edit your macports user to fix this.

Interesting. On my machine, the macports user's home directory is at /var/macports/home for some reason. Naturally, the directory doesn't exist.

I don't remember ever having fiddled with the macports user.

However, /opt/local/var/macports/home does exist:

$ sudo ls -Rl /opt/local/var/macports/home
total 0
drwxr-xr-x  6 root  admin  204 Nov  9  2014 .subversion
drwxr-xr-x  3 root  admin  102 Oct 18  2014 Library

/opt/local/var/macports/home/.subversion:
total 48
-rw-r--r--  1 root  admin  4276 Nov  9  2014 README.txt
drwx------  6 root  admin   204 Nov  9  2014 auth
-rw-r--r--  1 root  admin  6369 Nov  9  2014 config
-rw-r--r--  1 root  admin  7679 Nov  9  2014 servers

/opt/local/var/macports/home/.subversion/auth:
total 0
drwxr-xr-x  2 root  admin  68 Nov  9  2014 svn.simple
drwxr-xr-x  2 root  admin  68 Nov  9  2014 svn.ssl.client-passphrase
drwxr-xr-x  2 root  admin  68 Nov  9  2014 svn.ssl.server
drwxr-xr-x  2 root  admin  68 Nov  9  2014 svn.username

/opt/local/var/macports/home/.subversion/auth/svn.simple:

/opt/local/var/macports/home/.subversion/auth/svn.ssl.client-passphrase:

/opt/local/var/macports/home/.subversion/auth/svn.ssl.server:

/opt/local/var/macports/home/.subversion/auth/svn.username:

/opt/local/var/macports/home/Library:
total 0
drwxr-xr-x  5 root  admin  170 Oct 13 13:48 Preferences

/opt/local/var/macports/home/Library/Preferences:
total 88
-rw-r--r--  1 macports  admin  36417 Oct  5 22:41 com.apple.dt.Xcode.plist
-rw-------  1 macports  staff    161 Oct 19  2014 com.apple.ibtool.plist
-rw-------  1 macports  staff    187 Nov 20  2014 xcodebuild.plist
Last edited 9 years ago by ksze (Kal Sze) (previous) (diff)

comment:27 in reply to:  26 ; Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to oyamada@…:

Thanks Jeremy and Ulrich. As you pointed out, my user home directory does not exist.

$ id macports
uid=502(macports) gid=501(macports) groups=501(macports),12(everyone),20(staff),61(localaccounts),100(_lpoperator)
$ echo ~macports
/Users/macports
$ ls -al ~macports
ls: /Users/macports: No such file or directory

To fix this, please run:

sudo dscl . -change Users/macports NFSHomeDirectory /Users/macports /opt/local/var/macports/home

Replying to swordangel@…:

Interesting. On my machine, the macports user's home directory is at /var/macports/home for some reason. Naturally, the directory doesn't exist.

Perhaps the ${PREFIX} variable in the installer's postflight script was empty for some reason, in whatever version of MacPorts you used to install MacPorts originally.

To fix this, please run:

sudo dscl . -change Users/macports NFSHomeDirectory /var/macports/home /opt/local/var/macports/home

comment:28 in reply to:  27 Changed 9 years ago by ksze (Kal Sze)

Replying to ryandesign@…:

Replying to oyamada@…:

Thanks Jeremy and Ulrich. As you pointed out, my user home directory does not exist.

$ id macports
uid=502(macports) gid=501(macports) groups=501(macports),12(everyone),20(staff),61(localaccounts),100(_lpoperator)
$ echo ~macports
/Users/macports
$ ls -al ~macports
ls: /Users/macports: No such file or directory

To fix this, please run:

sudo dscl . -change Users/macports NFSHomeDirectory /Users/macports /opt/local/var/macports/home

Replying to swordangel@…:

Interesting. On my machine, the macports user's home directory is at /var/macports/home for some reason. Naturally, the directory doesn't exist.

Perhaps the ${PREFIX} variable in the installer's postflight script was empty for some reason, in whatever version of MacPorts you used to install MacPorts originally.

To fix this, please run:

sudo dscl . -change Users/macports NFSHomeDirectory /var/macports/home /opt/local/var/macports/home

That fixed building and installing osxfuse for me.

Perhaps a check for the macports user home directory should be added to the MacPorts installer at some point? Like you said, I have a gut feeling that the installer of some past version was subtly broken.

Last edited 9 years ago by ksze (Kal Sze) (previous) (diff)

comment:29 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Originally, the macports user's home directory was /var/empty, but this was found to cause some problems, so we changed it to a directory we owned, /opt/local/var/macports/home. The installer postflight script already contains a block that changes the home directory to /opt/local/var/macports/home if it is /var/empty. We could change it so that it changes the home directory to /opt/local/var/macports/home if it is not /opt/local/var/macports/home. See attached patch.

This only applies when installing via the installer package. I'm not sure what, if anything, creates the user if you install from source.

I'm not sure what is responsible for creating the home directory or settings its ownership. Presumably we should also verify that the directory exists and has the correct ownership, and create or fix it if not.

Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: postflight.in.diff added

comment:30 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

I should also say that ideally the installer package is only used to initially install MacPorts. Subsequent updates are usually performed by running "sudo port selfupdate". The installer also runs selfupdate before it finishes. So really, any macports user fixes should be made part of selfupdate.

comment:31 in reply to:  27 ; Changed 9 years ago by oyamada@…

Ryan,

As I wrote in comment:5, I am updating three MacBooks (new Pro, three-year-old Pro, and two-year-old Air). With all those three, the home directory was set to "/Users/macports". I installed the MacPorts base using the installer "MacPorts-2.3.4-10.11-ElCapitan.pkg". Is not it because of a possible bug in the installer? After that, I ran selfupdate many times.

Replying to ryandesign@…:

To fix this, please run:

sudo dscl . -change Users/macports NFSHomeDirectory /Users/macports /opt/local/var/macports/home

Anyway, the above works for me to make the building and installation of gimp-app successful.

However, this time, the selfupdate has started to fail:

$ sudo port -d selfupdate
Password:
DEBUG: Copying /Users/Siouxsie/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/release/tarballs
--->  Updating MacPorts base sources using rsync
receiving file list ... done

sent 36 bytes  received 69 bytes  30.00 bytes/sec
total size is 27013120  speedup is 257267.81
receiving file list ... done

sent 36 bytes  received 76 bytes  32.00 bytes/sec
total size is 512  speedup is 4.57
DEBUG: failed verification with key /opt/local/share/macports/macports-pubkey.pem
DEBUG: openssl output: Verification Failure
child process exited abnormally
DEBUG: Failed to verify signature for MacPorts source!
    while executing
"macports::selfupdate [array get global_options] base_updated"
Error: Failed to verify signature for MacPorts source!
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
Error: /opt/local/bin/port: port selfupdate failed: Failed to verify signature for MacPorts source!

Does this have something to do with the previous problem?

comment:32 Changed 9 years ago by oyamada@…

The original problem which this ticket is based on has gone now. Thanks a lot, guys. I really appreciate your helps.

comment:33 Changed 9 years ago by oyamada@…

By the way, should I ask Apple to close the radar #23082246 (bug reporter ticket) marking as "resolved"?

Version 0, edited 9 years ago by oyamada@… (next)

comment:34 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

It is possible there was or still is a bug in the MacPorts installer relating to creating and setting up the macports user. I will try to investigate later.

Assertion failures are programmer diagnostics that should never be seen by users so the Apple bug report should stay open until they fix it.

Sync and selfupdate failures are a separate unrelated matter. See #49233 and #49224.

comment:35 in reply to:  33 Changed 9 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Replying to oyamada@…:

By the way, should I ask Apple to close the radar #23082246 (bug reporter ticket) marking as "resolved"?

No, the issue is valid. This state should not be resulting in the crash. I've already duped your radar to mine, and a fix will come in a future Xcode update.

Last edited 8 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:36 Changed 9 years ago by oyamada@…

Thanks Ryan and Jeremy for your advice. As you suggest, I will keep the radar open.

The selfupdate failure has already gone, too. Thanks for your sharing the links.

comment:37 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)

Has duplicate #49123 (osxfuse)

comment:38 Changed 8 years ago by axet (Alexey Kuznetsov)

Cc: axet@… added

Cc Me!

comment:39 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Cc: ryandesign@… ulrich.felzmann@… jeremyhu@… swordangel@… Torsten.Maehne@… axet@… removed
Component: portsbase
Keywords: elcapitan removed
Owner: changed from jeremyhu@… to ryandesign@…
Port: gimp-app removed
Status: assignednew
Summary: gimp-app: CoreSimulator assertion failureEnsure that macpots $HOME exists and is valid

Ryan, I think this should be sitting with you given the comments above. The issue on the MacPorts side is to make sure that HOME exists (create it correctly, handle failures from earlier installs correctly, etc).

comment:40 in reply to:  29 Changed 8 years ago by jmroot (Joshua Root)

Summary: Ensure that macpots $HOME exists and is validEnsure that macports $HOME exists and is valid

Replying to ryandesign@…:

I'm not sure what, if anything, creates the user if you install from source.

browser:trunk/base/Makefile.in#L71

comment:41 in reply to:  31 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to oyamada@…:

I am updating three MacBooks (new Pro, three-year-old Pro, and two-year-old Air). With all those three, the home directory was set to "/Users/macports". I installed the MacPorts base using the installer "MacPorts-2.3.4-10.11-ElCapitan.pkg". Is not it because of a possible bug in the installer?

Apple's Migration Assistant will by default try to be "helpful" and move the macports user's home directory to /Users/macports, which we do not want. (The same would happen to other user accounts that some MacPorts ports create, which we don't want either.) So if you had ever migrated the data to these computers from other Macs, and you did not tell it not to migrate the macports user (and other users MacPorts ports create), then this could explain the problem.

comment:42 Changed 7 months ago by jmroot (Joshua Root)

Resolution: fixed
Status: newclosed

In 128e8cedda2ea47c947d6e85b23cb7bf9628b281/macports-base (master):

Update RUNUSR home dir if it's any undesired value

Fixes: #49101

comment:43 Changed 7 months ago by jmroot (Joshua Root)

Milestone: MacPorts Future

comment:44 Changed 5 months ago by jmroot (Joshua Root)

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