jedaffra
September 18th, 2002, 13:35
Hey,

I've recently upgraded to 3.1 and successfully installed *most* of the patches listed on openbsd.org

However, I was wondering what happened when I went to install some of the patches. Here's an example of what I'm talking about:


# patch -p0 < patches/003_fdalloc2.patch
Hmm... Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Apply by doing:
| cd /usr/src
| patch -p0 < 003_fdalloc2.patch
|
|And then rebuild your kernel.
|
|Index: sys/kern/kern_exec.c
|================================================= ==================
|RCS file: /cvs/src/sys/kern/kern_exec.c,v
|retrieving revision 1.66
|diff -u -r1.66 kern_exec.c
|--- sys/kern/kern_exec.c 14 Mar 2002 17:17:23 -0000 1.66
|+++ sys/kern/kern_exec.c 8 May 2002 20:18:41 -0000
--------------------------
File to patch:
No file found--skip this patch? [n] y
Skipping patch...
Hunk #1 ignored at 534.
Hunk #2 ignored at 541.
Hunk #3 ignored at 549.
3 out of 3 hunks ignored--saving rejects to sys/kern/kern_exec.c.rej
Can't create sys/kern/kern_exec.c.rej, output is in /tmp/patchrea3375: No such file or directory
done



... I'm asked for a file to patch. Being a newb/rookie I'm not sure how to satisfy the process and end up unintentionally skipping the patch.

I'm sure someone knows where I screwed up.

Thanks,

-jedaffra

elmore
September 18th, 2002, 14:36
Looks me like one of two things, either you don;t have all of the kernel source or... you weren;t in the correct directory when you trierd to apply the patch. Make sure you are in /usr/src. Also one last thing make sure that you untarred your source tree correctly.

If you prefer to use cvs rather than applying patches check out these links:

http://screamingelectron.org/phpBB2/viewtopic.php?t=81
http://screamingelectron.org/phpBB2/viewtopic.php?t=82

jedaffra
September 18th, 2002, 15:32
Looks me like one of two things, either you don;t have all of the kernel source or... you weren;t in the correct directory when you trierd to apply the patch. Make sure you are in /usr/src. Also one last thing make sure that you untarred your source tree correctly.



Maybe this can shed more light (or less).

I was installing all 14 patches that are posted on openbsd.org - 1 right after another. All of the patches installed correctly except for these:

003_fdalloc2.patch
009_ktrace.patch
014_scarg.patch

In each of these 3 cases, I was asked for a "File to patch:"
-------------------------------------------------------------------

I downloaded all patches into /usr/src/patches and installed them from /usr/src

Also, before installing the 14 patches, I downloaded the sourcefile (src.tar.gz.tgz) from the ftp site and did the following: cd /usr/src; tar -zxvf /path/to/src.tar.gz.tgz (it took a solid 5 minutes to untar!)

A thought I had: Is it necessary to re-build the kernal for the patches in question. I'm wondering this b/c I did not download and untar srcsys.tar.gz before installing these 3 "problem children"


Thanks again all,

-jedaffra

elmore
September 18th, 2002, 17:20
For sure those patches are kernel patches, you'll need to patch the kernel source and rebuild your kernel. srcsys.tar.gz in addition, you need to apply and rebuild your kernel patches before you apply and rebuild everything else.

jedaffra
September 18th, 2002, 19:42
For sure those patches are kernel patches, you'll need to patch the kernel source and rebuild your kernel. srcsys.tar.gz in addition, you need to apply and rebuild your kernel patches before you apply and rebuild everything else.

Thanks

I should have read the faq on patching openbsd before I posted :oops:

CVS looks a heck of alot easier than what I've been doing.
Live and learn

elmore
September 18th, 2002, 22:38
So did you get CVS working, I think it's by far the easiest way to patch.

jedaffra
September 18th, 2002, 23:09
So did you get CVS working, I think it's by far the easiest way to patch.


<newb>
Ahem, well...

I think yes although I don't know how to tell for sure. I'm in the "make build" process as I write, and there is alot happening on the screen (doing this via puTTY on a w2k peecee).

I do have another question. The How-to article by MiNiOn says:

Say you've got a wack of patches to install you may just want to rebuild your kernel (always the safest bet!!!), reboot it and then:

# cd /usr/src
# rm -r /usr/obj/*
# make obj && make build


I think I wronly assumed that these instructions would rebuild the kernel AND get me up to speed.


Should I have compiled the kernal (
# cd /usr/src/sys/arch/`machine`/conf
# config GENERIC
# cd ../compile/GENERIC
)
and then compiled the system using make build?

</newb>

Thanks :oops:

elmore
September 18th, 2002, 23:53
yup, rebuild the kernel first. so basically you want to:


1. Get your source from CVS.
2. Compile your kernel.
3. make build.
4. sleep easy.

You'll get it.

jedaffra
September 20th, 2002, 12:01
Is there any way to tell if I have been successfull? :roll:

frisco
September 20th, 2002, 22:33
Is there any way to tell if I have been successfull?

if you followed the steps and didnt get any errors, then you've been successful.

if you recompiled the kernel, rebooted off of the new kernel, and it works, you've been successful.

if you rebuilt and installed all your binaries, and they work, you've been successful.

you could look at the date of all your binaries (or just the ones you recompiled/installed) to verify they are new.
you could compare md5sums of these binaries to old ones to verify they are different.

but the most important thing to do is to know/understand the commands you ran when rebuilding your system and to know what code you compiled from (i.e. -stable, -current), and thus know that the binaries you have are made from the correct source and thus are Good.

by the way, if you rebuilt your entire system, the daily security checks should note some changes.

|MiNi0n|
September 21st, 2002, 09:42
Also, check your dmesg, if you've done it all correctly your kernel will reflect the fact it was rebuilt of the -stable branch:

OpenBSD 3.1-stable (GENERIC) #0: Mon Aug 12 11:41:56 EDT 2002
root@rev31:/usr/src/sys/arch/i386/compile/GENERIC