Skip to content

Bug: Failing to install PHP 8.0 and 8.2 (potentially others) due to conflicting PPA keyring signatureΒ #953

Closed

Description

@davgothic

Describe the bug

Hi, were experiencing failures to setup PHP versions 8.0 and 8.2 using this action on self-hosted runners.

The error appears to be:

E: Conflicting values set for option Signed-By regarding source https://ppa.launchpadcontent.net/ondrej/php/ubuntu/ jammy: /usr/share/keyrings/ondrej-php-keyring.gpg != 
E: The list of sources could not be read.

Version

  • v2
  • v1

Runners

Self Hosted

Operating systems

Ubuntu 22.04

PHP versions

PHP 8.0, PHP 8.2

To Reproduce

name: Test PHP

on:
  workflow_call:

jobs:
  test:
    name: Automated Testing
    runs-on: "self-hosted"
    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      - name: Cache dependencies
        uses: actions/cache@v3
        with:
          path: ~/.composer/cache/files
          key: dependencies-${{ hashFiles('composer.json') }}

      - name: Setup PHP
        uses: shivammathur/setup-php@verbose
        with:
          php-version: 8.2
          coverage: none
        env:
          runner: self-hosted

Expected behavior

The PHP versions specified should be installed and next steps execute.

Screenshots/Logs

==> Setup PHP
ID=ubuntu
VERSION_ID=22.04
VERSION_CODENAME=jammy
deb [arch=amd64 signed-by=/usr/share/keyrings/ondrej-php-keyring.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main
Hit:1 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy InRelease
Reading package lists...
E: Conflicting values set for option Signed-By regarding source https://ppa.launchpadcontent.net/ondrej/php/ubuntu/ jammy: /usr/share/keyrings/ondrej-php-keyring.gpg != 
E: The list of sources could not be read.
Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [129 kB]
Hit:2 http://archive.ubuntu.com/ubuntu jammy InRelease
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]
Get:4 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [4387 kB]
Get:5 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [2944 kB]
Get:6 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [1245 kB]
Get:7 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [[127](https://github.com/Gear4music/backend-app-purchase-analytic-forecasting/actions/runs/15137815435/job/42553724320#step:4:128) kB]
Get:8 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [3255 kB]
Get:9 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1547 kB]
Get:10 http://archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [4540 kB]
Fetched 18.3 MB in 2s (9578 kB/s)
Reading package lists...
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
E: Conflicting values set for option Signed-By regarding source https://ppa.launchpadcontent.net/ondrej/php/ubuntu/ jammy: /usr/share/keyrings/ondrej-php-keyring.gpg != 
E: The list of sources could not be read.
E: Conflicting values set for option Signed-By regarding source https://ppa.launchpadcontent.net/ondrej/php/ubuntu/ jammy: /usr/share/keyrings/ondrej-php-keyring.gpg != 
E: The list of sources could not be read.
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
E: Conflicting values set for option Signed-By regarding source https://ppa.launchpadcontent.net/ondrej/php/ubuntu/ jammy: /usr/share/keyrings/ondrej-php-keyring.gpg != 
E: The list of sources could not be read.
βœ“ xml Enabled
βœ“ php-config Added php-config 
βœ“ PECL Added PECL 1.10.16
βœ— PHP Could not setup PHP 8.2
Error: The process '/usr/bin/bash' failed with exit code 1

Additional context

No response

Are you willing to submit a PR?

Yes

Activity

  1. shivammathur commented on May 20, 2025

    @shivammathur
    Owner

    @davgothic

    Please run the following command to check the source files you have for the PPA.

    grep -R "ondrej/php" /etc/apt/sources.list.d/

    It should show multiple files as per the error.

    Keep the file that has the signed by clause. it should be this one /etc/apt/sources.list.d/ondrej-php.list,

    Remove the rest of the list files shown by the grep commands and run apt-get update afterwards.

  2. davgothic commented on May 21, 2025

    @davgothic
    Author

    Hi @shivammathur,

    Thanks for your response. I've ran the grep and I see the following output on the PHP 8.0 and 8.2 runs:

    /etc/apt/sources.list.d/ondrej-php.list:deb [arch=amd64 signed-by=/usr/share/keyrings/ondrej-php-keyring.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main                                                                   β”‚
    /etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list:deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu/ jammy main
    /etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list:# deb-src https://ppa.launchpadcontent.net/ondrej/php/ubuntu/ jammy main 
    

    However for the other versions of PHP (e.g 7.4, 8.1, 8.3, 8.4) I see:

    /etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list:deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu/ jammy main
    /etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list:# deb-src https://ppa.launchpadcontent.net/ondrej/php/ubuntu/ jammy main 
    

    The image we run on the runner container has this in the build:

    RUN add-apt-repository ppa:ondrej/php -y

    Do you recommend we do something different?

    The /etc/apt/sources.list.d/ondrej-php.list file only appears during the shivammathur/setup-php@v2 step and only for 8.0 and 8.2, before that only the /etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list file exists.

  3. shivammathur commented on May 21, 2025

    @shivammathur
    Owner

    @davgothic

    If you use the image only for CI and not for deployment/local development, I would recommend removing this line and running CI on a image build without it.

    RUN add-apt-repository ppa:ondrej/php -y

    Otherwise, please wait till the next release, I will try to fix the conflicting files issue in that.

  4. davgothic commented on May 23, 2025

    @davgothic
    Author

    Thanks for the update. We'll look into changing our build for now and hopefully it's not too difficult to fix going forward.

  5. shivammathur commented on Jun 10, 2025

    @shivammathur
    Owner

    Fixed in 2.34.0.

  6. Sn0wCrack commented on Oct 20, 2025

    @Sn0wCrack
    Contributor

    This bug now re-occurs on Ubuntu 24.04 and above due to add-apt-repository using the new deb822 format, so the file extension is now .sources rather than .list. So the code for checking if the repository has already been added misses this.

    I believe it should be sufficient to use add-apt-repository --list to check all added repositories and simply just grep for ondrej/php or similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions