Opened 16 years ago

Closed 15 years ago

Last modified 15 years ago

#13742 closed defect (fixed)

Installation with the package did not run the postflight script

Reported by: mellonjasper@… Owned by: jmpp@…
Priority: Normal Milestone: MacPorts 1.7.0
Component: base Version: 1.6.0
Keywords: installation postflight Cc: pburleson@…, neophi@…, v.volle@…, groblewis@…, al@…, lemuelf@…, ryandesign (Ryan Carsten Schmidt), chris@…
Port:

Description

I installed MacPorts on my iMac with leopard. I downloaded the package MacPorts-1.6.0.pkg and installed. The installation created the directories under /opt/local, but no .profile was create in my homedir. Therefore the port command did not work in a shell. I had to create a .profile myself. After that MacPorts worked fine.

The manual creation of a .profile file should not be necessary.

Attachments (5)

profile (189 bytes) - added by mellonjasper@… 16 years ago.
/etc/profile
bashrc (196 bytes) - added by mellonjasper@… 16 years ago.
/etc/bashrc
profile.2 (93 bytes) - added by mellonjasper@… 16 years ago.
~/.profile
install.log (77 bytes) - added by rui@… 16 years ago.
/var/log/install.log
install.log.0.bz2 (15.0 KB) - added by rui@… 16 years ago.
/var/log/install.log

Download all attachments as: .zip

Change History (32)

comment:1 Changed 16 years ago by jmpp@…

Owner: changed from macports-tickets@… to jmpp@…

Can you please provide me with some information about your shell environment?

  • are you using bash? If so,
  • what does your /etc/profile file look like?
  • how about /etc/bashrc?
  • or, do you have a ~/.bash_profile file by any chance? What are its contents?

The postflight script is only supposed to tweak the user environment under a limited set of conditions in order to intervene as least as possible. And though I believe it has been successful at that, I have heard a couple of times already that it has failed to add our settings to the environment when encountered with an allegedly legitimate scenario. I'd like to gather as much information about this failure as possible, in order to try and spot a pattern.

Thanks for your help!

-jmpp

Changed 16 years ago by mellonjasper@…

Attachment: profile added

/etc/profile

Changed 16 years ago by mellonjasper@…

Attachment: bashrc added

/etc/bashrc

comment:2 Changed 16 years ago by mellonjasper@…

I'm working on a new iMac with a clean install of leopard (I received it with tiger and a leopard upgrade disc). All prerequisites are installed (X11, Xcode 3.0 and X11 sdk). I use bash. I have not changed /etc/profile and /etc/bashrc but have attached them nevertheless. At the time of installation, I didn't have a .profile nor a .bash_profile in my user dir.

The hidden files in my home dir are the following: .CFUserTextEncoding .DS_Store .Trash .Xcode .bash_history .cups .eclipse_keyring .lesshst .macports .netbeans .profile .ssh .subversion .viminfo

Changed 16 years ago by mellonjasper@…

Attachment: profile.2 added

~/.profile

comment:3 Changed 16 years ago by mellonjasper@…

I have added the ~/.profile file I have manually created. Have I missed something I need for successfully working with MacPorts (for now I have not included anything that is used for X11)?

If this is enough, my direct problem is solved. However I will try to help solving this, so don't hesitate to ask more questions.

comment:4 Changed 16 years ago by pburleson@…

I just reported this with #13762 . I didn't see this report first. I swear I searched before and didn't see this reported.

You can close #13762, but please add me to the CC of this.

I have had this happen on two machines with clean Leopard installs upgraded to 10.5.1, a Core2Duo MacBook and a 20" Core2Duo iMac.

comment:5 Changed 16 years ago by sinz-hka (Carsten Sinz)

I had the same problem when I tried to install MacPorts 1.6.0. It seems to be caused (at least in my case) by the fact that the installer tries to make an rsync-connection. This might fail when you are using an HTTP-proxy. (Therefore I think the postflight script should be modified to take this into account). For me the installation worked fine, when I tried it from another location without an HTTP-proxy.

comment:6 Changed 16 years ago by mellonjasper@…

I am not behind an HTTP-proxy, so that is not the problem in my case. A "sudo port selfupdate" works without problems.

comment:7 Changed 16 years ago by jmpp@…

Cc: pburleson@… added

comment:8 Changed 16 years ago by jmpp@…

I am unable to reproduce this bug: when I run the script on a virgin account with no MacPorts settings, they are properly added to the ~/.profile file (which is properly created if it doesn't already exist). Any more info anyone in this ticket can provide me with?

If you can, please create a virgin account (if on Leopard, the Guest account might suffice) and confirm that it doesn't have any MacPorts Terminal settings through the following:

  • the output of the env command;
  • the output of the printenv PATH, printenv MANPATH and printenv DISPLAY commands;

Once that's established, try running the postflight script manually (which you can download from here) and tell me if there are any errors; or, on the other hand, if the settings are properly added. Setting set -x (debugging mode for bash) might help. If pasting any terminal output, please enclose it within the {{{ }}} wrappers for proper Trac formatting (read WikiFormatting for more info).

Lastly, any info that might have been output to the /var/log/install file about the failed run of the postfligth script might also help (hint: the log might have been already rotated, so also look into /var/log/install.log.0.bz2 and possibly higher numbered files).

-jmpp

PS: Do any of you happen to have the /etc/paths.d/macports and /etc/manpaths.d/macports files installed?

comment:9 Changed 16 years ago by mellonjasper@…

I created a new account with no administrator rights and checked the PATH, MANPATH, DISPLAY and env. No MacPorts paths where present. After running the postflight script ran (withoud sudo), a .profile was created. After opening a new shell the PATH, MANPATH, DISPLAY and env where correct (several /opt/ paths added). The output of postflight contained some error, but they where al related to not running as administrator.

The install.log indicates a problem:

Dec 28 22:58:36 mac-name Installer[66086]: run postflight script for MacPorts-1.6.0
Dec 28 22:58:36 mac-name Installer[66086]: Localized installer script postflight found in the MacPorts-1.6.0 package. Using compatibility mode.
Dec 28 22:58:36 mac-name runner[66089]: postflight[66099]: Unknown shell! Please set your MacPorts compatible environment manually.
Dec 28 22:58:36 mac-name runner[66089]: postflight[66099]: 
Dec 28 22:58:36: --- last message repeated 1 time ---
Dec 28 22:58:36 mac-name runner[66089]: postflight[66099]: Checking the shell environment for user "USERNAM"...
Dec 28 22:58:36 mac-name runner[66089]: postflight[66099]: 
Dec 28 22:58:36: --- last message repeated 2 times ---
Dec 28 22:58:36 mac-name runner[66089]: postflight[66099]: /Users/jester/Downloads/MacPorts-1.6.0.pkg/Contents/Resources/English.lproj/postflight: line 71: /Users/jester/.: Is a directory
Dec 28 22:58:36 mac-name runner[66089]: postflight[66099]: 
Dec 28 22:58:36 mac-name runner[66089]: postflight[66099]: /Users/jester/Downloads/MacPorts-1.6.0.pkg/Contents/Resources/English.lproj/postflight: line 96: /Users/jester/.: Is a directory
Dec 28 22:58:36 mac-name runner[66089]: postflight[66099]: 
Dec 28 22:58:36 mac-name runner[66089]: postflight[66099]: Your shell already has the right MANPATH environment variable for use with MacPorts!
Dec 28 22:58:36 mac-name runner[66089]: postflight[66099]: 
Dec 28 22:58:36 mac-name runner[66089]: postflight[66099]: Your shell already has the right DISPLAY environment variable for use with MacPorts!
Dec 28 22:58:36 mac-name runner[66089]: postflight[66099]: 
Dec 28 22:58:36: --- last message repeated 1 time ---
Dec 28 22:58:36 mac-name runner[66089]: postflight[66099]: Synchronizing the MacPorts installation with the project's rsync server...
Dec 28 22:58:36 mac-name runner[66089]: postflight[66099]: 
Dec 28 22:58:37: --- last message repeated 1 time ---
Dec 28 22:58:37 mac-name runner[66089]: postflight[66099]: Synchronizing local ports tree from rsync://rsync.macports.org/release/ports/

The /etc/paths.d and /etc/manpaths.d/only contain an X11 file.

I hope this helps.

Jasper.

comment:10 Changed 16 years ago by matrixm@…

I just installed macports onto Leopard today. This was a brand new machine. In fact, it was so new, that the only thing I'd done before installing macports was to go through the apple pre-install that configured and set the machine up for the first time, install 10.5.1 update, installed XCode tools off the DVD that came with the machine, then download and install macports via the dmg image located at http://svn.macports.org/repository/macports/downloads/MacPorts-1.6.0/MacPorts-1.6.0-10.5-Leopard.dmg

After completeing the install, I found the X11.app and opened it up, and began to search for ports. The first thing I got was a file not found error regarding 'port.' So I checked my path, and no /opt directories in any PATH variable. I discovered that this default user did not have a .profile, .bash_profile, nor a .bashrc file in the home directory. I'm not sure if this had any impact on the setting of the PATH/MANPATH variables or not though.

I grep'd the install log for anythin referring to path, and the only line that was mentioned during the postflight portion of the log file was that the MANPATH was already configured correctly for macports, even though it wasn't.

I did discover that the /etc/paths and /etc/manpaths files existed (which I hadn't known about until I read through the /etc/profile script). I added /opt/local/bin and /opt/local/sbin to the /etc/paths file, and then put /opt/local/man in /etc/manpaths. I'm not sure how the /etc/paths.d and /etc/manpaths.d files are loaded, but would it be possible to have the postflight script add the macports directories to either /etc/paths and /etc/manpaths or do something with a /etc/paths.d/macports and /etc/manpaths.d/macports file somehow to include those directories?

I'm not sure of the process, but could I be added as a CC for this ticket?

comment:11 in reply to:  9 ; Changed 16 years ago by jmpp@…

Replying to mellonjasper@gmail.com:

The errors in the log file are similar to a group I recently dealt with on the MacPorts-Users mailing list, so I'm inclined to believe this particular case is already corrected. Anyhow, can you still tell me the output of the basename $SHELL command?

Thanks!

-jmpp

comment:12 in reply to:  10 Changed 16 years ago by jmpp@…

Replying to matrixm@gmail.com:

Please tell me the relevant errors that are shown in /var/log/installer so that I can have an idea of what went wrong in your case. As for your other comments, I already dealt with most of them on the MacPorts-Users mailing list, so lets please try to keep this ticket clean for the debugging of the postflight script, thanks!

-jmpp

comment:13 in reply to:  11 Changed 16 years ago by rui@…

I'm having the exact same problem. No .profile shows up after installing Macports on Leopard, using MacPorts-1.6.0.pkg. Before reading this Ticket, I have tried to reinstall Macport again, and no luck. Replying directly to your request:

Anyhow, can you still tell me the output of the basename $SHELL command?

I also obtained the expected:

bash 

In the /var/log/installer.log I could find the following output:

Jan 25 02:24:48 Maresia Installer[148]:         Finishing receipt
Jan 25 02:24:48 Maresia Installer[148]: run postflight script for MacPorts-1.6.0
Jan 25 02:24:48 Maresia Installer[148]: Localized installer script postflight found in the MacPorts-1.6.0 package. Using compatibility mode.
Jan 25 02:24:49 Maresia runner[152]: postflight[160]: Unknown shell! Please set your MacPorts compatible environment manually.
Jan 25 02:24:49 Maresia runner[152]: postflight[160]: 
Jan 25 02:24:49: --- last message repeated 1 time ---

I don't know if this output is expected, but for some reason the script can't determine which shell is being used.

Is there any thing else I can do to fix this problem?

Rui

Changed 16 years ago by rui@…

Attachment: install.log added

/var/log/install.log

Changed 16 years ago by rui@…

Attachment: install.log.0.bz2 added

/var/log/install.log

comment:14 Changed 16 years ago by rui@…

I have just added my last install.log.0.bz2 file. Maybe you can find there something that can help.

Rui

comment:15 Changed 16 years ago by sidney@…

I may have stumbled on a clue and a workaround.

I am seeing the same problem on a close to fresh install of Leopard. I don't know exactly how it was installed because it is a new machine with my IT dept's standard Mac image. When I downloaded and ran the Macports installer there was no .profile in my home directory and no ports environment. I downloaded the postflight script and ran it, forgetting to use "sudo". That successfully created a ~/.profile that sets PATH and MANPATH and then died trying to run the rsync because it did not have permissions.

When I then used sudo to run the postflight it produced the following output with errors:

The MacPorts Project, postflight script version 1.6.1: checking the shell environment for user "root". Unknown shell (sh)! Please set your MacPorts compatible environment manually. Synchronizing the MacPorts installation with the project's rsync server... Synchronizing local ports tree from rsync://rsync.macports.org/release/ports/ receiving file list ... done

Then the rsync got run ok. The end result of running postflight first as user then with sudo seemed to be a working installation.

Running 'sudo su' does end up with an sh prompt, not bash.

I'm not sure if it is relevant but I have noticed that one change in Leopard is that by default sudo is configured to not pass through most environment variables from the user environment to root's shell environment. So if postflight is checking the environment it will not see the right things when run under sudo.

Actually, how does postflight deal with making changes to the user's .profile but having to run as root in order to do the rsync?

comment:16 Changed 16 years ago by neophi@…

Cc: neophi@… added

Cc Me!

comment:17 in reply to:  description Changed 16 years ago by neophi@…

Replying to mellonjasper@gmail.com:

I installed MacPorts on my iMac with leopard. I downloaded the package MacPorts-1.6.0.pkg and installed. The installation created the directories under /opt/local, but no .profile was create in my homedir. Therefore the port command did not work in a shell. I had to create a .profile myself. After that MacPorts worked fine.

The manual creation of a .profile file should not be necessary.

I experienced the same issue described above. After the MacPorts installation wizard was complete, there was no .profile. I uninstalled MacPorts (as per the guide) and reinstalled but still same issue. I found this ticket and downloaded/ran the postflight script posted by jmpp, and now the port command is working.

Let me know if you would like me to post any install logs. The issue was an Unknown Shell error like posted above by mellonjasper.

basename $SHELL outputs bash.

comment:18 Changed 16 years ago by v.volle@…

hmm, this isn't fixed for 5 months, no workaround described. How should I trust a package installer that couldn't be installed?

comment:19 Changed 16 years ago by v.volle@…

Cc: v.volle@… added

Cc Me!

comment:20 Changed 16 years ago by raimue (Rainer Müller)

There is an automatic workaround in the ProblemHotlist. Also, this is described in our guide.

Sorry, we should have linked this earlier here.

comment:21 Changed 16 years ago by raimue (Rainer Müller)

Copied the postflight script from the release_1_6 branch to trunk so the changes will not be lost or forgotten, in r38037.

comment:22 Changed 16 years ago by blb@…

Cc: groblewis@… added

Cc reporter of dup #15989.

comment:23 Changed 16 years ago by blb@…

Cc: al@… added

Cc reporter of dup #16089.

comment:24 Changed 15 years ago by lemuelf@…

Cc: lemuelf@… added

Cc Me!

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

Milestone: MacPorts base bugsMacPorts 1.7.0
Resolution: fixed
Status: newclosed

This has been fixed in trunk awhile ago. It will be in 1.7.0.

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

Cc: ryandesign@… added

comment:27 Changed 15 years ago by chris@…

Cc: chris@… added

Cc Me!

Note: See TracTickets for help on using tickets.