Rosetta Install Script fails

nikgio
New Contributor III

Trying to set up the automated script to install Rosetta 2 on our new M1 computers and I keep getting the 

Package Authoring Error: 002-23588: Package reference com.apple.pkg.RosettaUpdateAuto is missing installKBytes attribute

error.  It says installed successfully, but if I rerun the script it tries again with the same result.  If i try to run a policy that installs an Intel package it still errors out saying I need Rosetta.  

I've tried a couple different scripts from the simple one-liner 

usr/sbin/softwareupdate --install-rosetta --agree-to-license

to the extended version posted by Der Flounder. 

I read that you can double click the Updater from CoreServices, but I'm hoping to automate this, not retouch every computer we set up.  

I thought it might be because at one point I removed Rosetta on this one so I could use it as a test laptop.  So I completely reinstalled Big Sur on it and tried again, but I still get the error.  Any solutions?

20 REPLIES 20

jordan_m1
New Contributor III

FWIW this is our current method. I have a Policy named "0 - Install Rosetta 2" so that it runs first when a computer goes through PreStage: 

Screen Shot 2021-11-10 at 2.23.02 PM.png

 Then this from the Der Flounder script:

#!/bin/bash

# Installs Rosetta as needed on Apple Silicon Macs.

exitcode=0

# Determine OS version
# Save current IFS state

OLDIFS=$IFS

IFS='.' read osvers_major osvers_minor osvers_dot_version <<< "$(/usr/bin/sw_vers -productVersion)"

# restore IFS to previous state

IFS=$OLDIFS

# Check to see if the Mac is reporting itself as running macOS 11

if [[ ${osvers_major} -ge 11 ]]; then

  # Check to see if the Mac needs Rosetta installed by testing the processor

  processor=$(/usr/sbin/sysctl -n machdep.cpu.brand_string | grep -o "Intel")

  if [[ -n "$processor" ]]; then
    echo "$processor processor installed. No need to install Rosetta."
  else

    # Check Rosetta LaunchDaemon. If no LaunchDaemon is found,
    # perform a non-interactive install of Rosetta.

    if [[ ! -f "/Library/Apple/System/Library/LaunchDaemons/com.apple.oahd.plist" ]]; then
        /usr/sbin/softwareupdate --install-rosetta --agree-to-license

        if [[ $? -eq 0 ]]; then
            echo "Rosetta has been successfully installed."
        else
            echo "Rosetta installation failed!"
            exitcode=1
        fi

    else
        echo "Rosetta is already installed. Nothing to do."
    fi
  fi
  else
    echo "Mac is running macOS $osvers_major.$osvers_minor.$osvers_dot_version."
    echo "No need to install Rosetta on this version of macOS."
fi

exit $exitcode

 

nikgio
New Contributor III

Yes, this is one of the scripts that I tried.  I still get the error that it's missing InstallKBytes attribute.  

I've seen a couple of other people post that they've gotten this error.  Someone said that manually double clicking /System/Library/CoreServices/Rosetta 2 Updater fixes it, but for me that comes back saying an error has occurred, please try again later.

Once I get the script actually working, I'll worry about putting it at the top of the workflow.

bwoods
Valued Contributor

I'm using derflounder's script in a blank package with a preinstall script.

bwoods_0-1636657038135.png

 

pkleiber
Contributor

Hi @nikgio I am using the same script as @jordan_m1  I also get an error but with a slightly different error code.
The script works fine with me. Apps who need Rosetta2 are working.

Script result: 2021-11-09 15:10:12.289 softwareupdate[3403:24805] Package Authoring Error: 002-23768: Package reference com.apple.pkg.RosettaUpdateAuto is missing installKBytes attribute
By using the agreetolicense option, you are agreeing that you have run this tool with the license only option and have read and agreed to the terms.
If you do not agree, press CTRL-C and cancel this process immediately.

Installing: 0.0%
Installing: 0.0%
Installing: 100.0%
Installing: 100.0%
Installing: -1.0%
Installing: 2.0%
Installing: 2.0%
Installing: 100.0%
Install of Rosetta 2 finished successfully
Rosetta has been successfully installed.

I made a smart group called Macs with ARM Chip so that only those get the package installed.
I just did the command in terminal on a Macbook Pro with a M1 Pro chip. I get the exact same error when entering

/usr/sbin/softwareupdate --install-rosetta --agree-to-license

 

jordan_m1
New Contributor III

Also, I should add that my Policy just runs the script and does an inventory update. I don't have it in a package or anything. It runs at the Enrollment Complete trigger.

julienvs
New Contributor III

I'm having the same issue:

Authoring Error: 002-23768: Package reference 

 Doesn't matter how and when I invoke this, it's always the same result.

This is what I'm running:

/usr/sbin/softwareupdate --install-rosetta --agree-to-license

How did it resolve then? I am getting the same problem.

It's fine if you don't resolve it. Rosetta still installs. I run this in a policy:

/usr/sbin/softwareupdate --install-rosetta --agree-to-license
 
The policy is set to: Ongoing and Enrollment

Trigger: installrosetta

I keep it ongoing in the event that I want to install rosetta from Terminal on any enrolled Silicon machine and it usually kicks off before the enrollment is complete. 

mntbighker
New Contributor III

I'm on an M1 mini on Monterey. I have multiple Rosetta apps running. There is no "/Library/Apple/System/Library/LaunchDaemons/com.apple.oahd.plist", and there is no process with "oahd" running. There is a "/Library/Apple/usr/share/rosetta/" directory. Every Rosetta install script I have found so far looks for things that do not exist on my mini. At this point I'm not even convinced Apple will allow Rosetta to be command line installed anymore. It seems like unless someone is available to dismiss a GUI dialog box the install fails. Either way, none of the popular install scripts seem to work anymore.

rcole
Contributor

Has anyone found a solution for the error message regarding the Package Authoring Error?

 

 

Have you found any solution? Please tell me.

 

rcole
Contributor

Have you found a solution that does not produce the error message yet?

Have you found any solution ? Please help.

cnorrisAdmin
New Contributor III

I don't rely on the OS and oahd process, as Rosetta is for the Apple silicon chip. My script just looks for the processor. I haven't had any problem with it yet.:

#!/bin/bash
# Last modified August 09, 2021, Chris Norris
exec >> "/Library/Logs/Getty Script.log" 2>&1
 
date=`date "+%A %m/%d/%Y"`
echo "********** $0" `date "+%A %m/%d/%Y %H:%M"`" **********"
echo " "
 
ProcType=$(system_profiler SPHardwareDataType | grep "Processor Name" | cut -d ':' -f2)
echo "Processor: $ProcType"
ChipType=$(system_profiler SPHardwareDataType | grep "Chip" | cut -c 13-)
echo "Chip: $ChipType"
echo ""
 
if [ "$ChipType" == "Apple M1*" ]
then
echo "Chip: $ChipType"
echo "This is Apple Silicon-based. Installing Rosetta 2..."
    sudo softwareupdate --install-rosetta --agree-to-license
else
echo "Processor: $ProcType"
    echo "This system has $ProcType and does not require Rosetta"
fi
 
echo ""
echo "********** $0 Completed" `date "+%A %m/%d/%Y %H:%M"`" **********"
 
exit 0 &

tommyandersson
New Contributor

I've been having issues as well with Rosetta over the last week, it's just not getting installed properly by any jamf terminal command or script. So I made a pkg of the installer instead and deploy it at as the only pkg at enrolment to ensure it gets installed. To build the Rosetta pkg do this:

  1. Download and install Rosetta 2:
    softwareupdate --install-rosetta --agree-to-license

  2. Find path to installer:
    grep RosettaUpdateAuto.pkg /var/log/install.log

  3. Copy installer for safekeeping:
    cp /path/to/RosettaUpdateAuto.pkg /path/to/backup/dir/

Source: https://tinyapps.org/blog/202103270700_backup_rosetta2.html

 

Qwheel
Contributor II

Managed to get hold of the RosettaUpdateAuto.pkg.

Quick question...
We currently run a script to determine if a device is M1 or not - if yes, then "
softwareupdate --install-rosetta --agree-to-license". It's set to 'Enrolment'
If I were to create a policy that's set to 'Ongoing' with the RosettaUpdateAuto.pkg as a payload - if I call its trigger from inside our Enrolment script, will it be able to run the policy even though it hasn't finished running the Enrolment policies?

Via 'sudo jamf policy -trigger rosetta' (for example).

To summarise: 
In the enrollment script, I'm suggesting replace "softwareupdate --install-rosetta --agree-to-license", with "sudo jamf policy -trigger rosetta"
'rosetta' being the trigger for a policy that is 'Ongoing'

LaMantia
New Contributor III

I excluded an m1 mac from the script on enrollment so that rosetta does not get installed that way anymore. Then I ran just the basic command shown below; same error. So it's not the script. I'm on jss version 10.36.1


/usr/sbin/softwareupdate --install-rosetta

Qwheel
Contributor II

I do think Rosetta is installing via the old softwareupdate command, if it wasn't then following policies would've failed to run also (even stuff as standard as deploying basic desktop wallpapers).

I will still test deploying our own PKG though. I've seen our DEP script halt a couple of times on M1 Pro Max devices recently. I suspected it was related to our AntiVirus (because I've already recorrected the /usr/bin/python line). Just conscious that something has changed and would rather nothing was missing from Rosetta :D

LaMantia
New Contributor III

Support says that if the error is not causing an issue, it's not, then I can ignore it. So I will. 

rcole
Contributor

What I do for M1 is:

(a) Have a policy run at enrollment complete that installs Rosetta, put 00 on it to make it run first depending on your policy workflow:

The log will look like this and @nikgio provided the Files and Processes info above.

Executing Policy 00-INSTALL ROSETTA M1 [CMD LINE]
Running command /usr/sbin/softwareupdate --install-rosetta --agree-to-license...
Result of command:
2022-04-21 17:01:07.214 softwareupdate[1593:10432] Package Authoring Error: 002-66270: Package reference com.apple.pkg.RosettaUpdateAuto is missing installKBytes attribute By using the agreetolicense option, you are agreeing that you have run this tool with the license only option and have read and agreed to the terms. If you do not agree, press CTRL-C and cancel this process immediately. Installing: 0.0% Installing: 0.0% Installing: 100.0% Installing: 100.0% Installing: -1.0% Installing: 2.0% Installing: 100.0% Install of Rosetta 2 finished successfully

 

(b) I will also run a second package to deploy DEP Notify, along with the script and custom triggers.

This process has worked flawlessly on our M1 devices. I like the idea of creating a Rosetta package also, which @tommyandersson provided above. Both methods should be solid. 

 

Disregard the installKBytes attribute message. It means absently nothing in regards to the result of Rosetta being deployed.