Skip to content

getLinuxDistro returns unknown on EC2 runner #210

Open
@sadra-barikbin

Description

@sadra-barikbin

Hi there!

On an EC2 runner with Fedora linux distro, getLinuxDistro returns (unknown) and consequently, apt-get fails in run.

Here is the runner's (linux.8xlarge.nvidia.gpu) /etc/os-release:

NAME="Amazon Linux"
VERSION="2023"
ID="amzn"
ID_LIKE="fedora"
VERSION_ID="2023"
PLATFORM_ID="platform:al2023"
PRETTY_NAME="Amazon Linux 2023.5.20241001"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2023"
HOME_URL="https://aws.amazon.com/linux/amazon-linux-2023/"
DOCUMENTATION_URL="https://docs.aws.amazon.com/linux/"
SUPPORT_URL="https://aws.amazon.com/premiumsupport/"
BUG_REPORT_URL="https://github.com/amazonlinux/amazon-linux-2023"
VENDOR_NAME="AWS"
VENDOR_URL="https://aws.amazon.com/"
SUPPORT_END="2028-03-15"

Could we resolve this problem with this change?

export const getLinuxDistro = async () => {
  try {
    const osRelease = await fs.promises.readFile("/etc/os-release")
    let match = osRelease.toString().match(/^ID=(.*)$/m)
    if(match && match[1] == "amzn"){
      match = osRelease.toString().match(/^ID_LIKE=(.*)$/m)
    }
    return match ? match[1] : "(unknown)"
  } catch (e) {
    return "(unknown)"
  }
}

@mxschmitt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions