kyleneideck / BackgroundMusic

Background Music, a macOS audio utility: automatically pause your music, set individual apps' volumes and record system audio.
GNU General Public License v2.0
16.25k stars 676 forks source link

Install fails on macOS 14 #705

Open fatso83 opened 11 months ago

fatso83 commented 11 months ago

Description of the bug The installer fails no matter if using Homebrew or the standalone package.

Steps to reproduce

Steps to reproduce the bug. This usually doesn't need to be super detailed.

  1. brew install --cask background-music
  2. See error below:
    
    ==> Installing Cask background-music
    ==> Running installer for background-music with sudo; the password may be necessary.
    installer: Package name is Background Music 0.4.0
    installer: Installing at base path /
    installer: The install failed. (Installereren fant en ukjent feil som gjorde at installeringen mislyktes. Be om assistanse fra programvareprodusenten. Det oppsto en feil under utføring av prosedyrer fra pakken «BackgroundMusic-0.4.0.pkg».)
    ==> Purging files for version 0.4.0 of Cask background-music
    Error: Failure while executing; `/usr/bin/sudo -u root -E LOGNAME=carlerik USER=carlerik USERNAME=carlerik -- /usr/sbin/installer -pkg /opt/homebrew/Caskroom/background-music/0.4.0/BackgroundMusic-0.4.0.pkg -target /` exited with 1. Here's the output:
    installer: Package name is Background Music 0.4.0
    installer: Installing at base path /
    installer: The install failed. (Installereren fant en ukjent feil som gjorde at installeringen mislyktes. Be om assistanse fra programvareprodusenten. Det oppsto en feil under utføring av prosedyrer fra pakken «BackgroundMusic-0.4.0.pkg».)

**Versions**
> Please complete the following information.
 - Background Music: "0.4.0"
 - macOS: 14.1.2

❯ npx envinfo --system

System: OS: macOS 14.1.2 CPU: (12) arm64 Apple M2 Max Memory: 9.94 GB / 64.00 GB Shell: 5.2.21 - /opt/homebrew/bin/bash



**Hardware**
See above
kyleneideck commented 11 months ago

I just tried brew install --cask background-music in a macOS 14.2 VM and it worked for me. Do you get any useful info in /var/log/install.log? After the installer fails, does it leave files/dirs at /Library/Audio/Plug-Ins/HAL/Background Music Device.driver, /Applications/Background Music.app, /usr/local/libexec/BGMXPCHelper.xpc or /Library/LaunchDaemons/com.bearisdriving.BGM.XPCHelper.plist?

fatso83 commented 11 months ago
`/var/log/install.log` ``` ❯ cat /var/log/install.log 2023-12-18 10:07:22+01 MacBook-Pro installer[76674]: Architecture Translation: Distribution failed architecture check and is about to be re-executed as Intel. 2023-12-18 10:07:22+01 MacBook-Pro installer[76674]: Architecture Translation: Process is about to get executed as Intel. 2023-12-18 10:07:22+01 MacBook-Pro installer[76674]: Product archive /opt/homebrew/Caskroom/background-music/0.4.0/BackgroundMusic-0.4.0.pkg trustLevel=350 2023-12-18 10:07:22+01 MacBook-Pro installer[76674]: External component packages (1) trustLevel=350 2023-12-18 10:07:22+01 MacBook-Pro installer[76674]: -[IFDInstallController(Private) _buildInstallPlanReturningError:]: location = file://localhost 2023-12-18 10:07:22+01 MacBook-Pro installer[76674]: -[IFDInstallController(Private) _buildInstallPlanReturningError:]: file://localhost/opt/homebrew/Caskroom/background-music/0.4.0/BackgroundMusic-0.4.0.pkg#Installer.pkg 2023-12-18 10:07:22+01 MacBook-Pro installer[76674]: Set authorization level to root for session 2023-12-18 10:07:22+01 MacBook-Pro installer[76674]: Authorization is being checked, waiting until authorization arrives. 2023-12-18 10:07:22+01 MacBook-Pro installer[76674]: Administrator authorization granted. 2023-12-18 10:07:22+01 MacBook-Pro installer[76674]: Packages have been authorized for installation. 2023-12-18 10:07:22+01 MacBook-Pro installer[76674]: Will use PK session 2023-12-18 10:07:22+01 MacBook-Pro installer[76674]: Using authorization level of root for IFPKInstallElement 2023-12-18 10:07:22+01 MacBook-Pro installer[76674]: Install request is requesting Rosetta translation. 2023-12-18 10:07:22+01 MacBook-Pro installer[76674]: Starting installation: 2023-12-18 10:07:22+01 MacBook-Pro installer[76674]: Configuring volume "Macintosh HD" 2023-12-18 10:07:22+01 MacBook-Pro installer[76674]: Preparing disk for local booted install. 2023-12-18 10:07:22+01 MacBook-Pro installer[76674]: Free space on "Macintosh HD": 999.68 GB (999684079616 bytes). 2023-12-18 10:07:22+01 MacBook-Pro installer[76674]: Create temporary directory "/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T//Install.76674HNrBs8" 2023-12-18 10:07:22+01 MacBook-Pro installer[76674]: IFPKInstallElement (1 packages) 2023-12-18 10:07:22+01 MacBook-Pro installer[76674]: Current Path: /usr/sbin/installer 2023-12-18 10:07:22+01 MacBook-Pro installer[76674]: Current Path: /usr/bin/sudo 2023-12-18 10:07:22+01 MacBook-Pro installd[1730]: PackageKit: Adding client PKInstallDaemonClient pid=76674, uid=0 (/usr/sbin/installer) 2023-12-18 10:07:22+01 MacBook-Pro installer[76674]: PackageKit: Enqueuing install with framework-specified quality of service (utility) 2023-12-18 10:07:22+01 MacBook-Pro installd[1730]: PackageKit: Set reponsibility for install to 654 2023-12-18 10:07:22+01 MacBook-Pro installd[1730]: PackageKit: Hosted team responsibility for install set to team:(PR7PXC66S5) 2023-12-18 10:07:22+01 MacBook-Pro installd[1730]: PackageKit: ----- Begin install ----- 2023-12-18 10:07:22+01 MacBook-Pro installd[1730]: PackageKit: request=PKInstallRequest <1 packages, destination=/> 2023-12-18 10:07:22+01 MacBook-Pro installd[1730]: PackageKit: packages=( "PKLeopardPackage " ) 2023-12-18 10:07:22+01 MacBook-Pro installd[1730]: PackageKit: Extracting file:///opt/homebrew/Caskroom/background-music/0.4.0/BackgroundMusic-0.4.0.pkg#Installer.pkg (destination=/Library/InstallerSandboxes/.PKInstallSandboxManager/70799313-A60B-4A3C-B06E-EDD3E76EA2E6.activeSandbox/Root, uid=0) 2023-12-18 10:07:23+01 MacBook-Pro installd[1730]: PackageKit: prevent user idle system sleep 2023-12-18 10:07:23+01 MacBook-Pro installd[1730]: PackageKit: suspending backupd 2023-12-18 10:07:23+01 MacBook-Pro installd[1730]: PackageKit (package_script_service): Preparing to execute script "./preinstall" in /private/tmp/PKInstallSandbox.1cOGUH/Scripts/com.bearisdriving.BGM.UDrWUp 2023-12-18 10:07:23+01 MacBook-Pro package_script_service[27149]: PackageKit: Preparing to execute script "preinstall" in /tmp/PKInstallSandbox.1cOGUH/Scripts/com.bearisdriving.BGM.UDrWUp 2023-12-18 10:07:23+01 MacBook-Pro package_script_service[27149]: Set responsibility to pid: 654, responsible_path: /System/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal 2023-12-18 10:07:23+01 MacBook-Pro package_script_service[27149]: Hosted team responsibility for script set to team:(PR7PXC66S5) 2023-12-18 10:07:23+01 MacBook-Pro package_script_service[27149]: Preparing to execute with Rosetta Intel Translation: '/tmp/PKInstallSandbox.1cOGUH/Scripts/com.bearisdriving.BGM.UDrWUp/preinstall' 2023-12-18 10:07:23+01 MacBook-Pro package_script_service[27149]: PackageKit: Executing script "preinstall" in /tmp/PKInstallSandbox.1cOGUH/Scripts/com.bearisdriving.BGM.UDrWUp 2023-12-18 10:07:23+01 MacBook-Pro install_monitor[76676]: Temporarily excluding: /Applications, /Library, /System, /bin, /private, /sbin, /usr 2023-12-18 10:07:23+01 MacBook-Pro package_script_service[27149]: ./preinstall: sudo: unable to initialize PAM: Undefined error: 0 2023-12-18 10:07:23+01 MacBook-Pro package_script_service[27149]: ./preinstall: is not a directory. 2023-12-18 10:07:23+01 MacBook-Pro package_script_service[27149]: PackageKit: Hosted team responsible for script has been cleared. 2023-12-18 10:07:23+01 MacBook-Pro package_script_service[27149]: Responsibility set back to self. 2023-12-18 10:07:23+01 MacBook-Pro install_monitor[76676]: Re-included: /Applications, /Library, /System, /bin, /private, /sbin, /usr 2023-12-18 10:07:23+01 MacBook-Pro installd[1730]: PackageKit: releasing backupd 2023-12-18 10:07:23+01 MacBook-Pro installd[1730]: PackageKit: allow user idle system sleep 2023-12-18 10:07:23+01 MacBook-Pro installd[1730]: PackageKit: Install Failed: Error Domain=PKInstallErrorDomain Code=112 "Det oppsto en feil under utføring av prosedyrer fra pakken «BackgroundMusic-0.4.0.pkg»." UserInfo={NSFilePath=./preinstall, NSURL=file:///opt/homebrew/Caskroom/background-music/0.4.0/BackgroundMusic-0.4.0.pkg#Installer.pkg, PKInstallPackageIdentifier=com.bearisdriving.BGM, NSLocalizedDescription=Det oppsto en feil under utføring av prosedyrer fra pakken «BackgroundMusic-0.4.0.pkg».} { NSFilePath = "./preinstall"; NSLocalizedDescription = "Det oppsto en feil under utf\U00f8ring av prosedyrer fra pakken \U00abBackgroundMusic-0.4.0.pkg\U00bb."; NSURL = "file:///opt/homebrew/Caskroom/background-music/0.4.0/BackgroundMusic-0.4.0.pkg#Installer.pkg"; PKInstallPackageIdentifier = "com.bearisdriving.BGM"; } 2023-12-18 10:07:23+01 MacBook-Pro installd[1730]: PackageKit: Cleared responsibility for install from 76674. 2023-12-18 10:07:23+01 MacBook-Pro installd[1730]: PackageKit: Hosted team responsible for install has been cleared. 2023-12-18 10:07:23+01 MacBook-Pro installd[1730]: PackageKit: Running idle tasks 2023-12-18 10:07:23+01 MacBook-Pro installd[1730]: PackageKit: Removing client PKInstallDaemonClient pid=76674, uid=0 (/usr/sbin/installer) 2023-12-18 10:07:23+01 MacBook-Pro installer[76674]: install:didFailWithError:Error Domain=PKInstallErrorDomain Code=112 "Det oppsto en feil under utføring av prosedyrer fra pakken «BackgroundMusic-0.4.0.pkg»." UserInfo={NSFilePath=./preinstall, NSURL=file:///opt/homebrew/Caskroom/background-music/0.4.0/BackgroundMusic-0.4.0.pkg#Installer.pkg, PKInstallPackageIdentifier=com.bearisdriving.BGM, NSLocalizedDescription=Det oppsto en feil under utføring av prosedyrer fra pakken «BackgroundMusic-0.4.0.pkg».} 2023-12-18 10:07:23+01 MacBook-Pro installd[1730]: PackageKit: Done with sandbox removals 2023-12-18 10:07:23+01 MacBook-Pro installd[1730]: PackageKit: Sandbox /Library/InstallerSandboxes/.PKInstallSandboxManager/78AB1D3B-4566-423E-84AB-0F0B4C00250C.sandbox: relevance 0 2023-12-18 10:07:23+01 MacBook-Pro installer[76674]: Install failed: Installereren fant en ukjent feil som gjorde at installeringen mislyktes. Be om assistanse fra programvareprodusenten. ```
``` ❯ tree /Library/Audio/Plug-Ins/HAL/Background\ Music\ Device.driver/ /Library/Audio/Plug-Ins/HAL/Background Music Device.driver/ └── Contents ├── Info.plist ├── MacOS │   └── Background Music Device ├── Resources │   └── DeviceIcon.icns └── _CodeSignature └── CodeResources 5 directories, 4 files ``` tree /Library/Audio/Plug-Ins/HAL/Background\ Music\ Device.driver/
``` ❯ tree /Applications/Background\ Music.app/ /Applications/Background Music.app/ └── Contents ├── Info.plist ├── MacOS │   └── Background Music ├── PkgInfo ├── Resources │   ├── AppIcon.icns │   ├── Assets.car │   ├── BGMApp.sdef │   ├── Base.lproj │   │   └── MainMenu.nib │   │   ├── keyedobjects-101300.nib │   │   └── keyedobjects.nib │   ├── GooglePlayMusicDesktopPlayer.js │   ├── LICENSE │   ├── _uninstall-non-interactive.sh │   └── uninstall.sh └── _CodeSignature └── CodeResources 7 directories, 13 files ``` tree /Applications/Background\ Music.app/

Files not present

❯ ls -l /usr/local/libexec/BGMXPCHelpe*
ls: /usr/local/libexec/BGMXPCHelpe*: No such file or directory

❯ ls -l /Library/LaunchDaemons/com.bearisdriving.BGM.XPCHelper.plist
ls: /Library/LaunchDaemons/com.bearisdriving.BGM.XPCHelper.plist: No such file or directory
Ateeq72 commented 8 months ago

Same issue with macOS 14.4 as well.

$ brew install --cask background-music
==> Downloading https://raw.githubusercontent.com/Homebrew/homebrew-cask/e7eff192e3592cd3985c4caf2c3018a94c0d0ef9/Casks/b/background-music.rb
Already downloaded: /Users/ateeq-ahmed/Library/Caches/Homebrew/downloads/35046a6886424909ded19a71b6d131fd1e3e57d70025d7e9640e40d8e4fa0118--background-music.rb
Warning: Cannot verify integrity of '35046a6886424909ded19a71b6d131fd1e3e57d70025d7e9640e40d8e4fa0118--background-music.rb'.
No checksum was provided.
For your reference, the checksum is:
  sha256 "1421091f4b79378b83a6019f773b31551f79b6d3d73ef7b0030ba90f32982f5a"
==> Downloading https://github.com/kyleneideck/BackgroundMusic/releases/download/v0.4.0/BackgroundMusic-0.4.0.pkg
Already downloaded: /Users/ateeq-ahmed/Library/Caches/Homebrew/downloads/435510f1a16f3dbd5aa66794c4fd9959b36f716ac52b92179b2cbe13137112c0--BackgroundMusic-0.4.0.pkg
==> Installing Cask background-music
==> Running installer for background-music with sudo; the password may be necessary.
installer: Package name is Background Music 0.4.0
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 “BackgroundMusic-0.4.0.pkg”.)
==> Purging files for version 0.4.0 of Cask background-music
Error: Failure while executing; `/usr/bin/sudo -u root -E LOGNAME=ateeq-ahmed USER=ateeq-ahmed USERNAME=ateeq-ahmed -- /usr/sbin/installer -pkg /opt/homebrew/Caskroom/background-music/0.4.0/BackgroundMusic-0.4.0.pkg -target /` exited with 1. Here's the output:
installer: Package name is Background Music 0.4.0
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 “BackgroundMusic-0.4.0.pkg”.)
$npx envinfo --system
npx: installed 1 in 1.028s

  System:
    OS: macOS 14.4
    CPU: (11) x64 Apple M3 Pro
    Memory: 46.77 MB / 18.00 GB
    Shell: 5.9 - /bin/zsh
$ tree /Applications/Background\ Music.app/
/Applications/Background Music.app/
└── Contents
    ├── Info.plist
    ├── MacOS
    │   └── Background Music
    ├── PkgInfo
    ├── Resources
    │   ├── AppIcon.icns
    │   ├── Assets.car
    │   ├── BGMApp.sdef
    │   ├── Base.lproj
    │   │   └── MainMenu.nib
    │   │       ├── keyedobjects-101300.nib
    │   │       └── keyedobjects.nib
    │   ├── GooglePlayMusicDesktopPlayer.js
    │   ├── LICENSE
    │   ├── _uninstall-non-interactive.sh
    │   └── uninstall.sh
    └── _CodeSignature
        └── CodeResources

install.log

gchilds commented 8 months ago

launchctl kickstart isn't working on 14.4, killall -9 coreaudiod does however

palmerj commented 7 months ago

On 14.4 I also get this error after running brew install --cask background-music

❯ brew install --cask background-music
==> Downloading https://raw.githubusercontent.com/Homebrew/homebrew-cask/61b6410596504e3be069f74209268eee3d6419d4/Casks/b/background-music.rb
Already downloaded: /Users/jpalmer/Library/Caches/Homebrew/downloads/5d7638309859535a3fb21772b4ac087254559ed7c18cb13b1836a39081137d0d--background-music.rb
==> Downloading https://github.com/kyleneideck/BackgroundMusic/releases/download/v0.4.0/BackgroundMusic-0.4.0.pkg
Already downloaded: /Users/jpalmer/Library/Caches/Homebrew/downloads/435510f1a16f3dbd5aa66794c4fd9959b36f716ac52b92179b2cbe13137112c0--BackgroundMusic-0.4.0.pkg
==> Installing Cask background-music
==> Running installer for background-music with sudo; the password may be necessary.
installer: Package name is Background Music 0.4.0
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 “BackgroundMusic-0.4.0.pkg”.)
==> Purging files for version 0.4.0 of Cask background-music
Error: Failure while executing; `/usr/bin/sudo -u root -E LOGNAME=jpalmer USER=jpalmer USERNAME=jpalmer -- /usr/sbin/installer -pkg /opt/homebrew/Caskroom/background-music/0.4.0/BackgroundMusic-0.4.0.pkg -target /` exited with 1. Here's the output:
installer: Package name is Background Music 0.4.0
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 “BackgroundMusic-0.4.0.pkg”.)
(base)

However all the files seems to be installed and after running sudo killall coreaudiod I could start Background Music.app

M4P2913 commented 7 months ago

same issue here, can't install via .pkg on MacBook m2 runs on Sonoma 14.4

gchilds commented 7 months ago

And apple even documented this macOS 14.4 change and offered the same work around. I only just stumbled upon this.

image
kyleneideck commented 6 months ago

Thanks everyone. I've updated the installer to use sudo killall coreaudiod. (As far as I can tell, it doesn't need to be killall -9.)

@fatso83 From your install.log (thanks for that), I don't think this issue will be fixed for you yet, unfortunately.

2023-12-18 10:07:23+01 MacBook-Pro package_script_service[27149]: ./preinstall: sudo: unable to initialize PAM: Undefined error: 0
2023-12-18 10:07:23+01 MacBook-Pro package_script_service[27149]: ./preinstall:  is not a directory.

I think this means, when the installer's preinstall script first called the safe_install_dir.sh script, it failed at line 152, line 157 or line 180 because sudo failed with "sudo: unable to initialize PAM: Undefined error: 0".

Is sudo working on your system? I'm guessing you would have noticed that and it's just that preinstall scripts aren't allowed to use sudo or something, but if not, https://unix.stackexchange.com/a/636983/335482 or https://gist.github.com/bulletinmybeard/fa17ad819e23f3d8629aa723982d4703 might help.

safe_install_dir.sh should only reach those lines when /usr/local/libexec doesn't exist on your system or has unsafe permissions/ownership. Do you have that directory?

The permissions/ownership check fails if /usr/local/libexec, /usr/local or /usr isn't owned by root:wheel or is writable by group or other. You can check that manually with stat /usr /usr/local /usr/local/libexec.