Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS installer pkg fails with command-line install #17910

Closed
gregneagle opened this issue Mar 24, 2023 · 13 comments · Fixed by #17916
Closed

macOS installer pkg fails with command-line install #17910

gregneagle opened this issue Mar 24, 2023 · 13 comments · Fixed by #17916
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. machine macos MacOS (OSX) related

Comments

@gregneagle
Copy link

Issue Description

TL; DR: attempts to upgrade Podman by installing the current release package on macOS fail.

Attempting to install the amd64-4.4.3 package for macOS from the command line fails, when run as root, or via sudo:

(as root)
# installer -pkg podman-installer-macos-amd64-4.4.3.pkg -target /
installer: Package name is Podman 4.4.3
installer: Upgrading at base path /
installer: The upgrade failed. (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance. An error occurred while running scripts from the package “podman-installer-macos-amd64-4.4.3.pkg”.)
(via sudo)
$ sudo installer -pkg podman-installer-macos-amd64-4.4.3.pkg -target /
installer: Package name is Podman 4.4.3
installer: Upgrading at base path /
installer: The upgrade failed. (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance. An error occurred while running scripts from the package “podman-installer-macos-amd64-4.4.3.pkg”.)

The issue is in the postinstall script:

#!/bin/bash

set -e

echo "/opt/podman/bin" > /etc/paths.d/podman-pkg

ln -s /opt/podman/bin/podman-mac-helper /opt/podman/qemu/bin/podman-mac-helper
ln -s /opt/podman/bin/gvproxy /opt/podman/qemu/bin/gvproxy

/opt/podman/bin/podman-mac-helper install

Specifically, /opt/podman/bin/podman-mac-helper install. This tool fails a variety of ways. First: if an older version of Podman is already installed:

bash-3.2# /opt/podman/bin/podman-mac-helper install
Error: helper is already installed, uninstall first

Instead of failing, it should either upgrade the tool, or do the uninstall/install dance. But just failing the entire install seems like a bad idea.

I've also seen it fail with

Error: unexpected root user

Steps to reproduce the issue

Steps to reproduce the issue

  1. Install an older release of Podman
  2. Download and install the current release: sudo installer -pkg podman-installer-macos-amd64-4.4.3.pkg -target /

Describe the results you received

installer: The upgrade failed. (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance. An error occurred while running scripts from the package “podman-installer-macos-amd64-4.4.3.pkg”.)

Describe the results you expected

Successful install

podman info output

podman 4.4.3, macOS, amd64 (x86_64)

Podman in a container

No

Privileged Or Rootless

None

Upstream Latest Release

Yes

Additional environment details

Additional environment details

Additional information

Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting

@gregneagle gregneagle added the kind/bug Categorizes issue or PR as related to a bug. label Mar 24, 2023
@Luap99
Copy link
Member

Luap99 commented Mar 24, 2023

Likely caused by #17786.
IMO If the helper is already installed it should not be treated as error in the podman-mac-helper binary.

For the unexpected root user I am not so sure, the auto install was added in #16565
The mac helper is no hard requirement so I assume it would be better to add || : to make the install script ignore errors for it. This would at least restore the previous behaviour.

cc @anjannath @benoitf @n1hility

@Luap99 Luap99 added macos MacOS (OSX) related machine labels Mar 24, 2023
@benoitf
Copy link
Contributor

benoitf commented Mar 24, 2023

yes if helper is already installed it should just continue

@Luap99 Luap99 self-assigned this Mar 24, 2023
Luap99 added a commit to Luap99/libpod that referenced this issue Mar 24, 2023
Make sure we can install podman even when the podman-mac-helper install
command fails. This used to be the behavior but commit bae07b6 caused
the regression because the binary now returns 1 as exit code on errors.

Fixes containers#17910

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
@anjannath
Copy link
Member

anjannath commented Mar 24, 2023

maybe we should change it to always try to uninstall first with /opt/podman/bin/podman-mac-helper uninstall || true and then install

edit: uninstall currently doesn't return non-zero exit code on error

@Luap99
Copy link
Member

Luap99 commented Mar 24, 2023

Please see #17916 for a potential fix.

Luap99 added a commit to Luap99/libpod that referenced this issue Mar 24, 2023
Make sure we can install podman even when the podman-mac-helper install
command fails. This used to be the behavior but commit bae07b6 caused
the regression because the binary now returns 1 as exit code on errors.

[NO NEW TESTS NEEDED] I am not sure if we can test the install step in
CI.

Fixes containers#17910

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
@gregneagle
Copy link
Author

If I completely remove podman (sudo rm -rf /opt/podman) and restart, and then attempt (as root) to install podman,

bash-3.2# installer -pkg podman-installer-macos-amd64-4.4.3.pkg -target /
installer: Package name is Podman 4.4.3
installer: Installing at base path /
installer: The install failed. (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance. An error occurred while running scripts from the package “podman-installer-macos-amd64-4.4.3.pkg”.)

Snippet from /var/log/install.log:

2023-03-24 09:30:32-07 arethafranklin installd[1531]: PackageKit (package_script_service): Preparing to execute script "./postinstall" in /private/tmp/PKInstallSandbox.TXcjQ9/Scripts/com.redhat.podman.94dOQD
2023-03-24 09:30:32-07 arethafranklin package_script_service[2019]: PackageKit: Executing script "postinstall" in /tmp/PKInstallSandbox.TXcjQ9/Scripts/com.redhat.podman.94dOQD
2023-03-24 09:30:32-07 arethafranklin package_script_service[2019]: Set responsibility to pid: 2853, responsible_path: /usr/sbin/installer
2023-03-24 09:30:32-07 arethafranklin package_script_service[2019]: ./postinstall: Error: unexpected root user

This is podman-mac-helper failing with

Error: unexpected root user

Would you like this opened as a separate issue, or are you happy with just ignoring the error as you do here: #17916

@Luap99
Copy link
Member

Luap99 commented Mar 24, 2023

you need to run it with sudo AFAICT so it can get your user id from the sudo env vars

@gregneagle
Copy link
Author

That's not helpful in a mass-deployment scenario. Software is not installed interactively by users -- we have a software distribution tool that runs as root. (In our case, we use Munki, but this would be the case with any software management tool: Jamf, Addigy, VMware Workspace ONE, SimpleMDM, FileWave, etc, or even configuration management tools like Ansible, Puppet, Chef, or SaltStack)

openshift-cherrypick-robot pushed a commit to openshift-cherrypick-robot/podman that referenced this issue Mar 24, 2023
Make sure we can install podman even when the podman-mac-helper install
command fails. This used to be the behavior but commit bae07b6 caused
the regression because the binary now returns 1 as exit code on errors.

[NO NEW TESTS NEEDED] I am not sure if we can test the install step in
CI.

Fixes containers#17910

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
@benoitf
Copy link
Contributor

benoitf commented Mar 24, 2023

will it be included in an 4.4.4 or an updated 4.4.3 .PKG packages ?

@gregneagle
Copy link
Author

gregneagle commented Mar 24, 2023

I'd really hope it would be in a 4.4.4 release, or a 4.4.3.x release. It's difficult to manage/track packages that are different, but have the same version number.

@Luap99
Copy link
Member

Luap99 commented Mar 24, 2023

see the discussion on the PR, goal is to create a 4.4.4 version

gregneagle added a commit to autopkg/gregneagle-recipes that referenced this issue Mar 24, 2023
@LtCmdrScott
Copy link

Still having this issue in 4.5.1. Getting Error: unexpected root user when running command via zsh script: "sudo "/opt/podman/bin/podman-mac-helper" install || true"

@n1hility
Copy link
Member

@LtCmdrScott The install process needs to know the user to install the command with, so if it cant determine this it will fail. "Getting Error: unexpected root user" can happen if the user running the sudo command was root, and SUDO_USER wasn't defined (normally defined by sudo to the calling user [or mirrored to allow nesting]). One way this can occur is if the environment was dropped via some other nested call to other user invoking tools (e.g. su ).

@LtCmdrScott
Copy link

LtCmdrScott commented Jun 14, 2023

So I did this in my script:

LoggedInUser=$( echo "show State:/Users/ConsoleUser" | /usr/sbin/scutil | /usr/bin/awk '/Name :/ && ! /loginwindow/ { print $3 }' )
export SUDO_USER=${LoggedInUser}
sudo "/opt/podman/bin/podman-mac-helper" install

and I am still getting "Error: unexpected root user". What did I miss?

This is being run as a post install script from JAMF...When installing this software, I must install everything during installation as the users doesn't have admin rights to do this afterwards...

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 13, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. machine macos MacOS (OSX) related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants