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

ostree.fedoraproject.org/iot/ Returns Forbidden, causing 01_update_platforms_check.sh failing #68

Open
fancl20 opened this issue Jan 13, 2022 · 25 comments

Comments

@fancl20
Copy link

fancl20 commented Jan 13, 2022

I'm not sure the issue should be created here or it's a reverse proxy configuration issue. The way it checks url valid is

HTTP_STATUS=$(curl -o /dev/null -Isw '%{http_code}\n' "$UPDATE_PLATFORM_URL" || echo "Unreachable")
if ! [[ $HTTP_STATUS == 2* ]] && ! [[ $HTTP_STATUS == 3* ]]; then
    URLS_WITH_PROBLEMS+=( "$UPDATE_PLATFORM_URL" )
fi

And access https://ostree.fedoraproject.org/iot/ will return 403. Although ostree updating is still working correctly.

@Iolaum
Copy link

Iolaum commented Feb 2, 2022

When logging in to my rpi4 running fedora-iot I also noticed this issue:

Script '01_update_platforms_check.sh' FAILURE (exit code '1'). Continuing...
Boot Status is GREEN - Health Check SUCCESS
``

@tonyjames
Copy link

I am seeing this same failure. The script fails when the system is booting but runs successfully when the system is online.

$ sudo /usr/lib/greenboot/check/wanted.d/01_update_platforms_check.sh
We can connect to all update platforms
$ sudo rpm-ostree status
State: idle
Deployments:
● fedora-iot:fedora/stable/aarch64/iot
                   Version: 35.20220313.0 (2022-03-13T18:22:55Z)
                    Commit: 1571de66e257eb04bfe924611c3814ea8df847e8d5001022dc1b86de25603efb
              GPGSignature: Valid signature by 787EA6AE1147EEE56C40B30CDB4639719867C58F

@LorbusChris
Copy link
Member

Maybe this runs before network is up?
Could one of you check the journal to see where exactly the script fails? (there should be some echo output)

@LorbusChris
Copy link
Member

Also, what hardware do you run this on? Does it have a RTC?

@tonyjames
Copy link

I am currently testing this on a Raspberry Pi 4 but I also see this same failure on a Supermicro system in my environment that has an Intel processor. Here is the relevant entry from the journal:

Nov 14 19:00:30 rpi.home.arpa 01_update_platforms_check.sh[853]: There are problems connecting with the following URLs:
Nov 14 19:00:30 rpi.home.arpa 01_update_platforms_check.sh[853]: https://ostree.fedoraproject.org/iot https://ostree.fedoraproject
.org/iot/mirrorlist
Nov 14 19:00:30 rpi.home.arpa greenboot[817]: Script '01_update_platforms_check.sh' FAILURE (exit code '1'). Continuing...

I see NetworkManager entries above this failure in the journal which seems to indicate that networking is online when this script runs.

@fancl20
Copy link
Author

fancl20 commented Mar 18, 2022

I'm using it on J4125. It triggers when I ssh to the device and network is working properly.

> ssh [email protected]
Script '01_update_platforms_check.sh' FAILURE (exit code '1'). Continuing...
Boot Status is GREEN - Health Check SUCCESS
Last login: Sat Mar 19 00:32:11 2022 from 192.168.1.171

> curl https://ostree.fedoraproject.org/iot/
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access this resource.</p>
<hr>
<address>Apache Server at ostree.fedoraproject.org Port 443</address>
</body></html>

Also https://ostree.fedoraproject.org/iot/ returns 403 on any of my devices. I doubt this may be a regional issue caused by reverse proxy configuration.

@fancl20
Copy link
Author

fancl20 commented Mar 18, 2022

Found curl https://ostree.fedoraproject.org/iot will return 301, which redirects to https://ostree.fedoraproject.org/iot/ and returns 403. Change the URL to https://ostree.fedoraproject.org/iot can pass the health check. Is this the expected behaviour?

@LorbusChris
Copy link
Member

LorbusChris commented Mar 18, 2022

The URL seems to either be broken, or not correct. I'd expect it to be reachable though, but I guess rpm-ostree really only needs access to the mirrorlist to get access to the contents. @nullr0ute what say you? Should we just change the test to check availability of https://ostree.fedoraproject.org/iot/mirrorlist, or is there something to be fixed on the infra side?

In the meantime, what are the outputs of cat /etc/ostree/remotes.d/fedora-iot.conf and ostree remote show-url fedora-iot?

It triggers when I ssh to the device and network is working properly.

Note that the test isn't run when logging in, but when upgrading. It's only the MotD message previously generated by the test that is shown upon login.

@tonyjames
Copy link

$ cat /etc/ostree/remotes.d/fedora-iot.conf
[remote "fedora-iot"]
url=https://ostree.fedoraproject.org/iot
gpg-verify=true
gpgkeypath=/etc/pki/rpm-gpg/
contenturl=mirrorlist=https://ostree.fedoraproject.org/iot/mirrorlist

$ ostree remote show-url fedora-iot
https://ostree.fedoraproject.org/iot

@fancl20
Copy link
Author

fancl20 commented Mar 18, 2022

> cat /etc/ostree/remotes.d/fedora-iot.conf
[remote "fedora-iot"]
url=https://ostree.fedoraproject.org/iot/
gpg-verify=true
gpgkeypath=/etc/pki/rpm-gpg/
contenturl=mirrorlist=https://ostree.fedoraproject.org/iot/mirrorlist

> ostree remote show-url fedora-iot
https://ostree.fedoraproject.org/iot/

@LorbusChris
Copy link
Member

For comparison, in the Fedora CoreOS case, both https://ostree.fedoraproject.org and https://ostree.fedoraproject.org/mirrorlist are accessible

@sgallagher
Copy link

For comparison, in the Fedora CoreOS case, both https://ostree.fedoraproject.org and https://ostree.fedoraproject.org/mirrorlist are accessible

Actually, it seems that https://ostree.fedoraproject.org is also not accessible. FTR, I'm seeing this issue with a recently-installed RPi 400.

Change the URL to https://ostree.fedoraproject.org/iot can pass the health check.

That sounds like a hack workaround rather than a fix. It's abusing the fact that the check treats a redirect response as successful rather than that it's actually returning valid data.

@EZForever
Copy link

EZForever commented Dec 19, 2022

Can confirm the issue still exists with a fresh install of Fedora IoT 37. The connection to the update servers are 100% fine (without any reverse proxy or other stuffs) but the check always fails.

[testuser@testhost ~]$ rpm-ostree status
State: idle
Deployments:
● fedora-iot:fedora/stable/x86_64/iot
                  Version: 37.20221216.0 (2022-12-16T16:21:55Z)
               BaseCommit: d22ecec3117bf0a62dce309b62f386e1bfef6d29f1953087a187448ede2523e8
             GPGSignature: Valid signature by ACB5EE4E831C74BB7C168D27F55AD3FB5323552A
          LayeredPackages: avahi cockpit cockpit-file-sharing cockpit-machines cockpit-navigator cockpit-ostree cockpit-pcp cockpit-podman
                           nss-mdns pcp toolbox tuned

  fedora-iot:fedora/stable/x86_64/iot
                  Version: 37.20221216.0 (2022-12-16T16:21:55Z)
               BaseCommit: d22ecec3117bf0a62dce309b62f386e1bfef6d29f1953087a187448ede2523e8
             GPGSignature: Valid signature by ACB5EE4E831C74BB7C168D27F55AD3FB5323552A
          LayeredPackages: avahi cockpit cockpit-file-sharing cockpit-machines cockpit-navigator cockpit-ostree cockpit-pcp cockpit-podman
                           nss-mdns pcp toolbox tuned
[testuser@testhost ~]$ ls /etc/ostree/remotes.d/
fedora-iot.conf
[testuser@testhost ~]$ cat /etc/ostree/remotes.d/fedora-iot.conf 
[remote "fedora-iot"]
url=https://ostree.fedoraproject.org/iot/
gpg-verify=true
gpgkeypath=/etc/pki/rpm-gpg/
contenturl=mirrorlist=https://ostree.fedoraproject.org/iot/mirrorlist
[testuser@testhost ~]$ curl -I https://ostree.fedoraproject.org/iot/
HTTP/2 403 
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
referrer-policy: same-origin
content-type: text/html; charset=iso-8859-1
date: Mon, 19 Dec 2022 15:27:06 GMT
server: Apache

[testuser@testhost ~]$ curl https://ostree.fedoraproject.org/iot/config
[core]
repo_version=1
mode=archive-z2
[testuser@testhost ~]$ /usr/lib/greenboot/check/wanted.d/01_update_platforms_check.sh 
There are problems connecting with the following URLs:
https://ostree.fedoraproject.org/iot/
https://ostree.fedoraproject.org/iot/mirrorlist
[testuser@testhost ~]$ 

And, indeed, browsing to https://ostree.fedoraproject.org/iot/ gives a "Forbidden" error page.

This bug effectively makes the check bogus, and since there's no config option to skip any checks, we're now stuck with a error message that appears every time the system boots. Modify the script to check for https://ostree.fedoraproject.org/iot/config, as mentioned in #71, should fix the issue.

@natterangell
Copy link

Just chiming in to note that this is still an issue on a F37 IoT installation I deployed yesterday. I'm greeted with the same error as @Iolaum in comment #2 when connecting trough ssh.

Here's my installation as of now:

[user@localhost ~]$ sudo rpm-ostree status
State: idle
Deployments:
● fedora-iot:fedora/stable/aarch64/iot
                  Version: 37.20230302.0 (2023-03-02T19:39:29Z)
                   Commit: 624c983412c88e8d0f19f615ba87c01af47433d29cf24a2d8a0a0851ebb44d63
             GPGSignature: Valid signature by ACB5EE4E831C74BB7C168D27F55AD3FB5323552A

  fedora-iot:fedora/stable/aarch64/iot
                  Version: 37.20221118.0 (2022-11-18T17:32:21Z)
                   Commit: d06a0d1d93cd2e3ebe1b744bb16c23087a001f3116579bdb0f22dedcf755250f
             GPGSignature: Valid signature by ACB5EE4E831C74BB7C168D27F55AD3FB5323552A
[user@localhost ~]$ sudo /usr/lib/greenboot/check/wanted.d/01_update_platforms_check.sh
There are problems connecting with the following URLs:
https://ostree.fedoraproject.org/iot/
[user@localhost ~]$ 

There is something weird with the URL in the mirror repo though, https://ostree.fedoraproject.org/iot/ returns 403:

[user@localhost ~]$ curl -I https://ostree.fedoraproject.org/iot/
HTTP/2 403 
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
referrer-policy: same-origin
content-type: text/html; charset=iso-8859-1
date: Fri, 03 Mar 2023 09:32:16 GMT
server: Apache

while https://ostree.fedoraproject.org/iot/config returns 200

[user@localhost ~]$ curl -I https://ostree.fedoraproject.org/iot/config
HTTP/2 200 
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
referrer-policy: same-origin
last-modified: Thu, 02 Jun 2022 01:14:11 GMT
etag: "26-5e06cb932551d"
accept-ranges: bytes
content-length: 38
apptime: D=185
x-fedora-proxyserver: proxy02.fedoraproject.org
x-fedora-requestid: ZAG-m2C6BxwWjJWdPy6mfAAAUQQ
date: Fri, 03 Mar 2023 09:32:11 GMT
server: Apache

So, to me it seems like the recent commit based on #93 doesn't work @miabbott, unless this is unrelated to that. My bash-skills are too limited to debug this.

@miabbott
Copy link
Member

miabbott commented Mar 3, 2023

@natterangell I'm not able to reproduce this:

$ sshq -l root 192.168.122.140
Warning: Permanently added '192.168.122.140' (ED25519) to the list of known hosts.
Boot Status is GREEN - Health Check SUCCESS
Last login: Fri Mar  3 13:40:30 2023 from 192.168.122.1
[root@localhost ~]# rpm-ostree status
State: idle
Deployments:
● fedora-iot:fedora/stable/x86_64/iot
                  Version: 37.20230302.0 (2023-03-02T19:41:35Z)
               BaseCommit: b5ccde3356e41fe5969269245b7be45c43c2faf77f947249566eb73db6b26381
             GPGSignature: Valid signature by ACB5EE4E831C74BB7C168D27F55AD3FB5323552A
          LayeredPackages: audit strace

  fedora-iot:fedora/stable/x86_64/iot
                  Version: 37.20230217.0 (2023-02-17T14:30:01Z)
               BaseCommit: 8dde1800d7d3aeaf71e0737c9551e550114a20dd73046ba2e3b4d8aec3873f2e
             GPGSignature: Valid signature by ACB5EE4E831C74BB7C168D27F55AD3FB5323552A
          LayeredPackages: audit
[root@localhost ~]# rpm -q greenboot
greenboot-0.15.4-1.fc37.x86_64
[root@localhost ~]#  /usr/lib/greenboot/check/wanted.d/01_update_platforms_check.sh
We can connect to all update platforms

Is the problem repeatable in your environment?

I agree that the infrastructure of the ostree repo is setup in such a way where you can get misleading HTTP error codes if you don't hit the right endpoint. I've thought about how to make the 01_update_platforms_check.sh more robust and created a Jira card for our team to investigate (https://issues.redhat.com/browse/THEEDGE-3108); I think I'll mirror the content of that card here for greater visibility.

@miabbott
Copy link
Member

miabbott commented Mar 3, 2023

I think I'll mirror the content of that card here for greater visibility.

#98

@natterangell
Copy link

@natterangell I'm not able to reproduce this:
Is the problem repeatable in your environment?

Well, this is my first and only client on Fedora IoT. It's reproducible in the sense that it happens consistently on every reboot and after a reinstall.

@natterangell
Copy link

[user@localhost ~]$ sudo systemctl status greenboot-healthcheck.service
● greenboot-healthcheck.service - greenboot Health Checks Runner
     Loaded: loaded (/etc/systemd/system/greenboot-healthcheck.service; enabled; preset: enabled)
    Drop-In: /usr/lib/systemd/system/greenboot-healthcheck.service.d
             └─10-network-online.conf
     Active: active (exited) since Fri 2023-03-03 13:32:38 CET; 1 day 8h ago
    Process: 858 ExecStart=/usr/libexec/greenboot/greenboot check (code=exited, status=0/SUCCESS)
   Main PID: 858 (code=exited, status=0/SUCCESS)
        CPU: 1.249s

Mar 03 13:32:34 rockpro64 greenboot[858]: Script '00_required_scripts_start.sh' SUCCESS
Mar 03 13:32:35 rockpro64 01_repository_dns_check.sh[868]: All domains have resolved correctly
Mar 03 13:32:35 rockpro64 greenboot[858]: Script '01_repository_dns_check.sh' SUCCESS
Mar 03 13:32:38 rockpro64 greenboot[858]: Script '02_watchdog.sh' SUCCESS
Mar 03 13:32:38 rockpro64 greenboot[858]: Running Wanted Health Check Scripts...
Mar 03 13:32:38 rockpro64 greenboot[858]: Script '00_wanted_scripts_start.sh' SUCCESS
Mar 03 13:32:38 rockpro64 greenboot[858]: Script '01_update_platforms_check.sh' FAILURE (exit code '1'). Continuing...
Mar 03 13:32:38 rockpro64 greenboot[858]: Running Required Health Check Scripts...
Mar 03 13:32:38 rockpro64 greenboot[858]: Running Wanted Health Check Scripts...
Mar 03 13:32:38 rockpro64 systemd[1]: Finished greenboot-healthcheck.service - greenboot Health Checks Runner.
[user@localhost ~]$ 

@miabbott
Copy link
Member

miabbott commented Mar 6, 2023

I just did a fresh install of Fedora IoT 37 and I'm still not able to reproduce this issue:

$ sshq -l root 192.168.122.92
Warning: Permanently added '192.168.122.92' (ED25519) to the list of known hosts.
Boot Status is GREEN - Health Check SUCCESS
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# rpm-ostree status
State: idle
Deployments:
● fedora-iot:fedora/stable/x86_64/iot
                  Version: 37.20221116.0 (2022-11-16T17:44:48Z)
                   Commit: 2334737c8d840a9c57904ab1d2f786f05039702b1b0068608848c57f466e5dd0
             GPGSignature: Valid signature by ACB5EE4E831C74BB7C168D27F55AD3FB5323552A
[root@localhost ~]# rpm -q greenboot
greenboot-0.15.2-2.fc37.x86_64
[root@localhost ~]# /usr/lib/greenboot/check/wanted.d/01_update_platforms_check.sh
We can connect to all update platforms

Even after upgrading to the latest commit, I'm still not able to reproduce this:

$ sshq -l root 192.168.122.92
Warning: Permanently added '192.168.122.92' (ED25519) to the list of known hosts.
Boot Status is GREEN - Health Check SUCCESS
Last login: Mon Mar  6 15:36:25 2023 from 192.168.122.1
[root@localhost ~]# rpm-ostree status
State: idle
Deployments:
● fedora-iot:fedora/stable/x86_64/iot
                  Version: 37.20230303.0 (2023-03-03T21:23:06Z)
                   Commit: 03c69197e441419bb0633b464981079b1c579ff82f08e251a81aeb568d4bf117
             GPGSignature: Valid signature by ACB5EE4E831C74BB7C168D27F55AD3FB5323552A

  fedora-iot:fedora/stable/x86_64/iot
                  Version: 37.20221116.0 (2022-11-16T17:44:48Z)
                   Commit: 2334737c8d840a9c57904ab1d2f786f05039702b1b0068608848c57f466e5dd0
             GPGSignature: Valid signature by ACB5EE4E831C74BB7C168D27F55AD3FB5323552A
[root@localhost ~]# rpm -q greenboot
greenboot-0.15.4-1.fc37.x86_64
[root@localhost ~]# /usr/lib/greenboot/check/wanted.d/01_update_platforms_check.sh
We can connect to all update platforms

Could you copy the script to a different system and see if the script works there? I wonder if there is something specific to your environment.

@sgallagher
Copy link

I can confirm that this error message no longer appears as of the update I performed today.

@EZForever
Copy link

Unfortunately the update does not work for my case, at least partially. Just updated my Fedora IoT 37, and got the latest version of 01_update_platforms_check.sh (checked with GitHub master branch), but the check still fails. However the problem list is shorter:

[testuser@testhost ~]$ rpm-ostree status
State: idle
Deployments:
● fedora-iot:fedora/stable/x86_64/iot
                  Version: 37.20230405.0 (2023-04-05T14:31:37Z)
               BaseCommit: f55ecede16ee422c471fd723802313d660c1dac59721ee0712a392f0cee3c246
             GPGSignature: Valid signature by ACB5EE4E831C74BB7C168D27F55AD3FB5323552A
          LayeredPackages: avahi cockpit cockpit-file-sharing cockpit-machines cockpit-navigator cockpit-ostree cockpit-podman nss-mdns toolbox
                           tuned

  fedora-iot:fedora/stable/x86_64/iot
                  Version: 37.20230203.0 (2023-02-03T21:35:20Z)
               BaseCommit: 0e379e2798983a0ec8731611682dcf73648394535bdc57513f16ab8da1009426
             GPGSignature: Valid signature by ACB5EE4E831C74BB7C168D27F55AD3FB5323552A
          LayeredPackages: avahi cockpit cockpit-file-sharing cockpit-machines cockpit-navigator cockpit-ostree cockpit-podman nss-mdns toolbox
                           tuned
[testuser@testhost ~]$ cat /etc/ostree/remotes.d/fedora-iot.conf
[remote "fedora-iot"]
url=https://ostree.fedoraproject.org/iot/
gpg-verify=true
gpgkeypath=/etc/pki/rpm-gpg/
contenturl=mirrorlist=https://ostree.fedoraproject.org/iot/mirrorlist
[testuser@testhost ~]$ curl -I https://ostree.fedoraproject.org/iot/
HTTP/2 403 
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
referrer-policy: same-origin
content-type: text/html; charset=iso-8859-1
date: Wed, 05 Apr 2023 16:37:53 GMT
server: Apache

[testuser@testhost ~]$ curl https://ostree.fedoraproject.org/iot/config
[core]
repo_version=1
mode=archive-z2
[testuser@testhost ~]$ /usr/lib/greenboot/check/wanted.d/01_update_platforms_check.sh
There are problems connecting with the following URLs:
https://ostree.fedoraproject.org/iot/
[testuser@testhost ~]$ rpm -q greenboot
greenboot-0.15.4-1.fc37.x86_64
[testuser@testhost ~]$ 

I don't really understand what's going on right now, and I can only assume that we have different formats for fedora-iot.conf, of which mine (shown above) contains the offending URL. If this really is the case, it might explain why some people are experiencing this problem while others aren't - those who upgraded from an older version of Fedora IoT might have older versions of fedora-iot.conf that are clear of problems.

@miabbott
Copy link
Member

miabbott commented Apr 5, 2023

@EZForever I think what you are encountering is discussed in #98

@madsl
Copy link

madsl commented Sep 3, 2023

Seen from the outside, this seems like a real non-issue. What's holding this up? Tried a freshly downloaded Fedora IOT ISO this weekend, and I still get this same 403 error, both before and after rpm-ostree upgrade. It makes the whole IOT spin look like alpha software, and gives the impression that this is something Fedora wont commit to if even such a (for the outsider) basic looking bug as this can stay unfixed for the most part of a year.

I "fixed" it by editing the fedora-iot.conf file and amending the url line to end with /iot/config - if that is the correct fix, why isn't it part of greenboot already?

@adrienthebo
Copy link

I just did a fresh install of Fedora IoT 37 and I'm still not able to reproduce this issue:

$ sshq -l root 192.168.122.92
Warning: Permanently added '192.168.122.92' (ED25519) to the list of known hosts.
Boot Status is GREEN - Health Check SUCCESS
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# rpm-ostree status
State: idle
Deployments:
● fedora-iot:fedora/stable/x86_64/iot
                  Version: 37.20221116.0 (2022-11-16T17:44:48Z)
                   Commit: 2334737c8d840a9c57904ab1d2f786f05039702b1b0068608848c57f466e5dd0
             GPGSignature: Valid signature by ACB5EE4E831C74BB7C168D27F55AD3FB5323552A
[root@localhost ~]# rpm -q greenboot
greenboot-0.15.2-2.fc37.x86_64
[root@localhost ~]# /usr/lib/greenboot/check/wanted.d/01_update_platforms_check.sh
We can connect to all update platforms

Even after upgrading to the latest commit, I'm still not able to reproduce this:

$ sshq -l root 192.168.122.92
Warning: Permanently added '192.168.122.92' (ED25519) to the list of known hosts.
Boot Status is GREEN - Health Check SUCCESS
Last login: Mon Mar  6 15:36:25 2023 from 192.168.122.1
[root@localhost ~]# rpm-ostree status
State: idle
Deployments:
● fedora-iot:fedora/stable/x86_64/iot
                  Version: 37.20230303.0 (2023-03-03T21:23:06Z)
                   Commit: 03c69197e441419bb0633b464981079b1c579ff82f08e251a81aeb568d4bf117
             GPGSignature: Valid signature by ACB5EE4E831C74BB7C168D27F55AD3FB5323552A

  fedora-iot:fedora/stable/x86_64/iot
                  Version: 37.20221116.0 (2022-11-16T17:44:48Z)
                   Commit: 2334737c8d840a9c57904ab1d2f786f05039702b1b0068608848c57f466e5dd0
             GPGSignature: Valid signature by ACB5EE4E831C74BB7C168D27F55AD3FB5323552A
[root@localhost ~]# rpm -q greenboot
greenboot-0.15.4-1.fc37.x86_64
[root@localhost ~]# /usr/lib/greenboot/check/wanted.d/01_update_platforms_check.sh
We can connect to all update platforms

Could you copy the script to a different system and see if the script works there? I wonder if there is something specific to your environment.

I've isolated the reproduction case - it's specifically the trailing slash on the url that's causing this to fail. Examples follow:

Success case - no trailing slash
[remote "fedora-iot"]
url=https://ostree.fedoraproject.org/iot
gpg-verify=true
gpgkeypath=/etc/pki/rpm-gpg/
contenturl=mirrorlist=https://ostree.fedoraproject.org/iot/mirrorlist
[root@k4 ~]# bash -x /usr/lib/greenboot/check/wanted.d/01_update_platforms_check.sh
+ set -e
+ REPOS_DIRECTORY=/etc/ostree/remotes.d
+ URLS_WITH_PROBLEMS=()
+ [[ ! -d /etc/ostree/remotes.d ]]
+ get_update_platform_urls
+ mapfile -t UPDATE_PLATFORM_URLS
++ grep -P -ho 'http[s]?.*' /etc/ostree/remotes.d/fedora-iot.conf
+ [[ 2 -eq 0 ]]
+ assert_update_platforms_are_responding
+ for UPDATE_PLATFORM_URL in "${UPDATE_PLATFORM_URLS[@]}"
++ curl -o /dev/null -Isw '%{http_code}\n' https://ostree.fedoraproject.org/iot
+ HTTP_STATUS=301
+ [[ 301 == 2* ]]
+ [[ 301 == 3* ]]
+ for UPDATE_PLATFORM_URL in "${UPDATE_PLATFORM_URLS[@]}"
++ curl -o /dev/null -Isw '%{http_code}\n' https://ostree.fedoraproject.org/iot/mirrorlist
+ HTTP_STATUS=200
+ [[ 200 == 2* ]]
+ [[ 0 -eq 0 ]]
+ echo 'We can connect to all update platforms'
We can connect to all update platforms
+ exit 0
Failure case - trailing slash
[remote "fedora-iot"]
url=https://ostree.fedoraproject.org/iot/
gpg-verify=true
gpgkeypath=/etc/pki/rpm-gpg/
contenturl=mirrorlist=https://ostree.fedoraproject.org/iot/mirrorlist
[root@k4 ~]# bash -x /usr/lib/greenboot/check/wanted.d/01_update_platforms_check.sh
+ set -e
+ REPOS_DIRECTORY=/etc/ostree/remotes.d
+ URLS_WITH_PROBLEMS=()
+ [[ ! -d /etc/ostree/remotes.d ]]
+ get_update_platform_urls
+ mapfile -t UPDATE_PLATFORM_URLS
++ grep -P -ho 'http[s]?.*' /etc/ostree/remotes.d/fedora-iot.conf
+ [[ 2 -eq 0 ]]
+ assert_update_platforms_are_responding
+ for UPDATE_PLATFORM_URL in "${UPDATE_PLATFORM_URLS[@]}"
++ curl -o /dev/null -Isw '%{http_code}\n' https://ostree.fedoraproject.org/iot/
+ HTTP_STATUS=403
+ [[ 403 == 2* ]]
+ [[ 403 == 3* ]]
+ URLS_WITH_PROBLEMS+=("$UPDATE_PLATFORM_URL")
+ for UPDATE_PLATFORM_URL in "${UPDATE_PLATFORM_URLS[@]}"
++ curl -o /dev/null -Isw '%{http_code}\n' https://ostree.fedoraproject.org/iot/mirrorlist
+ HTTP_STATUS=200
+ [[ 200 == 2* ]]
+ [[ 1 -eq 0 ]]
+ echo 'There are problems connecting with the following URLs:'
There are problems connecting with the following URLs:
+ echo https://ostree.fedoraproject.org/iot/
https://ostree.fedoraproject.org/iot/
+ exit 1

This is extra tricky because there's a redirect from .../iot to .../iot/ so if you have the misfortune to check this in a browser you'll get an HTTP 304, and if you have a trailing slash you'll get an HTTP 403, so casual inspection makes this looks like both URLs fail when it's only .../iot/ that's failing.

If you're running into this, strip the trailing slash off the url in /etc/ostree/remotes.d/fedora-iot.conf and you won't need to do anything else.

If there's any way to reach the folks running ostree.fedoraproject.org, the combination of the redirection and the 403 on .../iot/ is a bit of a footgun; it would be appreciated if both of those pages could return something else likely to trigger failures.

@ackanir
Copy link

ackanir commented Oct 14, 2024

I think this is still an issue.

Using Fedora IOT and the latest package version:

$ cat /etc/os-release
NAME="Fedora Linux"
VERSION="40.20241010.0 (IoT Edition)"

$ rpm -qa | grep greenboot
greenboot-0.15.6-1.fc40.x86_64
greenboot-default-health-checks-0.15.6-1.fc40.x86_64

After a fresh install, the script initially failed:

Oct 14 12:20:05 Fedora-IOT rpm-ostree[1518]: client(id:cli dbus:1.16 unit:greenboot-healthcheck.service uid:0) added; new total=1
Oct 14 12:20:05 Fedora-IOT rpm-ostree[1518]: client(id:cli dbus:1.16 unit:greenboot-healthcheck.service uid:0) vanished; remaining=0
Oct 14 12:20:05 Fedora-IOT rpm-ostree[1518]: In idle state; will auto-exit in 64 seconds
Oct 14 12:20:05 Fedora-IOT greenboot[1450]: Script '02_watchdog.sh' SUCCESS
Oct 14 12:20:05 Fedora-IOT greenboot[1450]: Running Wanted Health Check Scripts...
Oct 14 12:20:05 Fedora-IOT 00_wanted_scripts_start.sh[1895]: Running greenboot Wanted Health Check Scripts
Oct 14 12:20:05 Fedora-IOT greenboot[1450]: Script '00_wanted_scripts_start.sh' SUCCESS
Oct 14 12:20:05 Fedora-IOT agetty[1421]: failed to open credentials directory
Oct 14 12:20:06 Fedora-IOT 01_update_platforms_check.sh[1900]: There are problems connecting with the following URLs:
Oct 14 12:20:06 Fedora-IOT 01_update_platforms_check.sh[1900]: https://ostree.fedoraproject.org/iot/ https://ostree.fedoraproject.org/iot/mir>
Oct 14 12:20:06 Fedora-IOT greenboot[1450]: Script '01_update_platforms_check.sh' FAILURE (exit code '1'). Continuing...

Running the script manually works (via SSH after boot):

sudo /usr/lib/greenboot/check/required.d/01_repository_dns_check.sh 
All domains have resolved correctly
sudo /usr/lib/greenboot/check/wanted.d/01_update_platforms_check.sh
We can connect to all update platforms

I tried editing /etc/ostree/remotes.d/fedora-iot.conf. I thought changing the trailing slash initially worked. But it seems that the script is just not reliable, and randomly works or not.

The same fresh install was previously working a few days ago. So I am not really sure what is going on.
If this issue is confirmed it would indeed require a more robust script. Taking into consideration the fedoraproject.org configuration could change and break existing installations.

I am trying to further investigate and narrow-down this issue.

Related Github issues:

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

No branches or pull requests