Rebuilding World Problems

Kevin Oberman oberman at es.net
Wed Feb 13 04:11:22 UTC 2008


> Date: Tue, 12 Feb 2008 16:34:57 -0800
> From: "Chris H." <chris#@1command.com>
> Sender: owner-freebsd-stable at freebsd.org
> 
> Quoting Gavin Spomer <spomerg at cwu.EDU>:
> 
> > Please forgive me if this is not the appropriate list to post this 
> > on. If this is a topic for another, more appropriate FreeBSD list, 
> > then would someone please kindly point this guy in the right 
> > direction? :)
> >
> > I'm on the security advisory list too and got 2 emails about patches 
> > about a month ago. They came with instructions to follow for 
> > patching... excellent! Then, the last step has a link to the FreeBSD 
> > Handbook's Rebuilding world. Yes, I admit, it's taken me almost a 
> > month to get the courage (and find the time) to do this. I'm usually 
> > pretty fearless when exploring computer things. I don't really have 
> > the best way to backup either. I finally just made tarballs of 
> > important directories and scp'd them to one of my Linux machines. I 
> > finally got to the point where I booted to single user mode (first 
> > time for me) and that's where my problems began. It might be useful 
> > to note on the instructions page that you don't have to type "boot 
> > -s" to go into single user mode; it's easier to to just select option 
> > #4.
> >
> > First, let me note that step one in rebuilding world should be "cd 
> > /usr/src", not "make buildworld". I guess I was supposed to know that 
> > for some reason. Having said that, I figured I would also have to be 
> > in /usr/src for the "make installworld" step. But I couldn't do that! 
> > Why? I could cd to /usr, but not /usr/src!
> >
> > So, I decided to go ahead and try the "mergemaster -p" step. I was 
> > given an error that was something like "cannot find mergemaster". So 
> > I thought that maybe in single user mode my $PATH isn't set, so I 
> > thought about entering "/sbin/mergemaster -p", but I didn't know if 
> > that was the path or not and I chickened out. :( Maybe the fact that 
> > I hit Return to choose /bin/sh while going into single user mode 
> > instead of my preferred bash had something to do with it?
> >
> > Here's a slightly dumb question: when I get this all figured out, do 
> > I have to start all over from "make buildworld" or can I just 
> > continue with booting in single user mode and "mergemaster -p"? I'm 
> > guessing I can just continue, but I thought it was important to ask.
> >
> > Here's a little more intelligent question or two. ;) Is there a way 
> > to do this while logged in via ssh? I don't mind making the trip to 
> > our computer room so I can select #4 at the FreeBSD prompt, but it's 
> > not all that convenient. Also, how long (in general) do the steps 
> > "mergemaster -p" through the final reboot take? I am running FreeBSD 
> > on a test server, but if I were to use it for my production servers 
> > (which I am considering), the down-time of being in single user mode 
> > would be a concern.
> >
> > Thanks to everyone who takes the time to read this. :)
> 
Gavin and Chris,

It's clearly time to fix this and this is a pretty good start.

While it is not the most readable document, the procedure in
src/UPDATING is what I always recommend to people as it is going to be
rebuilding a system and the handbook is always be bit behind the times.
There are also possible differences between , for example, V6.3
vs. V7.0.

Comments are interspersed in the document (which I like).

> Greetings Gavin,
> Yes, you're quite correct on all accounts. The doc's are a bit terse
> in these areas. Which, as I read your email, reminds me why I _should_
> send-pr a patch with some additional info in these areas. I guess I'm
> like so many others - once I figured it all out, I got so involved
> with it all, I completely forgot there was some issues with the docs.
> NOTE: I'm not the author of the documentation. :)
> OK I'm going to give you a "cheat sheet" that I hope you'll find
> helpful in the future - be aware, this is NOT an excuse to ignore
> the /usr/src/UPDATING file, as THAT document will QUITE likely
> contain more timely information regarding little, but important
> changes, that can make all the difference.
> 
> That said, here goes:
> 
> --------------------------------------------------------
> * On an initial install ALWAYS buildworld BEFORE buildkernel
  And, if you think this does not apply to you, look up ALWAYS in your
favorite dictionary!
> * Unless having troubles building a kernel, it is usually
>    best to ensure /etc/make.conf is empty
Note that, once Perl is installed, you need to have the three lines it
adds in make.conf. I also believe defining KERNCONF in make.conf is a
good idea.
> * If REbuilding world/kernel it is usually a good idea to
>    perform the following:
> 
> cd /usr/obj
> chflags -R noschg *
> rm -rf *
Should never be needed on an initial install, but I don't know of a
reason not to.
> 
> (see chflags(1) for more information)
> --------------------------------------------------------
> OK here we go:
> 
> cd /usr/src/sys/<ARCH>/conf
> cp ./GENERIC ./YOUR_CHOSEN_NAME
> edit ./YOUR_CHOSEN_NAME and adjust as necessary

I would recommend adding KERNCONF=YOUR_CHOSEN_NAME to make.conf

> cd /usr/src
> make buildworld
> 
> * * * * OPTIONAL * * * *
> NOTE: SINGLE CPU:
> make -j4 buildworld
> 
> NOTE: MULTI CPU:
> make -j(6 through 10) buildworld

Where did these values come from? The only actual test results I have
seen for -j values showed that the sweet spot was nCPUs+1, but I can't
say it was definitive.
> * * * * * * * * * * * *
> 
> make buildkernel KERNCONF=YOUR_KERNEL_HERE
> make installkernel KERNCONF=YOUR_KERNEL_HERE
If you put KERNCONF into make.conf, you can simplify it to:
make kernel

> reboot (in single user mode)
> 
> fsck -p (optional, but a good idea)
A total waste of time, but I do it anyway since I am paranoid.
adjkerntz -i
This command has no impact if the hardware clock is set to UTC/GMT, but
it is often not, especially if the system is dual boot with Windows.
> mount -u /
Since the next command does this, the is no need for this, even for the
paranoid.
> mount -a -t ufs
> swapon -a (most cases; optional)
> 
> cd /usr/src
> mergemaster -p
> make installworld
> mergemaster
While not in src/UPDATING, I always urge people to use the -iU options
to save a LOT of time on future builds.
> reboot
> 
> That was simply a QUICK cheat sheet, and does not
> replace good research. But I hope it helps. :)

Thanks for posting this. Maybe it will lead to some documentation updates.
-- 
R. Kevin Oberman, Network Engineer
Energy Sciences Network (ESnet)
Ernest O. Lawrence Berkeley National Laboratory (Berkeley Lab)
E-mail: oberman at es.net			Phone: +1 510 486-8634
Key fingerprint:059B 2DDF 031C 9BA3 14A4  EADA 927D EBB3 987B 3751
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 224 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20080213/9488dab6/attachment-0001.pgp


More information about the freebsd-stable mailing list