LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 10-07-2003, 10:05 AM   #1
mudelf
Member
 
Registered: Sep 2003
Distribution: RedHat 8
Posts: 59

Rep: Reputation: 15
Kernel Patch will not Apply.


Am trying to patch my kernel (2.4.18-14).

I downloaded the patch file:-

patch-2.4.19 to my /usr/src/linux2.4.18-14 directory

ran:-

bunzip2 patch-2.4.19

followed by:-

patch -p1 < patch-2.4.19

The respnse is always the same:-

"Reversed (or previously applied) patch detected! Assume -R? [n]
Apply Anyway? [n]"

This is a brand new fresh instal as of this morning --- how can there be a previously applied patch ?!?!?

Any Ideas ... ?
 
Old 10-07-2003, 10:50 AM   #2
Kramer
Member
 
Registered: Aug 2003
Location: Somewhere south of sanity...
Distribution: Mandrake 9.1
Posts: 550

Rep: Reputation: 30
It looks like your using the wrong patch for your kernel. If you have 2.4.18, you need to find the patch that matches that, and not the 2.4.19
 
Old 10-07-2003, 11:34 AM   #3
mudelf
Member
 
Registered: Sep 2003
Distribution: RedHat 8
Posts: 59

Original Poster
Rep: Reputation: 15
Ok I just went to Kernel.org and downloaded the patch
2.4.18.bz2 and applied that (on a fresh kernel image reinstalled off the RH8 Disc)

I got the same message with lots of lines saying stuff like:-

Hunk #1 FAILED at 309

or

"Reversed (or previously applied) patch detected! Assume -R? [n]
Apply Anyway? [n]"

Cannot figure out what hell the trouble is here. Patching seems straitforward enough.

Evidently Extreme
 
Old 10-07-2003, 06:11 PM   #4
yapp
Member
 
Registered: Apr 2003
Location: Netherlands
Distribution: SuSE (before: Gentoo, Slackware)
Posts: 613

Rep: Reputation: 30
If you run a patch, use the option "--dry-run" first, to prevent the patch from being actually applied.

The latest stable kernel version is 2.4.22 though, I'd suggest you download it instead.
 
Old 10-07-2003, 06:17 PM   #5
yapp
Member
 
Registered: Apr 2003
Location: Netherlands
Distribution: SuSE (before: Gentoo, Slackware)
Posts: 613

Rep: Reputation: 30
Quote:
Originally posted by mudelf
"Reversed (or previously applied) patch detected! Assume -R? [n]
Apply Anyway? [n]"
'patch' tries to apply a piece of code, but the modifications already seam to be applied. Here are some parts of the manual that explain this a little further.. (because I honestly don't quite know how to explain it)

Quote:
-R or --reverse
Assume that this patch was created with the old and new files swapped. (Yes, I'm afraid that does happen occa-
sionally, human nature being what it is.) patch attempts to swap each hunk around before applying it. Rejects
come out in the swapped format. The -R option does not work with ed diff scripts because there is too little
information to reconstruct the reverse operation.

If the first hunk of a patch fails, patch reverses the hunk to see if it can be applied that way. If it can, you
are asked if you want to have the -R option set. If it can't, the patch continues to be applied normally. (Note:
this method cannot detect a reversed patch if it is a normal diff and if the first command is an append (i.e. it
should have been a delete) since appends always succeed, due to the fact that a null context matches anywhere.
Luckily, most patches add or change lines rather than delete them, so most reversed normal diffs begin with a
delete, which fails, triggering the heuristic.)
Quote:
BUGS
[...]
If you apply a patch you've already applied, patch thinks it is a reversed patch, and offers to un-apply the patch.
This could be construed as a feature.
 
Old 10-07-2003, 06:19 PM   #6
Mad Merlin
Member
 
Registered: Aug 2003
Location: Approximately here.
Distribution: Mandrake 9.1
Posts: 86

Rep: Reputation: 15
It looks like you're trying to patch a distro specific kernel with a vanilla patch, this is not a particularly good idea. The kernel you're trying to patch is somewhere in between 2.4.18 and 2.4.19, but the patch you're using applies only to 2.4.18, so you're going to have some troubles, but it is probably still possible to get the patch to merge if you really work at it, but I doubt it's worth it.

If you're looking for the 2.4.19 kernel, you can just grab the full source for 2.4.19 and compile that. Or if you really wanted to, you could get the full source for the vanilla 2.4.18 kernel and then patch it with that patch up to 2.4.19. Ideally, you'd just grab one of the newer stable kernels, such as 2.4.22, and compile that. Unless you've got a specific reason to stick with an older kernel, the newer ones are usually better.
 
Old 10-07-2003, 06:22 PM   #7
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 46
Quote:
Ok I just went to Kernel.org and downloaded the patch
2.4.18.bz2 and applied that (on a fresh kernel image reinstalled off the RH8 Disc)

I got the same message with lots of lines saying stuff like:-

Hunk #1 FAILED at 309

or

"Reversed (or previously applied) patch detected! Assume -R? [n]
Apply Anyway? [n]"

Cannot figure out what hell the trouble is here. Patching seems straitforward enough.
You are trying to patch a RedHat kernel. That will not work because RedHat has already applied their own patches which are apparently conflicting.

You'll have to start with a fresh kernel from kernel.org or use a RedHat updated kernel.
 
Old 10-08-2003, 03:01 AM   #8
mudelf
Member
 
Registered: Sep 2003
Distribution: RedHat 8
Posts: 59

Original Poster
Rep: Reputation: 15
Phew !!! Ok that clarifies LOTS of things --- thanks for answering

I am trying to patch simply so that I can understand the process and be able to do so. This is the same case for recompiling the kernel.

Is it ok to apply a vannila kernel to RedHat? I would of thought it would be but then what happens about patching after that? Once I have 'gone vanilla' ( ;-) ) do I have to stay on that road with my patches untill I recompile again?

If all the flavours of Linux are specific in some way (e.g RedHat, Debian etc.) then what is the point of a vanilla one ... ?

I guess the most sensible course of action is to upgrade using a RedHat Source RPM --- however I wanted to understand and be able to do a source recompile for the purpose of learning.

Much pondering to be done here me thinks ...
 
Old 10-08-2003, 03:24 AM   #9
yapp
Member
 
Registered: Apr 2003
Location: Netherlands
Distribution: SuSE (before: Gentoo, Slackware)
Posts: 613

Rep: Reputation: 30
Is there any information at the source cd-rom about the patches they've applied? (slackware does this for example; by providing their modifications in a patch file)

You could start with an original kernel from www.kernel.org, and apply a few patches yourself.
 
Old 10-08-2003, 03:29 AM   #10
mudelf
Member
 
Registered: Sep 2003
Distribution: RedHat 8
Posts: 59

Original Poster
Rep: Reputation: 15
Not Sure !!! Will go and look ---

The disc has the kernel source in an rpm for 2.4.18-14 but not sure about patches.

I will upgrade this time (or try to ... ) using the Redhat source RPM and then hopefully have a bash and compiling from Vanilla sources ...

am a goin in ...... end transmission .....


Thanks !!!
 
Old 10-08-2003, 06:22 AM   #11
yapp
Member
 
Registered: Apr 2003
Location: Netherlands
Distribution: SuSE (before: Gentoo, Slackware)
Posts: 613

Rep: Reputation: 30
I still would recommend compiling the 2.4.22 kernel. It has many improvements, new features and drivers.

btw, all kernels up to 2.4.20 have a ptrace exploit, you don't want to give anyone a shell on a box with an unpatched 2.4.20 kernel (but there is a patch for that too)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to apply patch? greythorne Fedora 1 03-09-2005 05:38 AM
How to apply kernel patch and customise? subaruwrx Linux - Software 7 12-30-2004 10:40 PM
Kernel: Can't apply patch 2.6.8-rc2 to a 2.6.8-rc1 thorax Linux - Software 1 07-18-2004 04:20 PM
How to Apply patch for Mass Storage device to work? (uss725-2.4.20-rc2.patch) cevjr Linux - Hardware 3 04-21-2004 12:14 AM
How To Apply Patch To Kernel WILLIAMATHOMAS Linux - Software 2 02-12-2003 01:57 PM


All times are GMT -5. The time now is 05:55 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration