Error installing dependencies on Ubuntu self-hosted runnner
Running into a strange error when trying to install dependencies on a self-hosted Ubuntu runner.
sudo apt-get update runs normally but then it seems like apt-get cannot be found when running the install command.
Run browser-actions/setup-chrome@facf10a55b9caf92e0cc749b4f82bf8220989148
Installing dependencies
/usr/bin/sudo apt-get update
Get:1 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease [128 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [128 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease [128 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:6 http://ppa.launchpad.net/git-core/ppa/ubuntu focal InRelease [24.6 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1275 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:9 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [1270 kB]
Get:10 http://ppa.launchpad.net/git-core/ppa/ubuntu focal/main amd64 Packages [3181 B]
Get:11 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [33.5 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [4079 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [4399 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1555 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [28.6 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [55.2 kB]
Get:18 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [3928 kB]
Get:19 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [3937 kB]
Get:20 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [30.9 kB]
Fetched 32.8 MB in 3s (12.8 MB/s)
Reading package lists...
/usr/bin/sudo apt-get install --yes --no-install-recommends libglib2.0-0 libgconf-2-4 libatk1.0-0 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libgbm-dev libnss3-dev libxss-dev libasound2 xvfb fonts-liberation libu2f-udev xdg-utils
sudo: apt-get: command not found
Error: The process '/usr/bin/sudo' failed with exit code 1
Action config:
- name: Setup Chrome
uses: browser-actions/setup-chrome@facf10a55b9caf92e0cc749b4f82bf8220989148 # pin@v1
id: setup-chrome
with:
install-dependencies: true
Ubuntu version info:
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.5 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.5 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
I was able to workaround this issue by adding my own step to install deps, which should be running the exact same commands:
- name: Install Chrome dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends libglib2.0-0 libgconf-2-4 libatk1.0-0 libatk-bridge2.0-0 \
libgdk-pixbuf2.0-0 libgtk-3-0 libgbm-dev libnss3-dev libxss-dev libasound2 xvfb fonts-liberation \
libu2f-udev xdg-utils
@jasons42 Thanks for your report. Can you reproduce it on GitHub-hosted Ubuntu runner? If it occurs only in the self-hosted runner, some configuration on.it would be wrong.
Facing the same issue with self-hosted runners, though if you notice @jasons42 logs, sudo apt-get update works right before the sudo apt-get install. How apt-get get missing right after it's being called?
Have the same issue. Have a dynamic self-hosted runners, so chrome has to be installed with every run. Will you investigate it ?
Same issue here using the latest runner image - will this be investigated?
I am facing this same issue as well with self hosted runner. I have the sudo apt-get command running before too in a seperate step with no issue
The issue is the environment variables are replaced when a dictionary is passed here: https://github.com/browser-actions/actions-swing/blob/master/src/pkg/distributions.ts#L45 . The first apt-get command works, because the environment is not set.
The reason this issue happens on self-hosted runners is the settings in /etc/sudoers file is
%sudo ALL=(ALL:ALL) NOPASSWD:ALL
Defaults env_keep += "DEBIAN_FRONTEND"
sudo is executed with environment without PATH variable which leads apt-get can't be found.
In comparison with my Ubuntu 22.04 WSL instance:
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
Defaults use_pty
where sudo will use secure_path as PATH variable.