runner-images icon indicating copy to clipboard operation
runner-images copied to clipboard

sudo update permission failed and sudo not found in ubuntu-latest

Open gblikas opened this issue 4 months ago • 2 comments

Description

This minimal example fails for me on github actions:

name: main

on:
  push:
    branches: [ staging, main ]
  pull_request:
      branches: [ staging, main ]
  workflow_dispatch:

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest]
        include:
          - os: ubuntu-latest
            cache-path: ${{ github.workspace }}/vcpkg_cache
          - os: macos-latest
            cache-path: ${{ github.workspace }}/vcpkg_cache
    env:  
      VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
      VCPKG_DEFAULT_BINARY_CACHE: ${{ matrix.cache-path }}

    steps:
    - name: install sudo
      if: matrix.os == 'ubuntu-latest'
      run: apt update && apt install sudo

Produces the error,

Reading package lists...
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches ([13]

And, when using sudo apt update i get a "sudo not found" error.

Platforms affected

  • [ ] Azure DevOps
  • [ ] GitHub Actions - Standard Runners
  • [ ] GitHub Actions - Larger Runners

Runner images affected

  • [ ] Ubuntu 20.04
  • [X] Ubuntu 22.04
  • [X] Ubuntu 24.04
  • [ ] macOS 12
  • [ ] macOS 13
  • [ ] macOS 13 Arm64
  • [ ] macOS 14
  • [ ] macOS 14 Arm64
  • [ ] macOS 15
  • [ ] macOS 15 Arm64
  • [ ] Windows Server 2019
  • [ ] Windows Server 2022

Image version and build link

ubuntu-latest-16-cores

Ubuntu Latest (22.04) · 16-cores · 64 GB RAM · 600 GB SSD

Is it regression?

no

Expected behavior

I should be able to either (1) not use sudo and have the update work or (2) the latest image should sudo. If this is a configuration error, a more helpful error is expected.

Actual behavior

See above*

Repro steps

Run the provided minimal example

gblikas avatar Sep 26 '24 21:09 gblikas