Bug 2177219

Summary: [Regression] Proxy specified in kickstart through "url" stanza is not taken into account
Product: Red Hat Enterprise Linux 9 Reporter: Renaud Métrich <rmetrich>
Component: anacondaAssignee: Jiri Konecny <jkonecny>
Status: VERIFIED --- QA Contact: Release Test Team <release-test-team>
Severity: medium Docs Contact:
Priority: medium    
Version: 9.1CC: jkonecny, jstodola, sbarcomb, vslavik
Target Milestone: rcKeywords: TestCaseNeeded, Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: anaconda-34.25.3.4-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Renaud Métrich 2023-03-10 12:57:04 UTC
Description of problem:

Specifying a proxy to fetch Stage2 was working fine with RHEL8, e.g.:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
url --url=http://localhost/rhel91 --proxy=http://192.168.122.1:3128
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Such stanza doesn't work on RHEL9 anymore, we get the following on boot:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
[   16.790278] dracut-initqueue[1181]: ////lib/url-lib.sh@77(curl_fetch_url): curl --globoff --location --retry 3 --retry-connrefused --fail --show-error --remote-name http://localhost/rhel91/images/install.img
[   16.790596] dracut-initqueue[1182]:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
[   16.790629] dracut-initqueue[1182]:                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
[   16.790680] dracut-initqueue[1182]: curl: (7) Failed to connect to localhost port 80: Connection refused
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Here above we can see `curl` didn't execute with `--proxy` argument.
The root cause for this is `curl` command, built by `lib/url-lib.sh` snippet below, relies on "proxy=" command-line variable:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
 59 curl_args="--globoff --location --retry 3 --fail --show-error"
 60 getargbool 0 rd.noverifyssl && curl_args="$curl_args --insecure"
 61 
 62 proxy=$(getarg proxy=)
 63 [ -n "$proxy" ] && curl_args="$curl_args --proxy $proxy"
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Unfortunately, there is no such `proxy=` variable anymore, since with commit **b88e10fe3029602b369c719506588097fcbdf80b**, `parse-kickstart` now generates a `inst.proxy=` variable instead:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
--- a/dracut/parse-kickstart
+++ b/dracut/parse-kickstart
@@ -157,7 +157,7 @@ class DracutURL(Url, DracutArgsMixin):
         if self.noverifyssl:
             args.append("rd.noverifyssl")
         if self.proxy:
-            args.append("proxy=%s" % self.proxy)
+            args.append("inst.proxy=%s" % self.proxy)
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

We can confirm the generated cmdline snippet:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# cat /etc/cmdline.d/80-kickstart.conf 
inst.text
ip=enp1s0:dhcp: bootdev=enp1s0
inst.repo=http://localhost/rhel91
inst.proxy=http://192.168.122.1:3128
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

On RHEL8, it was:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# cat /etc/cmdline.d/80-kickstart.conf 
inst.text
ip=enp1s0:dhcp: bootdev=enp1s0
inst.repo=http://localhost/rhel91
proxy=http://192.168.122.1:3128
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

If new variable (`inst.proxy`) is expected, then lib/url-lib.sh must search for `inst.proxy` as well, but this file is shipped with *dracut*, not *dracut-anaconda*, so this would become inconsistent.

Version-Release number of selected component (if applicable):

RHEL9.0+ DVD

How reproducible:

Always

Steps to Reproduce:
1. Boot a VM with RHEL9 kernel and initramfs and kickstart containing a URL with a proxy

Actual results:

Can't load Stage2

Expected results:

Can load Stage2

Comment 2 Jiri Konecny 2023-05-31 16:33:15 UTC
PR: https://github.com/rhinstaller/anaconda/pull/4794

Comment 4 Jan Stodola 2023-06-09 08:57:08 UTC
Confirmed that it's now possible to use "url --url=... --proxy=..." to fetch stage2 and packages via the specified proxy.

Tested with anaconda-34.25.3.2-1.el9, no regression has been found during the testing.

Marking as Verified:Tested.

Comment 7 Jiri Konecny 2023-06-12 15:51:18 UTC
Additional fix for this issue: https://github.com/rhinstaller/anaconda/pull/4829

Comment 11 Jan Stodola 2023-06-23 08:57:31 UTC
Retested with anaconda-34.25.3.4-1.el9 to make sure that an incorrect warning about using the proxy option fixed by the PR from comment 7 is resolved.

Comment 13 Jan Stodola 2023-06-26 10:38:30 UTC
Checked that anaconda-34.25.3.4-1.el9 is in nightly compose RHEL-9.3.0-20230626.34

Moving to VERIFIED