<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="generator" content="Website XSL Stylesheet V2.6.0">
<link rel="home" href="../." title="Welcome to The NetBSD Project: Of course it runs NetBSD.">
<link rel="up" href="../docs/." title="NetBSD Documentation">
<link rel="previous" href="../docs/software/." title="Application Software for NetBSD">
<link rel="next" href="../docs/vmware.html" title="NetBSD Documentation: Running VMWare on NetBSD">
<link rel="first" href="../docs/Hardware/." title="Hardware Documentation">
<link rel="last" href="../docs/x/." title="NetBSD Documentation: The X Window System">
<link rel="stylesheet" href="/global.css" type="text/css">
<title>Updating a stable NetBSD release</title>
</head>
<body class="website"><div class="webpage">
<a name="docs-updating"></a><div id="top"><a href="#mainContent" class="doNotDisplay doNotPrint">Skip to main content.</a></div>
<div id="header">
<div class="topNavigation">
<span>» </span><a href="/docs/guide/en/">The Guide</a> |
<a href="http://man.NetBSD.org/">Manual pages</a> |
<a href="/mailinglists/">Mailing lists</a> and
<a href="http://mail-index.NetBSD.org/">Archives</a> |
<a href="http://cvsweb.NetBSD.org/">CVS repository</a> |
<a href="http://www.NetBSD.org/Gnats/">Report or query a bug</a> |
<a href="/docs/software/packages.html">Packages</a>
</div>
<div class="centralHeader">
<a href="/"><img src="/images/NetBSD-headerlogo.png" alt="[NetBSD Logo]" width="506" height="90"></a><div class="headerTools"><div id="headerSearch"><form method="get" action="http://www.google.com/custom">
<input class="whiteOnBlack" type="text" name="q" onfocus="if(this.value==this.defaultValue ) this.value='';" size="12" maxlength="255" value="Search"><input type="hidden" name="cof" value="L:http://www.NetBSD.org/images/NetBSD-smaller.png;LH:200;LW:200;AH:center;AWFID:4f6b0499f0f58d2c;"><input type="hidden" name="domains" value="NetBSD.org"><input type="hidden" name="sitesearch" value="www.NetBSD.org"><input type="submit" value="Search">
</form></div></div>
</div>
<div class="navBar">
<span class="doNotDisplay">Navigation:</span><a href="/">Home <span>/span></a> <a href="/about/">About <span>/span></a> <a href="/releases/">Download <span>/span></a> <a href="/docs/">Documentation <span>/span></a> <a href="/support/">Support <span>/span></a> <a href="/community/">Community <span>/span></a> <a href="/ports/">Ports <span>/span></a>
</div>
</div>
<div id="content"><div class="fullWidth"><div class="rowOfBoxes">
<h1>Updating a stable NetBSD release</h1>
<h3 class="title"><a name="top"></a></h3>
<ul>
<li><a href="#current">Tracking -current</a></li>
<li><a href="#update-src">Updating the sources</a></li>
<li><a href="#kernel">Building a new kernel</a></li>
<li><a href="#userland">Updating the userland</a></li>
<li><a href="#parts">Updating only parts of the source tree</a></li>
<li><a href="#summary">Terse summary</a></li>
</ul>
<hr>
<h3 class="title"></h3>
<h4 class="title">
<a name="current"></a>Tracking -current (<a href="#top">top</a>)
</h4>
<p>
See
<a href="current/" target="_top">this document</a>
for our documentation on how to track -current.
</p>
<h4 class="title">
<a name="update-src"></a>Updating the sources (<a href="#top">top</a>)
</h4>
<p>
If you are running a stable NetBSD release (such as
<a href="../releases/formal-3/" target="_top">NetBSD 3.0</a>),
in a production environment, you should occasionally
update your sources and rebuild the system or the kernel,
in order to incorporate any security fixes that have been
applied to the branch since its release.
</p>
<p>
You can retrieve or update the sources for your
release using
<a href="current/#using-anoncvs-over-ssh" target="_top">anoncvs over
ssh</a>
by specifying the correct branch tag. For example, to
checkout the sources for the NetBSD 3.0 release, you
could use:
</p>
<pre class="programlisting">
$ cd /usr
$ env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot co -r netbsd-3-0 -P src</pre>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
Be sure to take care in selecting the correct and desired branch tag so
you don't accidently <span class="emphasis"><em>downgrade</em></span> your source tree.
</div>
<p>To update an existing source tree:</p>
<pre class="programlisting">$ cd /usr/src
$ env CVS_RSH=ssh cvs update -dP</pre>
<h4 class="title">
<a name="kernel"></a>Building a new kernel (<a href="#top">top</a>)
</h4>
<p>
Building a new kernel pretty much follows the steps
as described in
<a href="kernel/#how_to_build_a_kernel" target="_top">this
document</a>,
but please note the differences in the syntax of the
<code class="code">build.sh</code> script. <code class="code">build.sh</code>
has changed significantly after NetBSD 1.6. (If you are not using
NetBSD > 1.6 or -current, you can
<span class="emphasis"><em>not</em></span> use
<code class="code">build.sh</code>
to build the new kernel!)
</p>
<h4 class="title">
<a name="userland"></a>Updating the userland (<a href="#top">top</a>)
</h4>
<p>
Please always refer to <code class="code">build.sh -h</code> and the
files <span class="emphasis"><em>UPDATING</em></span> and
<span class="emphasis"><em>BUILDING</em></span> for details -- it's worth
it, there are <span class="emphasis"><em>many</em></span> options that can
be set on the command line or in
<code class="filename">/etc/mk.conf</code> . In the end, it all
boils down to a single command: <code class="code">build.sh
distribution</code> (or <code class="code">build.sh -d</code> on NetBSD
1.6).
</p>
<p>
Note that this will update the
<span class="emphasis"><em>entire</em></span> userland!
</p>
<h4 class="title">
<a name="parts"></a>Updating only parts of the source tree (<a href="#top">top</a>)
</h4>
<p>
If a security advisory has been issued, and you want
to just rebuild the necessary libraries and applications,
your best bet is to follow the instructions provided in the
advisory. An example is given below:
</p>
<pre class="programlisting">
$ cd src
$ env CVS_RSH=ssh cvs update -d -P -r netbsd-3-0 gnu/dist/sendmail/sendmail
$ cd gnu/usr.sbin/sendmail
$ make USETOOLS=no cleandir dependall
$ su
# make USETOOLS=no install</pre>
<h4 class="title">
<a name="summary"></a>Terse summary (<a href="#top">top</a>)
</h4>
<div class="itemizedlist"><ul type="disc">
<li>
<p>Update the sources:</p>
<pre class="programlisting">
$ cd /usr/src
$ env CVS_RSH=ssh cvs update -dP</pre>
</li>
<li>
<p>Build a new kernel:</p>
<pre class="programlisting">
$ cd /usr/src
$ ./build.sh kernel=<KERNEL>
$ su
# mv /netbsd /netbsd.old
# mv /usr/src/sys/arch/<ARCH>/compile/<KERNEL>/netbsd /</pre>
</li>
<li>
<p>Update the userland:</p>
<pre class="programlisting">
$ cd /usr/src
$ ./build.sh -h
$ su
# ./build.sh <optional arguments> distribution</pre>
</li>
</ul></div>
</div></div></div>
<div class="navfoot"></div>
<div id="footer"><center>
<span class="footfeed"><a href="http://www.NetBSD.org/cgi-bin/feedback.cgi">
Contact</a> |
</span><span class="footcopy"><a href="/about/disclaimer.html">
Disclaimer</a> |
<span class="copyright">Copyright 1994-2007 The NetBSD Foundation, Inc. </span>ALL RIGHTS RESERVED.<br>NetBSD<sup>/sup> is a registered trademark of The NetBSD
Foundation, Inc.</span>
</center></div>
</div></body>
</html>