Bug 616452 - Anaconda doesn't understand "404 Not Found" anymore ?
Anaconda doesn't understand "404 Not Found" anymore ?
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: anaconda (Show other bugs)
6.0
All Linux
low Severity medium
: rc
: ---
Assigned To: Anaconda Maintenance Team
Release Test Team
: RHELNAK
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-07-20 09:56 EDT by Patrik Martinsson
Modified: 2010-07-22 11:01 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-07-22 11:01:44 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Patrik Martinsson 2010-07-20 09:56:29 EDT
Description of problem:

When we pxeboot our computers we use the ks=http://foo.bar/install.php?hostname=CHANGEME parameter to tell anaconda what kind of kickstart file it should use (depending on what CHANGEME is set to). So this php script return's a "404 Not found" if CHANGEME isn't a correct hostname, and anaconda would then ask you after a correct URL to the kickstart file, then you change the "CHANGEME"-param to a hostname and the php script would return a generated kickstart file for that specific host, which is really, really neat. We have been using this method for a couple of years now and everything has worked really well, until now. 

For some reason anaconda in rhel6 (13.42) is not asking for a correct path to a kickstartfile, it just says 
INFO loader : file location: http://foo.bar/install.php&hostname=CHANGEME
INFO transferring : http://foo.bar/install.php&hostname=CHANGEME
INFO loader : setting up kickstart

Anaconda hasn't downloaded a correct kickstart file (however it has been served with a header stating, 404 Not Found, so i would presume it should ask me for an correct address) and you will enter the installation as a regular user. (select lang, disk and so on.) 

---
This is how it looks on an older version (11.4.1.62) 
INFO loader : file location: http://foo.bar/install.php&hostname=CHANGEME
INFO transferring : http://foo.bar/install.php&hostname=CHANGEME
INFO failed to receive :  http://foo.bar/install.php&hostname=CHANGEME

Here anaconda clearly states that it has failed to receive a kickstart-file (because we sent a 404 not found) and ask's me for the correct location of the kicstartfile. (which would be for example. http://foo.bar/install.php&hostname=laptop001) and this is the preferred behavior. 


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

How reproducible:
Always. 


Steps to Reproduce:
1.Enter ks=http://validadress/file_that_doesnt_exist
2.
3.
  
Actual results:
Anaconda not asking me for a correct url because it thinks that it has transferred a kickstart-file.

Expected results:
Anaconda asking me for a correct url to a kickstart-file.

Additional info:
If you enter ks=http//invalidadress you will be prompted for a correct url to your kickstart-file. (Here output is as expected, couldn't resolve host name, and failed to retrieve foo)

Best Regards, 
Patrik Martinsson, 
Sweden, SMHI.
Comment 1 Patrik Martinsson 2010-07-20 10:02:04 EDT
And yes, if i pass anaconda (from grub) the parameter, ks=http://foo.bar/install.php&hostname=laptop001 (a correct host) the kickstart gets generated and anaconda retrieves it as expected.
Comment 3 RHEL Product and Program Management 2010-07-20 10:17:58 EDT
This issue has been proposed when we are only considering blocker
issues in the current Red Hat Enterprise Linux release.

** If you would still like this issue considered for the current
release, ask your support representative to file as a blocker on
your behalf. Otherwise ask that it be considered for the next
Red Hat Enterprise Linux release. **
Comment 4 Chris Lumens 2010-07-20 10:33:46 EDT
I just did a quick test passing a URL to a valid host but invalid file, and got a dialog indicating "Error downloading kickstart file", and an entry offering me the ability to modify the URL before trying again.  Is your web server perhaps doing something strange in the value it's returning?
Comment 5 Patrik Martinsson 2010-07-20 10:59:12 EDT
Hmm, that's really weird, I've spent all afternoon here trying to get anaconda asking me for an url, and the only way i seem to make that happen is if i put in an invaldid host...

But maybe your right, it could be something fishy with the web server, however it's the same as we use when we kickstart all our machines, so older anacondas doesnt seem to have any problems with it. 

Can i turn on more debugging from anaconda ? 
This is what my webserver says, 

New anaconda doesn't work as expected.  
[20/Jul/2010:14:52:25 +0000] "GET /autoks/install.php?hostname=CHANGEME HTTP/1.1" 404 -

Old anacond, works as expected.
[20/Jul/2010:14:52:55 +0000] "GET /autoks/install.php?hostname=CHANGEME HTTP/1.0" 404 -

1.1 / 1.0 is the only thing that is different, i wonder if that has something to do with it...

Thanks for tip Chris. 

/Patrik
Comment 6 Chris Lumens 2010-07-20 11:20:58 EDT
The libcurl documentation is frustratingly vague here.  Check out http://curl.haxx.se/libcurl/c/curl_easy_setopt.html and search for CURLOPT_FAILONERROR.  We set that to 1, which even though it's documented as failing silently, causes the download to return an error code we can catch.  It does state this method is not fail-proof, and makes me wonder if maybe you're falling into the special case here.
Comment 7 Patrik Martinsson 2010-07-21 07:59:36 EDT
Hello again Chris, 

I followed up on your last suggestion and made a small curl example just to see whether I was able to catch the error or not, see the example, (I'm not a programmer in any way, so go easy on me here if I'm not thinking right),

-- 
// gcc curl.c -o curl -lcurl 

#include <stdio.h>
#include <curl/curl.h>
 
int main(void)
{
  CURL *curl;
  CURLcode res;
 
  curl = curl_easy_init();
  if(curl) {
    curl_easy_setopt(curl, CURLOPT_FAILONERROR, "1");
    curl_easy_setopt(curl, CURLOPT_URL, "http://foo.bar/autoks/file_not_exist");
    res = curl_easy_perform(curl);

    if (res != 0){
      printf("\n=> %s\n\n", curl_easy_strerror(res));
    }

    /* always cleanup */ 
    curl_easy_cleanup(curl);
  }
}
-- 

Now, if I run this program from the shell during the anaconda setup (pressing alt+F2) i get the message "HTTP response code said error", so I don't think it has to do with libcurl not throwing an error. (But again, correct me if I'm missing something). 

I find this whole situation very mysterious. 

Hmm, i asked in an earlier post (maybe you missed it) but can i somehow increase the debugging in anaconda ? I have some experience with gdb and general understanding when it comes to programming so with some guidance maybe we could come to some conclusions. 

/Patrik
Comment 8 Patrik Martinsson 2010-07-22 04:51:53 EDT
We can close this bug now, in the latest release of rhel 6 beta 2 (came out yesterday) this issue seems to be fixed, anaconda version is 13.21.56. 

Thanks for a great job guys !

Ps.
In the debuginfo tty during the install, i can now see "ERROR : Error downloading http://foo.bar/file : HTTP response code said error", which is the libcurl error message that we earlier talked about if I'm not mistaken
Comment 9 Chris Lumens 2010-07-22 11:01:44 EDT
Huh, I don't see anything in the changelog that would explain why this would now be working.  There's a couple libcurl-related changes but they're for things like following redirects and handling resolver errors better.  Perhaps something's changed in libcurl itself.  Anyway, glad to hear this is now working.

Note You need to log in before you can comment on or make changes to this bug.