/[gentoo]/xml/htdocs/doc/en/kernel-upgrade.xml
Gentoo

Contents of /xml/htdocs/doc/en/kernel-upgrade.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.15 - (hide annotations) (download) (as text)
Thu May 4 16:49:14 2006 UTC (8 years, 7 months ago) by fox2mike
Branch: MAIN
Changes since 1.14: +19 -3 lines
File MIME type: application/xml
Bug #113417 - Added a few lines on using eselect to change the kernel symlink. Thanks to Federico Galassi<federico@serversidestudio.it> for reporting.

1 swift 1.1 <?xml version="1.0" encoding="UTF-8"?>
2 fox2mike 1.15 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/kernel-upgrade.xml,v 1.14 2006/02/22 20:30:20 nightmorph Exp $ -->
3 swift 1.1
4     <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
5 neysx 1.3 <guide link="/doc/en/kernel-upgrade.xml">
6 swift 1.1 <title>Gentoo Linux Kernel Upgrade Guide</title>
7     <author title="Author">
8 neysx 1.12 <mail link="dsd@gentoo.org">Daniel Drake</mail>
9 swift 1.1 </author>
10    
11     <abstract>
12     This document describes the process of upgrading your kernel from one release
13     to another.
14     </abstract>
15    
16     <!-- The content of this document is licensed under the CC-BY-SA license -->
17 jkt 1.9 <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
18 swift 1.1 <license/>
19    
20 fox2mike 1.15 <version>0.4</version>
21     <date>2006-05-04</date>
22 swift 1.1
23     <chapter>
24     <title>Introduction</title>
25     <section>
26     <body>
27    
28     <p>
29     The kernel is one of the few package classes in portage that requires some
30     manual intervention to complete the upgrade. Portage will download and
31     install the kernel source for you, but then it is up to you to step in and
32     compile the new kernel before any changes will take effect.
33     </p>
34    
35     <p>
36 swift 1.4 Although this guide is targeted at users upgrading from one kernel release
37 swift 1.1 to another, it will also be useful for users migrating from one kernel
38     package to another.
39     </p>
40    
41     <p>
42 neysx 1.3 <c>gentoo-sources</c> is used as an example in this document, however, the
43 swift 1.1 instructions here also apply to the other packages present in our tree.
44     </p>
45    
46     </body>
47     </section>
48     </chapter>
49    
50     <chapter>
51 swift 1.4 <title>Why upgrade the kernel?</title>
52 swift 1.1 <section>
53     <body>
54    
55     <p>
56     Generally, upgrading from one minor kernel release to the next won't bring any
57 swift 1.4 major differences. There are several reasons to upgrade the kernel. One is to
58     take advantage of a specific new feature or driver; another is to be protected
59     against a security vulnerability, or just to maintain an up-to-date and healthy
60     system.
61 swift 1.1 </p>
62    
63     <p>
64     Even if you choose not to update to every new kernel revision, it is
65     recommended that you at least upgrade from time to time. It is strongly
66     recommended that you immediately upgrade to a new kernel if that new release
67     solves a security problem.
68     </p>
69    
70     </body>
71     </section>
72     </chapter>
73    
74     <chapter>
75     <title>Obtaining the newer sources through Portage</title>
76     <section>
77     <body>
78    
79     <p>
80     You upgrade the kernel sources like you would upgrade any other package -
81     using the <c>emerge</c> utility. It will probably be the case that you want to
82     upgrade your kernel when you see the upgrade appearing on your world updates
83     list. For example:
84     </p>
85    
86     <pre caption="New kernel sources appearing on update list">
87     # <i>emerge -Dup world</i>
88     Calculating dependencies ...done!
89 neysx 1.3 [ebuild NS ] sys-kernel/gentoo-sources-2.6.9-r2 [2.6.8-r5]
90 swift 1.1 </pre>
91    
92 neysx 1.3 <note>
93     The "NS" label in the above output means that the new kernel will be installed
94     in a New Slot, i.e. the sources of your old kernel will be kept around, until
95     you manually remove them.
96     </note>
97    
98 swift 1.1 <p>
99     You can then go ahead and install the update, e.g.:
100     </p>
101    
102     <pre caption="Upgrading your kernel sources">
103 neysx 1.3 # <i>emerge -u gentoo-sources</i>
104 swift 1.1 </pre>
105    
106     <p>
107     The kernel sources will then be installed into a subdirectory of
108 swift 1.4 <path>/usr/src</path>. In the above example, the new kernel sources will be
109 swift 1.1 installed at <path>/usr/src/linux-2.6.9-gentoo-r2</path>.
110     </p>
111    
112     </body>
113     </section>
114     </chapter>
115    
116     <chapter>
117     <title>Updating the /usr/src/linux symbolic link</title>
118     <section>
119     <body>
120    
121     <p>
122 neysx 1.8 Gentoo requires that the <path>/usr/src/linux</path> symbolic link points to
123     the sources of the kernel you are running.
124 swift 1.1 </p>
125    
126     <p>
127 neysx 1.8 Portage can update the symlink automatically when you emerge new kernel
128     sources. All you have to do is add the <c>symlink</c> flag to the USE variable
129     in <path>/etc/make.conf</path>.
130 swift 1.1 </p>
131    
132 neysx 1.8 <pre caption="Example of USE variable in /etc/make.conf">
133     <comment>(Add the symlink keyword)</comment>
134     USE="<i>symlink</i> x86 3dnow 3dnowex X aac aalib adns alsa apache2"
135     </pre>
136    
137     <p>
138 fox2mike 1.15 Alternatively, you could use <c>app-admin/eselect</c> to modify the symlink.
139     </p>
140    
141     <pre caption="Using eselect to symlink">
142     <comment>(Install eselect if you don't have it)</comment>
143     # <i>emerge eselect</i>
144     <comment>(See the list of available kernels)</comment>
145     # <i>eselect kernel list</i>
146     Available kernel symlink targets:
147     [1] linux-2.6.9-gentoo-r1
148     [2] linux-2.6.9-gentoo-r2
149     <comment>(Select the correct kernel)</comment>
150     # <i>eselect kernel set 1</i>
151     </pre>
152    
153     <p>
154 neysx 1.8 If you really want to do it yourself, the following example shows you how to
155     make the link point to <path>linux-2.6.9-gentoo-r2</path>:
156     </p>
157    
158     <pre caption="Updating the /usr/src/linux softlink manually">
159 swift 1.1 # <i>cd /usr/src</i>
160 swift 1.2 # <i>ln -sfn linux-2.6.9-gentoo-r2 linux</i>
161 swift 1.1 </pre>
162    
163     </body>
164     </section>
165     </chapter>
166    
167     <chapter id="install">
168     <title>Configuring, compiling and installing the new kernel</title>
169     <section>
170     <body>
171    
172     <p>
173     For either of these options, you should refer to the instructions given in the
174 swift 1.6 <uri link="/doc/en/handbook/index.xml">Gentoo
175 swift 1.1 Handbook</uri> relating to <e>Configuring the Kernel</e> and <e>Configuring
176 swift 1.4 the Bootloader</e>. Below is an outline of the required actions:
177 swift 1.1 </p>
178    
179     </body>
180     </section>
181     <section>
182     <title>Option 1: Automatic kernel setup with Genkernel</title>
183     <body>
184    
185     <p>
186     If you are a genkernel user, you just need to repeat the stages you went
187     through when installing your kernel for the first time.
188     </p>
189    
190     <p>
191     Simply run genkernel in the normal way:
192     </p>
193    
194     <pre caption="Invoking genkernel">
195 swift 1.7 <comment>(For 2.4 kernels:)</comment>
196 swift 1.1 # <i>genkernel all</i>
197 swift 1.7
198     <comment>(For 2.6 kernels:)</comment>
199     # <i>genkernel --udev all</i>
200 swift 1.1 </pre>
201    
202     <p>
203     You can also use extra parameters for other genkernel functionality. For
204     example, if you wish to configure some extra kernel options using
205     <c>menuconfig</c> and you wish genkernel to automatically update your grub
206 swift 1.5 boot loader configuration, then invoke genkernel as follows:
207 swift 1.1 </p>
208    
209     <pre caption="Invoking genkernel with some common arguments">
210     # <i>genkernel --menuconfig --bootloader=grub all</i>
211     </pre>
212    
213     <p>
214     For more info, follow the
215 swift 1.6 <uri link="/doc/en/genkernel.xml">Gentoo Linux Genkernel
216 swift 1.4 Guide</uri>, or refer to the <uri link="/doc/en/handbook/index.xml">Gentoo
217     Handbook</uri>. Many of the options can be set in the configuration file for
218 swift 1.6 <c>genkernel</c>, <path>/etc/genkernel.conf</path>.
219 swift 1.1 </p>
220    
221     </body>
222     </section>
223     <section>
224     <title>Option 2: Manual configuration</title>
225     <body>
226    
227     <p>
228     To begin, open the <c>menuconfig</c> utility in the kernel source tree:
229     </p>
230    
231     <pre caption="Invoking menuconfig">
232     # <i>cd /usr/src/linux</i>
233     # <i>make menuconfig</i>
234     </pre>
235    
236     <p>
237 swift 1.4 Select the options required for your hardware and operating environment. For
238     additional information on kernel configuration, refer to the chapter entitled
239     <e>Configuring the Kernel</e> of the <uri
240     link="/doc/en/handbook/index.xml">Gentoo Handbook</uri>.
241 swift 1.1 </p>
242    
243     <p>
244     Next, compile your kernel and copy it over to your boot partition. Again,
245 swift 1.4 follow the <uri link="/doc/en/handbook/index.xml">Gentoo Handbook</uri>
246     instructions outlined in the chapter on <e>Configuring the Bootloader</e>. If
247     <path>/boot</path> is a separate partition, ensure it is mounted before copying
248     the compiled kernel to this directory! Failing to do so would keep you from
249     booting the system with your new kernel.
250 swift 1.1 </p>
251    
252     <pre caption="Compiling and installing the new kernel">
253     # <i>make &amp;&amp; make modules_install</i>
254     # <i>mount /boot</i>
255     # <i>cp arch/i386/boot/bzImage /boot/bzImage-2.6.9-gentoo-r2</i>
256     </pre>
257    
258     <p>
259 swift 1.5 Finally, you should update your boot loader configuration, adding an entry for
260     the new kernel (don't delete the old one just yet!) and unmount the
261 swift 1.4 <path>/boot</path> partition. Again, refer to the
262     <uri link="/doc/en/handbook/index.xml">Gentoo Handbook</uri>
263     for detailed instructions on this procedure.
264 swift 1.1 </p>
265    
266     </body>
267     </section>
268     </chapter>
269    
270     <chapter>
271     <title>Reinstalling external modules</title>
272     <section>
273     <body>
274    
275     <p>
276     If you use any kernel modules that are not included in the kernel source tree
277 neysx 1.13 but are provided elsewhere in Portage (e.g. ALSA drivers and NVIDIA or ATI
278     graphics drivers), then you must reinstall these after upgrading the kernel.
279     This is as simple as re-merging the packages involved. For more information,
280     refer to the chapter on <e>Configuring the Kernel</e> in the <uri
281 nightmorph 1.14 link="/doc/en/handbook/">Gentoo Handbook</uri>.
282 swift 1.1 </p>
283    
284 swift 1.11 <p>
285     We provide you with an easy tool (<c>sys-kernel/module-rebuild</c>) which
286 nightmorph 1.14 rebuilds all the kernel modules you have installed using separate ebuilds for
287     the kernel at <path>/usr/src/linux</path>. Its use is straightforward. After
288     emerging it, simply run <c>module-rebuild populate</c> to populate the
289     database with a list of packages that will need to be rebuilt after upgrading
290     the kernel. Once you have finished upgrading or recompiling your kernel, run
291     <c>module-rebuild rebuild</c> to rebuild the drivers for your new kernel.
292 neysx 1.13 </p>
293    
294     <p>
295     For more information, run <c>module-rebuild</c> without any options to see a
296     list of commands that can be passed to the utility.
297 swift 1.11 </p>
298    
299 swift 1.1 </body>
300     </section>
301     </chapter>
302    
303     <chapter>
304     <title>Rebooting into the new kernel</title>
305     <section>
306     <body>
307    
308     <p>
309     Next, close all applications and reboot your system. If you followed the above
310 swift 1.5 instructions correctly, the boot loader menu should include an entry for the
311 swift 1.4 new kernel. Select the new kernel and let the system boot.
312 swift 1.1 </p>
313    
314     <p>
315 swift 1.4 Hopefully, your system successfully boots with the new kernel, and you can log
316     in to resume whatever you were doing. If this is the case, then the upgrade is
317     complete.
318 swift 1.1 </p>
319 neysx 1.13
320 swift 1.1 <p>
321 swift 1.4 If you made a mistake and the system fails to boot with the new kernel, reboot
322 swift 1.5 the system and select the entry from the boot loader that corresponds to the
323 swift 1.4 last known working kernel. You can then restart from the <uri link="#install">
324     Configuring, compiling, and installing the new kernel</uri> stage -- making
325     the appropriate changes to correct your mistake. In some cases, you might not
326     even need to reboot to do this (e.g. you missed a driver for an audio device,
327 swift 1.5 Ethernet adapter, etc.)
328 swift 1.1 </p>
329    
330     </body>
331     </section>
332     </chapter>
333    
334     <chapter>
335     <title>Running multiple kernels</title>
336     <section>
337     <body>
338    
339     <p>
340     You may have noticed, that when installing the sources for your newer kernel,
341 swift 1.4 the sources for your existing kernel were not removed. This is by design -- it
342 swift 1.1 allows you to easily switch between running different kernels.
343     </p>
344    
345     <p>
346     Switching between multiple kernels is as simple as leaving the kernel sources
347     under <path>/usr/src/</path> and leaving the <path>bzImage</path> binaries on
348 swift 1.5 your <path>/boot</path> partition (referenced by entries in your boot loader
349     configuration). Every time you boot up, you will be presented with a choice of
350     which kernel to boot into.
351 swift 1.1 </p>
352    
353     </body>
354     </section>
355     </chapter>
356    
357     <chapter>
358     <title>Removing older kernels</title>
359     <section>
360     <body>
361    
362     <p>
363     Continuing on from the last section, you may be happy with your new kernel and
364     not have any need to keep older kernel versions around. To easily remove all
365     sources for a particular kernel except for the newest one, you can take
366 swift 1.4 advantage of the <e>prune</e> option available through <c>emerge</c>. Continuing
367     the example using <c>gentoo-sources</c>:
368 swift 1.1 </p>
369    
370     <pre caption="Pruning old versions">
371 neysx 1.3 # <i>emerge -P gentoo-sources</i>
372 swift 1.1 </pre>
373    
374     <p>
375     In most cases, temporary files used during compilation will still remain under
376     the appropriate source directory under <path>/usr/src</path>. It is safe to
377     remove these using <c>rm</c>.
378     </p>
379    
380     <p>
381     You can also safely delete any modules that were used by this kernel. This can
382     be done by removing the appropriate directories under <path>/lib/modules/</path>
383     that relate to the kernel versions you are removing. Be careful not to delete
384     modules belonging to kernels that you still use!
385     </p>
386    
387     <p>
388     Finally, you can mount your <path>/boot</path> partition and remove the
389 jkt 1.10 <path>bzImage</path> file(s) for the kernel(s) you are pruning. You should also
390     edit your boot loader configuration so that it no longer references such
391     kernel(s).
392 swift 1.1 </p>
393    
394     </body>
395     </section>
396     </chapter>
397    
398     <chapter>
399 neysx 1.3 <title>Advanced: Using your old kernel .config to configure a new one</title>
400     <section>
401     <body>
402    
403     <p>
404     It is sometimes possible to save time by re-using the configuration file from
405     your old kernel when configuring the new one. Note that this is generally
406 swift 1.4 unsafe -- too many changes between every kernel release for this to be a
407 neysx 1.3 reliable upgrade path.
408     </p>
409    
410     <p>
411     The only situation where this is appropriate is when upgrading from one Gentoo
412     kernel revision to another. For example, the changes made between
413     <c>gentoo-sources-2.6.9-r1</c> and <c>gentoo-sources-2.6.9-r2</c> will be very
414     small, so it is usually OK to use the following method. However, it is not
415     appropriate to use it in the example used throughout this document: upgrading
416     from 2.6.8 to 2.6.9. Too many changes between the official releases, and the
417     method described below does not display enough context to the user, often
418     resulting in the user running into problems because they disabled options that
419     they really didn't want to.
420     </p>
421    
422     <p>
423 swift 1.5 To reuse your old <path>.config</path>, you simply need to copy it over and then
424     run <c>make oldconfig</c>. In the following example, we take the configuration
425     from <c>gentoo-sources-2.6.9-r1</c> and import it into
426 neysx 1.3 <c>gentoo-sources-2.6.9-r2</c>.
427     </p>
428    
429     <pre caption="Reusing your old config">
430     # <i>cd /usr/src/linux-2.6.9-gentoo-r2</i>
431     # <i>cp ../linux-2.6.9-gentoo-r1/.config .</i>
432     # <i>make oldconfig</i>
433     </pre>
434    
435     <p>
436     At this point, you may be asked to produce answers for configuration options
437     which have changed between the two versions. Once you have done that, you can
438     compile and install your kernel as normal, without having to go through the
439     <c>menuconfig</c> configuration process.
440     </p>
441    
442     </body>
443     </section>
444     </chapter>
445    
446     <chapter>
447 swift 1.1 <title>Problems after a kernel upgrade?</title>
448     <section>
449     <body>
450    
451     <p>
452     With the rapid development of the Linux kernel, it is inevitable that some
453 neysx 1.3 changes made from one kernel release to another may cause some problems. If you
454     have any issues with the latest versions of <uri
455     link="/doc/en/gentoo-kernel.xml#doc_chap2"> Gentoo-supported kernels</uri> then
456     please do report the issues to us.
457 swift 1.1 </p>
458    
459     </body>
460     </section>
461     </chapter>
462    
463     </guide>

  ViewVC Help
Powered by ViewVC 1.1.20