Skip to content

install-dependencies fails with 'sudo: apt-get: command not found' on self-hosted runner #652

Description

@Jamesking56

Description

When using install-dependencies: true on a self-hosted runner (Ubuntu 24.04), the action fails with sudo: apt-get: command not found during the dependency installation step, even though apt-get works fine in other workflow steps.

Environment

  • Runner: Self-hosted Ubuntu 24.04
  • Action version: v2.1.1 (commit 4f8e94349a351df0f048634f25fec36c3c91eded)
  • Chrome version: stable

Steps to Reproduce

  1. Use a self-hosted runner with Ubuntu 24.04
  2. Configure the action with install-dependencies: true
  3. Run the workflow

Observed Behaviour

The action's internal apt-get update succeeds, but the subsequent apt-get install call fails:

[command]/usr/bin/sudo apt-get update
Hit:1 http://archive.ubuntu.com/ubuntu noble InRelease
...
[command]/usr/bin/sudo apt-get install --yes --no-install-recommends libasound2t64 ...
sudo: apt-get: command not found

Note that a direct sudo apt-get install xvfb -yqq step earlier in the same job succeeds without issue.

Expected Behaviour

The action should successfully install dependencies, or at minimum use the full path /usr/bin/apt-get to avoid PATH resolution issues under sudo.

Workaround

Set install-dependencies: false and manually install the required packages in a prior step:

- name: Install Chrome dependencies
  run: sudo apt-get install -yqq libasound2t64 libatk-bridge2.0-0t64 libatk1.0-0t64 libcairo2 libcups2t64 libdbus-1-3 libexpat1 libgbm1 libglib2.0-0t64 libnss3 libpango-1.0-0 libxcomposite1 libxdamage1 libxfixes3 libxkbcommon0 libxrandr2

- uses: browser-actions/setup-chrome@v2
  with:
    install-chromedriver: true
    install-dependencies: false

Analysis

The issue appears to be that sudo on the self-hosted runner has a secure_path that differs from the user's PATH. When the action invokes apt-get without a full path, sudo cannot resolve it. Direct workflow steps appear to handle this differently (possibly using /usr/bin/apt-get implicitly).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions