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

install.sh script fails on Amazon Linux 2023 #7352

Closed
alxgrk opened this issue May 10, 2023 · 5 comments · Fixed by #7354
Closed

install.sh script fails on Amazon Linux 2023 #7352

alxgrk opened this issue May 10, 2023 · 5 comments · Fixed by #7354
Assignees

Comments

@alxgrk
Copy link

alxgrk commented May 10, 2023

Bug Report

Describe the bug
When running the install.sh script on Amazon Linux 2023, the fluent-bit package can not be installed.
It tries to fetch the data from e.g. https://packages.fluentbit.io/amazonlinux/2023.0.20230503/repodata/repomd.xml, which fails with 404.

To Reproduce
Run curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh on an AL2023 EC2 instance.
Output is:

[ec2-user@ip-0-0-0-0 ~]$ curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3991  100  3991    0     0  79973      0 --:--:-- --:--:-- --:--:-- 81448
================================
 Fluent Bit Installation Script
================================
This script requires superuser access to install packages.
You will be prompted for your password by sudo.
[fluent-bit]
name = Fluent Bit
# Legacy server style
baseurl = https://packages.fluentbit.io/amazonlinux/$releasever/
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.fluentbit.io/fluentbit.key
enabled=1
Datadog, Inc.                                                                                    8.1 kB/s | 801  B     00:00
Fluent Bit                                                                                       273  B/s | 155  B     00:00
Errors during downloading metadata for repository 'fluent-bit':
  - Status code: 404 for https://packages.fluentbit.io/amazonlinux/2023.0.20230503/repodata/repomd.xml (IP: 104.21.17.84)
Error: Failed to download metadata for repo 'fluent-bit': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
Ignoring repositories: fluent-bit
No match for argument: fluent-bit
Error: Unable to find a match: fluent-bit

Expected behavior
It should install the fluent-bit package.

Your Environment

  • Server type and version: EC2 instance
  • Operating System and version: Amazon Linux 2023 AMI

Additional context
It looks like the $releasever variable used in the /etc/yum.repos.d/fluent-bit.repo file is not resolved to an expected value. It should probably be 2023, but is 2023.0.20230503 in my case.
The following command confirms that:

[ec2-user@ip-0-0-0-0 ~]$ python3 -c 'import dnf, json; db = dnf.dnf.Base(); print(json.dumps(db.conf.substitutions, indent=2))'
{
  "arch": "x86_64",
  "basearch": "x86_64",
  "releasever": "2023.0.20230503"
}
@patrick-stephens
Copy link
Contributor

Yeah AL2023 change their build ID quite often and it's a pain for this reason. You're right, the releasever really should not change like that - I was hoping once it was GA it would settle down but alas no.

@patrick-stephens
Copy link
Contributor

There is a delightful workaround I put in place for the automated tests:

UPDATED_FLUENT_BIT_INSTALL_COMMAND_PREFIX="sed -i 's|\$releasever/|2023/|g' /etc/yum.repos.d/fluent-bit.repo;${FLUENT_BIT_INSTALL_COMMAND_PREFIX:-}"

UPDATED_FLUENT_BIT_INSTALL_COMMAND_PREFIX="sed -i 's|\$releasever/|2023/|g' /etc/yum.repos.d/fluent-bit.repo;"

@patrick-stephens
Copy link
Contributor

patrick-stephens commented May 10, 2023

The server actually has some symlinks to cope with it for AL2022/2023 previously released versions but those need to be continually updated so baking it into the install script would be better, if frustrating to have to do.

https://github.com/fluent/fluent-bit-infra/blob/451cc68383c627c017dd73ed72b6bfefa27e26d4/terraform/provision/package-server-provision.sh.tftpl#L110-L112

@patrick-stephens
Copy link
Contributor

@alxgrk hopefully this should sort it if you can verify: https://raw.githubusercontent.com/fluent/fluent-bit/1ede4c1b43d0c711c716f093c407a83dc6333612/install.sh

I've tested on containers locally but be good to verify on a VM if you have one to hand.

@alxgrk
Copy link
Author

alxgrk commented May 10, 2023

@patrick-stephens can confirm, using the URL you provided works like expected. Thanks for the quick reaction 👍

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

Successfully merging a pull request may close this issue.

2 participants