Apt-get install command fails with no output, ssh works fine

When I run the following command in my build things fail, with no output.
sudo apt-get install ruby-full

The output and exit code are:

#!/bin/bash -eo pipefail
sudo apt-get install ruby-full


Exited with code exit status 1
CircleCI received exit code 1

If I SSH into the build and run the command, there is no error and it installs fine. Why would it not work in the build but work when I SSH in? Why is there no output from the install command? My other apt-get installs work fine. I have also tried running apt-get update before the install, but the error/output are the same.

The build can be found here: https://app.circleci.com/pipelines/github/godaddy-wordpress/go/2762/workflows/464bf27f-5444-492f-8a77-280d0fa1dcc2/jobs/13931

It looks like anything after store_artifacts fails. It’s not specific to apt-get install.

Is it not possible to store the artifacts and then get the URL to use in another step after store_artifacts?
I found this article explaining it, and it mentions it has to be run after store_artifacts but the following fails when running after store_artifacts:

- run:
          name: Check Token and PR status
          command: |
            if [[ -z "${GH_ACCESS_TOKEN}" ]]; then
              echo "GH_ACCESS_TOKEN not set"
              /bin/false
            fi
            if [[ -z "${CIRCLE_PULL_REQUEST}" ]]; then
              echo "Not a pull request."
              circleci-agent step halt
              exit
            fi

CircleCI Failure and Output:

#!/bin/bash -eo pipefail
if [[ -z "${GH_ACCESS_TOKEN}" ]]; then
  echo "GH_ACCESS_TOKEN not set"
  /bin/false
fi
if [[ -z "${CIRCLE_PULL_REQUEST}" ]]; then
  echo "Not a pull request."
  circleci-agent step halt
  exit
fi


Exited with code exit status 1
CircleCI received exit code 1