Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu 24.04: netcat is a virtual package #11028

Open
1 of 15 tasks
GregoireW opened this issue Nov 23, 2024 · 8 comments
Open
1 of 15 tasks

Ubuntu 24.04: netcat is a virtual package #11028

GregoireW opened this issue Nov 23, 2024 · 8 comments

Comments

@GregoireW
Copy link

Description

When I try to build a ubuntu 24.04 runner image from script in this repo, I got an issue with netcat:

Package netcat is a virtual package provided by:
  netcat-traditional 1.10-48
  netcat-openbsd 1.226-1ubuntu2
You should explicitly select one to install.

not sure how to resolve this cleanly.

Platforms affected

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

Runner images affected

  • Ubuntu 20.04
  • Ubuntu 22.04
  • 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

24.04

Is it regression?

was succesful on 22.04

Expected behavior

toolset should install without error

Actual behavior

fail with

Package netcat is a virtual package provided by:
  netcat-traditional 1.10-48
  netcat-openbsd 1.226-1ubuntu2
You should explicitly select one to install.

Repro steps

error is showing when install-apt-common.sh is executed

@kleverson1988
Copy link

O erro que você está vendo acontece porque o Ubuntu 24.04 não sabe qual versão do pacote netcat instalar, já que ele é um "pacote virtual", ou seja, depende de outras versões, como netcat-traditional ou netcat-openbsd. O gerenciador de pacotes precisa que você escolha uma delas.

Como resolver:

  1. Escolher uma versão do netcat para instalar:

Se você preferir o netcat-traditional, execute:
sudo apt-get install netcat-traditional

Ou, se preferir o netcat-openbsd, execute:
sudo apt-get install netcat-openbsd

  1. Alterar o script: Se o erro ocorre no script install-apt-common.sh, você pode adicionar uma linha para instalar um desses pacotes logo no começo do script. Por exemplo:

Para instalar o netcat-traditional:
sudo apt-get install -y netcat-traditional

Ou, para o netcat-openbsd:
sudo apt-get install -y netcat-openbsd

Resumo:
Você só precisa dizer explicitamente qual versão do netcat deseja instalar, e o erro será resolvido. Adicionar a linha correta no seu script vai ajudar a garantir que o pacote seja instalado sem problemas.

@RaviAkshintala
Copy link
Contributor

Hi @GregoireW Thank you for bringing this issue to our attention. We are looking into this issue and will update you on this issue after investigating

@habandy
Copy link

habandy commented Nov 26, 2024

@RaviAkshintala
Not sure if this is relevant for this topic, but i found it while looking for the same reason/problem.
https://launchpad.net/ubuntu/noble/+package/ncat

@hemanthmanga
Copy link
Contributor

Hi @GregoireW, We successfully reproduced the netcat package in Ubuntu 24. Our builds are successful.

name: Install Netcat

on:
  push

jobs:
  build:
    runs-on: ubuntu-24.04

    steps:
    - name: Checkout repository
      uses: actions/checkout@v4

    - name: Update apt-get
      run: sudo apt-get update

    - name: Install Netcat
      run: sudo apt-get install -y netcat-openbsd

    - name: Verify Netcat Installation
      run: nc -h

Kindly try building with the latest image version 20241124.1. If the issues persist, please provide us with the error logs or the build details.

@GregoireW
Copy link
Author

I'm not sure to understand what you mean.

My issue is to create a runner image, not to install netcat manually from a github action.

Today the template execute install-apt-common.sh:

"${path.root}/../scripts/build/install-apt-common.sh",

Which apt-install tools from the toolset file toolset-2404.json:

common_packages=$(get_toolset_value .apt.common_packages[])
cmd_packages=$(get_toolset_value .apt.cmd_packages[])
for package in $common_packages $cmd_packages; do
echo "Install $package"
apt-get install --no-install-recommends $package
done

and the toolset file contains the package named netcat:

"cmd_packages": [
"acl",
"aria2",
"binutils",
"bison",
"brotli",
"coreutils",
"file",
"findutils",
"flex",
"ftp",
"haveged",
"lz4",
"m4",
"mediainfo",
"netcat",

It means the setup will try to execute apt-get install --no-install-recommends netcat which fail because it is a virtual package.

Let say you want to replace 'netstat' by 'netcat-openbsd' in the toolset file then the test file will fail as it will test for a netcat-openbsd command.

$packages = (Get-ToolsetContent).apt.cmd_packages + (Get-ToolsetContent).apt.vital_packages
$testCases = $packages | ForEach-Object { @{ toolName = $_ } }
It "<toolName> is available" -TestCases $testCases {
switch ($toolName) {
"acl" { $toolName = "getfacl"; break }
"aria2" { $toolName = "aria2c"; break }
"p7zip-full" { $toolName = "p7zip"; break }
"subversion" { $toolName = "svn"; break }
"sphinxsearch" { $toolName = "searchd"; break }
"binutils" { $toolName = "strings"; break }
"coreutils" { $toolName = "tr"; break }
"net-tools" { $toolName = "netstat"; break }
"mercurial" { $toolName = "hg"; break }
"findutils" { $toolName = "find"; break }
}
(Get-Command -Name $toolName).CommandType | Should -BeExactly "Application"

@hemanthmanga
Copy link
Contributor

Hi @GregoireW, The install-apt-common.sh script was executed successfully, and we did not encounter any issues with Netcat. For reference, please find the build log snippet below.

image

@habandy
Copy link

habandy commented Nov 28, 2024

Hi @GregoireW, The install-apt-common.sh script was executed successfully, and we did not encounter any issues with Netcat. For reference, please find the build log snippet below.

But your screenshot shows exactly the problem. Lines 2494-2498
I've forgot to mention that i've have the exact same problem as @GregoireW
In my scenario the build fails because Return Code 1 is given with that error and we want our build to fail if there is a other Return Code as 0.

@GregoireW
Copy link
Author

I "set -e" to prevent not noticed error to sneak to production. in your screenshot, you have the issue, but you don't stop at the error and continue. I'm not clear why it is ok as the folowing test should have broken your test. (netcat is not installed)

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

No branches or pull requests

5 participants