EnterpriseDB / edb-installers

PostgreSQL installers packaged by EDB
36 stars 11 forks source link

Installers fail on macOS Sequoia #177

Open dave-shawley opened 1 month ago

dave-shawley commented 1 month ago

Both the postgresql-15.8-1-osx.dmg and postgresql-16.4-1-os.dmg fail to run on my macOS Sequoia (15.0.1) laptop. After opening the application and entering my password to allow system access, the installer simply exits without any feedback.

I traced this down to what appears to be a bug in determining which architecture binary to run (eg, osx-arm64 or osx-x86_64). The following is logged in the system log:

default 11:42:56.275909-0400    runningboardd   Checking PreventLaunch: global:0 exPath:/Volumes/PostgreSQL 15.8-1/postgresql-15.8-1-osx.app/Contents/MacOS/installbuilder.sh predicates:(null) allow:(null)
default 11:42:56.276602-0400    runningboardd   'app<application.com.installbuilder.appinstaller.17.28(2145)>' Constructed job description: .... redacted ...
default 11:42:56.310405-0400    loginwindow -[PersistentAppsSupport applicationReady:] | App: postgresql-15.8-1-osx, ready, updating active tracking timer
default 11:42:56.310455-0400    loginwindow -[ApplicationManager checkInAppContext:eventData:] | ApplicationManager: Checked in app : postgresql-15.8-1-osx
default 11:43:03.308758-0400    authd   Succeeded authorizing right 'system.privilege.setugid_appkit' by client '/Volumes/PostgreSQL 15.8-1/postgresql-15.8-1-osx.app/Contents/MacOS/PostgreSQL' [19957] for authorization created by '/Volumes/PostgreSQL 15.8-1/postgresql-15.8-1-osx.app/Contents/MacOS/PostgreSQL' [19957] (13,0) (engine 1428)
default 11:43:03.309926-0400    authd   Succeeded authorizing right 'system.privilege.admin' by client '/Volumes/PostgreSQL 15.8-1/postgresql-15.8-1-osx.app/Contents/MacOS/PostgreSQL' [19957] for authorization created by '/Volumes/PostgreSQL 15.8-1/postgresql-15.8-1-osx.app/Contents/MacOS/PostgreSQL' [19957] (13,0) (engine 1428)
default 11:43:03.311813-0400    PostgreSQL  AuthorizationExecuteWithPrivileges and AuthorizationExecuteWithPrivilegesExternalForm are deprecated and functionality will be removed soon - please update your application
default 11:43:03.331748-0400    authd   Succeeded authorizing right 'system.privilege.admin' by client '/usr/libexec/security_authtrampoline' [19980] for authorization created by '/Volumes/PostgreSQL 15.8-1/postgresql-15.8-1-osx.app/Contents/MacOS/PostgreSQL' [19957] (3,0) (engine 1431)
default 11:43:03.333117-0400    security_authtrampoline executing /Volumes/PostgreSQL 15.8-1/postgresql-15.8-1-osx.app/Contents/MacOS/none
error   11:43:03.334516-0400    PostgreSQL  parent received status=-60031
default 11:43:03.403976-0400    loginwindow -[PersistentAppsSupport applicationQuit:] | for app:postgresql-15.8-1-osx, _appTrackingState = 2
default 11:43:03.404000-0400    loginwindow -[PersistentAppsSupport applicationQuit:] | App: postgresql-15.8-1-osx, quit, updating active tracking timer

The interesting message is the one from security_authtrampoline

executing /Volumes/PostgreSQL 15.8-1/postgresql-15.8-1-osx.app/Contents/MacOS/none

I worked around the problem by running ./PostgreSQL osx-arm64 --require-admin 1 from within the .../postgresql-15.8-1.osxapp/Contents/MacOS directory. The installation works so the installer is functional ... for some reason it is not finding the appropriate package to install.

% uname -r
24.0.0
% uname -p
arm
% uname -m
arm64
% uname -a
Darwin s1134 24.0.0 Darwin Kernel Version 24.0.0: Tue Sep 24 23:37:36 PDT 2024; root:xnu-11215.1.12~1/RELEASE_ARM64_T6020 arm64
sandeep-edb commented 1 month ago

That's odd. Could you please run this command on the terminal and share the output:

sh -x /Volumes/PostgreSQL 15.8-1/postgresql-15.8-1-osx.app/Contents/MacOS/installbuilder.sh

sandeep-edb commented 4 weeks ago

We are unable to reproduce the issue at our end

dave-shawley commented 4 weeks ago

@sandeep-edb I figured out the problem. I have /bin/sh configured as a true Bourne shell instead of bash so it is rejecting the if [ "..." == "..." ] lines as a syntax error. The correct POSIX sh syntax is if [ "..." = "..." ] - note the single = instead of ==. You can recreate the issue by using /bin/dash or changing the /var/select/sh link to point at dash instead of bash. See man sh for details ... sorry for the man page reference but I couldn't find a good online reference though googling for "bashism" yields a lot of information.

The simple solution is to change the shebang to use bash instead so #!/usr/bin/env bash instead of #!/bin/sh. You can also run something like shellcheck which will point out portability problems.

s1375% sh -x ~/Temporary/postgresql-16.4-1-osx.app/Contents/MacOS/installbuilder.sh
+ uname -r
+ os_version=24.0.0
+ uname -p
+ machine_platform=arm
+ uname -m
+ machine_arch=arm64
+ dirname /Users/daves/Temporary/postgresql-16.4-1-osx.app/Contents/MacOS/installbuilder.sh
+ cd /Users/daves/Temporary/postgresql-16.4-1-osx.app/Contents/MacOS
+ pwd
+ runtimes_dir=/Users/daves/Temporary/postgresql-16.4-1-osx.app/Contents/MacOS
+ EXTRACT_MODE=0
+ ARGLIST=
+ [ arm64 == x86_64 ]
/Users/daves/Temporary/postgresql-16.4-1-osx.app/Contents/MacOS/installbuilder.sh: 24: [: arm64: unexpected operator
+ [ arm64 == arm64 ]
/Users/daves/Temporary/postgresql-16.4-1-osx.app/Contents/MacOS/installbuilder.sh: 28: [: arm64: unexpected operator
+ executable=none
+ [ -f /Users/daves/Temporary/postgresql-16.4-1-osx.app/Contents/MacOS/ ]
+ [ none == none ]
/Users/daves/Temporary/postgresql-16.4-1-osx.app/Contents/MacOS/installbuilder.sh: 37: [: none: unexpected operator
+ id -u
+ [  == --help -o 0 -eq 1 -o 2145 == 0 ]
/Users/daves/Temporary/postgresql-16.4-1-osx.app/Contents/MacOS/installbuilder.sh: 42: [: unexpected operator
+ dirname /Users/daves/Temporary/postgresql-16.4-1-osx.app/Contents/MacOS/installbuilder.sh
+ /Users/daves/Temporary/postgresql-16.4-1-osx.app/Contents/MacOS/PostgreSQL none --require-admin 1
It was not possible to perform the installation with administrator privileges (status: 4294907265).
Please execute:

sudo /Users/daves/Temporary/postgresql-16.4-1-osx.app/Contents/MacOS/none --mode text

as an alternative to achieve the same effect