gregneagle / pycreateuserpkg

Python tool to create macOS packages that create user accounts
Other
292 stars 44 forks source link

can't login with created user on macOS 10.14 mojave #23

Closed vasquesbc closed 6 years ago

vasquesbc commented 6 years ago

i've used a once working package on macOS 10.14 mojave. the creation/installation works - the user also exists afterwards (i've checked it via dscl and /Users directory) however: i can't login with the user after creation.

if there is anything i could do to investigate this issue further, please let me know

gregneagle commented 6 years ago

Look in /var/log/install.log for clues. Note also the tool was updated for compatibility with Mojave.

vasquesbc commented 6 years ago

i can't see any issues there - do you?:

2018-10-02 15:55:13+02 testmachine installer[587]: Referenced component packages (1) trustLevel=100 2018-10-02 15:55:13+02 testmachine installer[587]: -[IFPKGDerivedDocument sortedPackageLocations]: result = ( "file://localhost" ) 2018-10-02 15:55:13+02 testmachine installer[587]: -[IFDInstallController(Private) _buildInstallPlanReturningError:]: location = file://localhost 2018-10-02 15:55:13+02 testmachine installer[587]: -[IFDInstallController(Private) _buildInstallPlanReturningError:]: file://localhost/Library/PrivilegedHelperTools/testSetupAgent.app/Contents/Resources/Users/Test.pkg 2018-10-02 15:55:13+02 testmachine installer[587]: Set authorization level to root for session 2018-10-02 15:55:13+02 testmachine installer[587]: Administrator authorization granted. 2018-10-02 15:55:13+02 testmachine installer[587]: Will use PK session 2018-10-02 15:55:13+02 testmachine installer[587]: Using authorization level of root for IFPKInstallElement 2018-10-02 15:55:13+02 testmachine installer[587]: Starting installation: 2018-10-02 15:55:13+02 testmachine installer[587]: Configuring volume "Macintosh HD" 2018-10-02 15:55:13+02 testmachine installer[587]: Preparing disk for local booted install. 2018-10-02 15:55:13+02 testmachine installer[587]: Free space on "Macintosh HD": 235.57 GB (235568001024 bytes). 2018-10-02 15:55:13+02 testmachine installer[587]: Create temporary directory "/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T//Install.587h1ytrN" 2018-10-02 15:55:13+02 testmachine installer[587]: IFPKInstallElement (1 packages) 2018-10-02 15:55:13+02 testmachine installd[368]: PackageKit: Adding client PKInstallDaemonClient pid=587, uid=0 (/usr/sbin/installer) 2018-10-02 15:55:13+02 testmachine installer[587]: PackageKit: Enqueuing install with framework-specified quality of service (utility) 2018-10-02 15:55:13+02 testmachine installd[368]: PackageKit: ----- Begin install ----- 2018-10-02 15:55:13+02 testmachine installd[368]: PackageKit: request=PKInstallRequest <1 packages, destination=/> 2018-10-02 15:55:13+02 testmachine installd[368]: PackageKit: packages=( "PKLeopardPackage <id=de.test.users.test.testuser, version=4.1, url=file://localhost/Library/PrivilegedHelperTools/testSetupAgent.app/Contents/Resources/Users/Test.pkg>" ) 2018-10-02 15:55:13+02 testmachine installd[368]: PackageKit: Set reponsibility for install to 280 2018-10-02 15:55:13+02 testmachine installd[368]: PackageKit: Extracting file://localhost/Library/PrivilegedHelperTools/testSetupAgent.app/Contents/Resources/Users/Test.pkg (destination=/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/C/PKInstallSandboxManager/722BA76B-51A8-4043-A80C-D21901BF7551.activeSandbox/Root, uid=0) 2018-10-02 15:55:13+02 testmachine installd[368]: PackageKit: prevent user idle system sleep 2018-10-02 15:55:13+02 testmachine installd[368]: PackageKit: suspending backupd 2018-10-02 15:55:13+02 testmachine installd[368]: PackageKit: Using trashcan path /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/PKInstallSandboxTrash/722BA76B-51A8-4043-A80C-D21901BF7551.sandboxTrash for sandbox /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/C/PKInstallSandboxManager/722BA76B-51A8-4043-A80C-D21901BF7551.activeSandbox 2018-10-02 15:55:13+02 testmachine installd[368]: PackageKit: Shoving /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/C/PKInstallSandboxManager/722BA76B-51A8-4043-A80C-D21901BF7551.activeSandbox/Root (1 items) to / 2018-10-02 15:55:13+02 testmachine install_monitor[588]: Temporarily excluding: /Applications, /Library, /System, /bin, /private, /sbin, /usr 2018-10-02 15:55:13+02 testmachine installd[368]: PackageKit: Executing script "./postinstall" in /private/tmp/PKInstallSandbox.WVJhNq/Scripts/de.test.users.test.testuser.0DzzEK 2018-10-02 15:55:14+02 testmachine installd[368]: PackageKit: Writing receipt for de.test.users.test.testuser to / 2018-10-02 15:55:14+02 testmachine installd[368]: Installed "Test" () 2018-10-02 15:55:14+02 testmachine install_monitor[588]: Re-included: /Applications, /Library, /System, /bin, /private, /sbin, /usr 2018-10-02 15:55:14+02 testmachine installd[368]: PackageKit: releasing backupd 2018-10-02 15:55:14+02 testmachine installd[368]: PackageKit: allow user idle system sleep 2018-10-02 15:55:14+02 testmachine installd[368]: PackageKit: ----- End install ----- 2018-10-02 15:55:14+02 testmachine installd[368]: PackageKit: 1.8s elapsed install time 2018-10-02 15:55:14+02 testmachine installd[368]: PackageKit: Running idle tasks 2018-10-02 15:55:14+02 testmachine installd[368]: PackageKit: Removing client PKInstallDaemonClient pid=587, uid=0 (/usr/sbin/installer) 2018-10-02 15:55:14+02 testmachine installd[368]: PackageKit: Done with sandbox removals

i've built the package today using the most recent tool (downloaded it yesterday)

gregneagle commented 6 years ago

I just used the tool to create a new "foobar" user pkg, installed it on a Mojave VM, and successfully logged in as that user. My best guess is that the password for the user account is not what you think it is -- perhaps you provided a password at the command line that the shell modified because it contained characters the shell interpreted specially. In your place, I'd experiment with different passwords (maybe starting with a simple alphanumeric password) and also letting the tool prompt for a password rather than providing a -p PASSWORD/--password=PASSWORD option at the command line.

gregneagle commented 6 years ago

As an extreme example of what I mean:

./createuserpkg --name foobar -p $HOME -u 599 -V 1.0 -i com.foobar.user ~/Desktop/foobaruser.pkg

What do you think the password for the foobar account is? It's not "$HOME" -- it's "/Users/gneagle"! (If you try this the actual password will be different -- it will be the path to the home directory of the user running the createuserpkg command.)

jelockwood commented 6 years ago

For what it's worth I successfully used the latest version of this python script with the Mojave fixes to build a package for creating users on Mojave and it worked.

As I know Greg will know, the previously patched GUI tool which Greg fixed for High Sierra does not work on Mojave.

vasquesbc commented 6 years ago

perhaps you provided a password at the command line that the shell modified because it contained characters the shell interpreted specially.

that's why i tested it with an alphanumeric-only password too. i've now tested it with usage of the password-prompt variant.

i tried several different approaches in the meantime and i now think it has to do something with the time or the context in which the installation of the user-package occurs:

in my case i use a „Setup Assistent“ as a LaunchAgent i wrote myself to run several package-installations and scripts at first boot at the login-window screen of macOS. After that tool finishes it's work a reboot is triggered. to date that worked pretty fine (i used it since 10.10 until 10.13) - i think in mojave something has changed. in fact the user is created, but something prevents to login or the password setting fails somehow if the package-installation is run that way.

i will investigate this further. for now i suppose your tool isn't the problem - so feel free to close this issue. if i got any news on this, i will report here.

gregneagle commented 6 years ago

Closing it for now; re-open it if you have additional information or a way we could reproduce your issue.

vasquesbc commented 6 years ago

After several weeks off work i've started to investigate this issue further since yesterday:

I've reduced the options used to create the user-pkg bit by bit, rebuild my setup-tool & created my AutoDMG-image every time from scratch.

The issue seams to occur as soon as i specify a user gid!

Setting the user gid ist pretty useful in our environment because we are using a pretty big XSAN with ACL-based permissions. It would be a mess, if the local administrators of the same name on our machines have different gid's…

if there is anything i could provide to you to help solving this issue, please let me know!

gregneagle commented 6 years ago

Relevant content from /var/log/install.log. A step-by-step way to reproduce your issue.

vasquesbc commented 6 years ago

I've created two test-packages:

Test1 (no gid provided): ./createuserpkg -n test1 -u 501 -V 1.0 -i de.test.users.test1 -f Test1 -a ./Test1.pkg

Test2 (custom gid provided): ./createuserpkg -n test2 -u 502 -V 2.0 -i de.test.users.test2 -f Test2 -a -g 1B1E99AA-40F8-4219-8211-201F691FBF7F ./Test2.pkg

Integrated both of them in my First-Boot Setup Tool which installs them at Login-Screen with root-privileges and reboots the machine afterwards.

As expected: I can Login as "Test1" but cannot Login as "Test2"

Snippets of the corresponding parts of /var/log/install.log:

Test1.pkg:

2018-11-06 21:25:34+01 testmachine installer[581]: Referenced component packages (1) trustLevel=100 2018-11-06 21:25:34+01 testmachine installer[581]: -[IFPKGDerivedDocument sortedPackageLocations]: result = ( "file://localhost" ) 2018-11-06 21:25:34+01 testmachine installer[581]: -[IFDInstallController(Private) _buildInstallPlanReturningError:]: location = file://localhost 2018-11-06 21:25:34+01 testmachine installer[581]: -[IFDInstallController(Private) _buildInstallPlanReturningError:]: file://localhost/Library/PrivilegedHelperTools/zdfSetupAgent.app/Contents/Resources/Packages/Test1.pkg 2018-11-06 21:25:34+01 testmachine installer[581]: Set authorization level to root for session 2018-11-06 21:25:34+01 testmachine installer[581]: Administrator authorization granted. 2018-11-06 21:25:34+01 testmachine installer[581]: Will use PK session 2018-11-06 21:25:34+01 testmachine installer[581]: Using authorization level of root for IFPKInstallElement 2018-11-06 21:25:34+01 testmachine installer[581]: Starting installation: 2018-11-06 21:25:34+01 testmachine installer[581]: Configuring volume "Macintosh HD" 2018-11-06 21:25:34+01 testmachine installer[581]: Preparing disk for local booted install. 2018-11-06 21:25:34+01 testmachine installer[581]: Free space on "Macintosh HD": 235.55 GB (235554414592 bytes). 2018-11-06 21:25:34+01 testmachine installer[581]: Create temporary directory "/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T//Install.581EM5fl4" 2018-11-06 21:25:34+01 testmachine installer[581]: IFPKInstallElement (1 packages) 2018-11-06 21:25:34+01 testmachine installd[362]: PackageKit: Adding client PKInstallDaemonClient pid=581, uid=0 (/usr/sbin/installer) 2018-11-06 21:25:34+01 testmachine installer[581]: PackageKit: Enqueuing install with framework-specified quality of service (utility) 2018-11-06 21:25:34+01 testmachine installd[362]: PackageKit: ----- Begin install ----- 2018-11-06 21:25:34+01 testmachine installd[362]: PackageKit: request=PKInstallRequest <1 packages, destination=/> 2018-11-06 21:25:34+01 testmachine installd[362]: PackageKit: packages=( "PKLeopardPackage <id=de.test.users.test1, version=1.0, url=file://localhost/Library/PrivilegedHelperTools/zdfSetupAgent.app/Contents/Resources/Packages/Test1.pkg>" ) 2018-11-06 21:25:34+01 testmachine installd[362]: PackageKit: Set reponsibility for install to 280 2018-11-06 21:25:34+01 testmachine installd[362]: PackageKit: Extracting file://localhost/Library/PrivilegedHelperTools/zdfSetupAgent.app/Contents/Resources/Packages/Test1.pkg (destination=/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/C/PKInstallSandboxManager/485E25BB-A9D7-459E-93A8-FF936C80CC14.activeSandbox/Root, uid=0) 2018-11-06 21:25:34+01 testmachine installd[362]: PackageKit: prevent user idle system sleep 2018-11-06 21:25:34+01 testmachine installd[362]: PackageKit: suspending backupd 2018-11-06 21:25:34+01 testmachine installd[362]: PackageKit: Using trashcan path /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/PKInstallSandboxTrash/485E25BB-A9D7-459E-93A8-FF936C80CC14.sandboxTrash for sandbox /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/C/PKInstallSandboxManager/485E25BB-A9D7-459E-93A8-FF936C80CC14.activeSandbox 2018-11-06 21:25:34+01 testmachine installd[362]: PackageKit: Shoving /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/C/PKInstallSandboxManager/485E25BB-A9D7-459E-93A8-FF936C80CC14.activeSandbox/Root (1 items) to / 2018-11-06 21:25:34+01 testmachine install_monitor[582]: Temporarily excluding: /Applications, /Library, /System, /bin, /private, /sbin, /usr 2018-11-06 21:25:34+01 testmachine installd[362]: PackageKit: Executing script "./postinstall" in /private/tmp/PKInstallSandbox.VFdXfq/Scripts/de.test.users.test1.HheWQk 2018-11-06 21:25:35+01 testmachine installd[362]: PackageKit: Writing receipt for de.test.users.test1 to / 2018-11-06 21:25:35+01 testmachine installd[362]: Installed "Test1" () 2018-11-06 21:25:35+01 testmachine install_monitor[582]: Re-included: /Applications, /Library, /System, /bin, /private, /sbin, /usr 2018-11-06 21:25:35+01 testmachine installd[362]: PackageKit: releasing backupd 2018-11-06 21:25:35+01 testmachine installd[362]: PackageKit: allow user idle system sleep 2018-11-06 21:25:35+01 testmachine installd[362]: PackageKit: ----- End install ----- 2018-11-06 21:25:35+01 testmachine installd[362]: PackageKit: 1.6s elapsed install time 2018-11-06 21:25:35+01 testmachine installd[362]: PackageKit: Running idle tasks 2018-11-06 21:25:35+01 testmachine installd[362]: PackageKit: Removing client PKInstallDaemonClient pid=581, uid=0 (/usr/sbin/installer) 2018-11-06 21:25:35+01 testmachine installd[362]: PackageKit: Done with sandbox removals 2018-11-06 21:25:36+01 testmachine installer[581]: Removing temporary directory "/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T//Install.581EM5fl4" 2018-11-06 21:25:36+01 testmachine installer[581]: Finalize disk "Macintosh HD" 2018-11-06 21:25:36+01 testmachine installer[581]: Notifying system of updated components 2018-11-06 21:25:36+01 testmachine installer[581]: 2018-11-06 21:25:36+01 testmachine installer[581]: **** Summary Information **** 2018-11-06 21:25:36+01 testmachine installer[581]: Operation Elapsed time 2018-11-06 21:25:36+01 testmachine installer[581]: ----------------------------- 2018-11-06 21:25:36+01 testmachine installer[581]: zero 0.00 seconds 2018-11-06 21:25:36+01 testmachine installer[581]: disk 0.02 seconds 2018-11-06 21:25:36+01 testmachine installer[581]: install 2.09 seconds 2018-11-06 21:25:36+01 testmachine installer[581]: -total- 2.11 seconds 2018-11-06 21:25:36+01 testmachine installer[581]:

Test2.pkg:

2018-11-06 21:25:36+01 testmachine installer[597]: Referenced component packages (1) trustLevel=100 2018-11-06 21:25:36+01 testmachine installer[597]: -[IFPKGDerivedDocument sortedPackageLocations]: result = ( "file://localhost" ) 2018-11-06 21:25:36+01 testmachine installer[597]: -[IFDInstallController(Private) _buildInstallPlanReturningError:]: location = file://localhost 2018-11-06 21:25:36+01 testmachine installer[597]: -[IFDInstallController(Private) _buildInstallPlanReturningError:]: file://localhost/Library/PrivilegedHelperTools/zdfSetupAgent.app/Contents/Resources/Packages/Test2.pkg 2018-11-06 21:25:36+01 testmachine installer[597]: Set authorization level to root for session 2018-11-06 21:25:36+01 testmachine installer[597]: Administrator authorization granted. 2018-11-06 21:25:36+01 testmachine installer[597]: Will use PK session 2018-11-06 21:25:36+01 testmachine installer[597]: Using authorization level of root for IFPKInstallElement 2018-11-06 21:25:36+01 testmachine installer[597]: Starting installation: 2018-11-06 21:25:36+01 testmachine installer[597]: Configuring volume "Macintosh HD" 2018-11-06 21:25:36+01 testmachine installer[597]: Preparing disk for local booted install. 2018-11-06 21:25:36+01 testmachine installer[597]: Free space on "Macintosh HD": 235.55 GB (235554131968 bytes). 2018-11-06 21:25:36+01 testmachine installer[597]: Create temporary directory "/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T//Install.597EDlV3g" 2018-11-06 21:25:36+01 testmachine installer[597]: IFPKInstallElement (1 packages) 2018-11-06 21:25:36+01 testmachine installd[362]: PackageKit: Adding client PKInstallDaemonClient pid=597, uid=0 (/usr/sbin/installer) 2018-11-06 21:25:36+01 testmachine installer[597]: PackageKit: Enqueuing install with framework-specified quality of service (utility) 2018-11-06 21:25:36+01 testmachine installd[362]: PackageKit: ----- Begin install ----- 2018-11-06 21:25:36+01 testmachine installd[362]: PackageKit: request=PKInstallRequest <1 packages, destination=/> 2018-11-06 21:25:36+01 testmachine installd[362]: PackageKit: packages=( "PKLeopardPackage <id=de.test.users.test2, version=2.0, url=file://localhost/Library/PrivilegedHelperTools/zdfSetupAgent.app/Contents/Resources/Packages/Test2.pkg>" ) 2018-11-06 21:25:36+01 testmachine installd[362]: PackageKit: Set reponsibility for install to 280 2018-11-06 21:25:36+01 testmachine installd[362]: PackageKit: Extracting file://localhost/Library/PrivilegedHelperTools/zdfSetupAgent.app/Contents/Resources/Packages/Test2.pkg (destination=/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/C/PKInstallSandboxManager/53BD5BDD-E3E4-4773-877E-DB47B8DAAB22.activeSandbox/Root, uid=0) 2018-11-06 21:25:36+01 testmachine installd[362]: PackageKit: prevent user idle system sleep 2018-11-06 21:25:36+01 testmachine installd[362]: PackageKit: suspending backupd 2018-11-06 21:25:36+01 testmachine installd[362]: PackageKit: Using trashcan path /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/PKInstallSandboxTrash/53BD5BDD-E3E4-4773-877E-DB47B8DAAB22.sandboxTrash for sandbox /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/C/PKInstallSandboxManager/53BD5BDD-E3E4-4773-877E-DB47B8DAAB22.activeSandbox 2018-11-06 21:25:36+01 testmachine installd[362]: PackageKit: Shoving /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/C/PKInstallSandboxManager/53BD5BDD-E3E4-4773-877E-DB47B8DAAB22.activeSandbox/Root (1 items) to / 2018-11-06 21:25:36+01 testmachine install_monitor[598]: Temporarily excluding: /Applications, /Library, /System, /bin, /private, /sbin, /usr 2018-11-06 21:25:36+01 testmachine installd[362]: PackageKit: Executing script "./postinstall" in /private/tmp/PKInstallSandbox.Jhx3VO/Scripts/de.test.users.test2.mzixFO 2018-11-06 21:25:38+01 testmachine installd[362]: PackageKit: Writing receipt for de.test.users.test2 to / 2018-11-06 21:25:38+01 testmachine installd[362]: Installed "Test2" () 2018-11-06 21:25:38+01 testmachine install_monitor[598]: Re-included: /Applications, /Library, /System, /bin, /private, /sbin, /usr 2018-11-06 21:25:38+01 testmachine installd[362]: PackageKit: releasing backupd 2018-11-06 21:25:38+01 testmachine installd[362]: PackageKit: allow user idle system sleep 2018-11-06 21:25:38+01 testmachine installd[362]: PackageKit: ----- End install ----- 2018-11-06 21:25:38+01 testmachine installd[362]: PackageKit: 2.1s elapsed install time 2018-11-06 21:25:38+01 testmachine installd[362]: PackageKit: Running idle tasks 2018-11-06 21:25:38+01 testmachine installd[362]: PackageKit: Removing client PKInstallDaemonClient pid=597, uid=0 (/usr/sbin/installer) 2018-11-06 21:25:38+01 testmachine installd[362]: PackageKit: Done with sandbox removals 2018-11-06 21:25:39+01 testmachine installer[597]: Removing temporary directory "/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T//Install.597EDlV3g" 2018-11-06 21:25:39+01 testmachine installer[597]: Finalize disk "Macintosh HD" 2018-11-06 21:25:39+01 testmachine installer[597]: Notifying system of updated components 2018-11-06 21:25:39+01 testmachine installer[597]: 2018-11-06 21:25:39+01 testmachine installer[597]: **** Summary Information **** 2018-11-06 21:25:39+01 testmachine installer[597]: Operation Elapsed time 2018-11-06 21:25:39+01 testmachine installer[597]: ----------------------------- 2018-11-06 21:25:39+01 testmachine installer[597]: zero 0.00 seconds 2018-11-06 21:25:39+01 testmachine installer[597]: disk 0.02 seconds 2018-11-06 21:25:39+01 testmachine installer[597]: install 3.10 seconds 2018-11-06 21:25:39+01 testmachine installer[597]: -total- 3.12 seconds 2018-11-06 21:25:39+01 testmachine installer[597]:

Unfortunately i cannot provide my Setup-Tool here. I will build a stripped down version tomorrow (a simple LaunchDaemon) which just installs the test packages, deletes itself, reboots afterwards. Since it is pretty late now i will do that tomorrow.

gregneagle commented 6 years ago

Looks like you might be confusing Group ID (gid) with Generated UID.

vasquesbc commented 6 years ago

damn. did you ever waste hours and hours on mistaking one upper- and lower-case character?