/[gentoo]/xml/htdocs/doc/en/gentoo-x86-tipsntricks.xml
Gentoo

Contents of /xml/htdocs/doc/en/gentoo-x86-tipsntricks.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.27 - (show annotations) (download) (as text)
Wed Mar 16 07:47:44 2011 UTC (4 years, 1 month ago) by nightmorph
Branch: MAIN
Changes since 1.26: +8 -7 lines
File MIME type: application/xml
use different bind mount, bug 253681

1 <?xml version='1.0' encoding="UTF-8"?>
2 <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
3 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/gentoo-x86-tipsntricks.xml,v 1.26 2008/05/21 20:26:03 swift Exp $ -->
4
5 <guide>
6 <title>Gentoo/x86 Installation Tips &amp; Tricks</title>
7
8 <author title="Author">
9 <mail link="swift@gentoo.org">Sven Vermeulen</mail>
10 </author>
11 <author title="Editor">
12 <mail link="neysx@gentoo.org">Xavier Neys</mail>
13 </author>
14 <author title="Editor">
15 <mail link="nightmorph"/>
16 </author>
17
18 <abstract>
19 The Gentoo installation allows for very flexible approaches to the various
20 installation methods. As it is almost impossible to insert every single tip or
21 trick in the installation instructions this document tries to deal with all
22 submitted tips and tricks for reference purposes.
23 </abstract>
24
25 <!-- The content of this document is licensed under the CC-BY-SA license -->
26 <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
27 <license/>
28
29 <version>2</version>
30 <date>2011-03-16</date>
31
32 <chapter>
33 <title>Introduction</title>
34 <section>
35 <title>Preliminary</title>
36 <body>
37
38 <p>
39 This document contains various tips and tricks for the Gentoo/x86 installation.
40 Most of them are discussed in a dense way - they are meant as an addendum to the
41 installation instructions and not as a replacement.
42 </p>
43
44 </body>
45 </section>
46 <section>
47 <title>Contents</title>
48 <body>
49
50 <p>
51 <b>Advanced Installations</b>
52 </p>
53
54 <ul>
55 <li><uri link="#software-raid">Software RAID</uri></li>
56 <li><uri link="#ata-raid-2.4">ATA RAID using 2.4 kernels</uri></li>
57 <li><uri link="#livecd-kernel">Using the Installation CD kernel</uri></li>
58 </ul>
59
60 <p>
61 <b>Simplifying the Installation</b>
62 </p>
63
64 <ul>
65 <li><uri link="#leave_terminal">Leaving the Terminal</uri></li>
66 </ul>
67
68 <p>
69 <b>Fixing Errors/Issues</b>
70 </p>
71
72 <ul>
73 <li><uri link="#checking-disks">Extensive Testing of your Disks</uri></li>
74 <li>
75 <uri link="#recover">Recovering from a malfunctioning installation</uri>
76 </li>
77 </ul>
78
79 </body>
80 </section>
81 </chapter>
82 <chapter>
83 <title>Advanced Installations</title>
84 <section id="software-raid">
85 <title>Software RAID</title>
86 <body>
87
88 <note>
89 If you are not familiar with software raid, please read the <uri
90 link="http://tldp.org/HOWTO/Software-RAID-HOWTO.html">Software-RAID-HOWTO</uri>.
91 </note>
92
93 <note>
94 A more detailed procedure can be found in our <uri
95 link="/doc/en/gentoo-x86+raid+lvm2-quickinstall.xml">Software Raid and LVM2 x86
96 Quick Install Guide</uri>.
97 </note>
98
99 <p>
100 Once you are booted from the Installation CD, load the appropriate RAID
101 modules. For instance, if you plan on using RAID-1:
102 </p>
103
104 <pre caption="Loading the RAID-1 module">
105 # <i>modprobe raid1</i>
106 </pre>
107
108 <p>
109 When you partition your disks, make sure that your partitions use <c>fd</c>
110 (Linux raid autodetect) as Partition Type instead of <c>83</c> (Linux native).
111 You can alter the partition type using the <c>t</c> command in <c>fdisk</c>.
112 </p>
113
114 <p>
115 Now before we start creating the RAID arrays, we need to create the metadevice
116 nodes:
117 </p>
118
119 <pre caption="Creating metadevice nodes">
120 # <i>mknod /dev/md1 b 9 1</i>
121 # <i>mknod /dev/md2 b 9 2</i>
122 # <i>mknod /dev/md3 b 9 3</i>
123 </pre>
124
125 <p>
126 After partitioning, create the <path>/etc/mdadm.conf</path> file (yes, indeed,
127 on the Installation CD environment) using <c>mdadm</c>, an advanced tool for
128 <uri link="http://www.linuxdevcenter.com/pub/a/linux/2002/12/05/RAID.html">RAID
129 management</uri>. For instance, to have your boot, swap and root partition
130 mirrored (RAID-1) covering <path>/dev/sda</path> and <path>/dev/sdb</path>,
131 you can use:
132 </p>
133
134 <pre caption="Creating raid devices with the mdadm command">
135 # <i>mdadm --create --verbose /dev/md1 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1</i>
136 # <i>mdadm --create --verbose /dev/md2 --level=1 --raid-devices=2 /dev/sda2 /dev/sdb2</i>
137 # <i>mdadm --create --verbose /dev/md3 --level=1 --raid-devices=2 /dev/sda3 /dev/sdb3</i>
138 </pre>
139
140 <impo>
141 You should not use any form of striping such as RAID-0 or RAID-5 on the
142 partition you boot from.
143 </impo>
144
145 <p>
146 The Linux Software RAID driver will start creating the metadevices. You can see
147 its progress in <path>/proc/mdstat</path>. Wait until the metadevices are
148 completely finished before proceeding.
149 </p>
150
151 <pre caption="Saving information about the created devices">
152 # <i>mdadm --detail --scan > /etc/mdadm.conf</i>
153 </pre>
154
155 <p>
156 From now onwards, use <path>/dev/md1</path> for the boot partition,
157 <path>/dev/md2</path> for the swap partition and <path>/dev/md3</path> for the
158 root partition.
159 </p>
160
161 <p>
162 Right before chrooting, don't forget to copy over <path>/etc/mdadm.conf</path>
163 to <path>/mnt/gentoo/etc</path>.
164 </p>
165
166 <p>
167 When you're configuring your kernel, make sure you have the appropriate RAID
168 support <e>in</e> your kernel and not as module.
169 </p>
170
171 <p>
172 When installing extra tools, emerge <c>mdadm</c> as well. Note that this isn't
173 available on all Installation CDs so you might not be able to install Gentoo on
174 a Software RAID when using a networkless installation!
175 </p>
176
177 <p>
178 When configuring your bootloader, make sure it gets installed in the MBR of
179 <e>both</e> disks if you use mirroring.
180 </p>
181
182 </body>
183 </section>
184 <section id="ata-raid-2.4">
185 <title>ATA RAID using 2.4 kernels</title>
186 <body>
187
188 <p>
189 Make sure you boot your Installation CD using the <c>doataraid</c> option. Once
190 booted, check the contents of <path>/dev/ataraid</path>. It should contain
191 various <path>disc*</path> directories for each harddisk available in the ATA
192 RAID. An entire disk is displayed as <path>disc</path> while partitions are
193 <path>part*</path>.
194 </p>
195
196 <p>
197 Write down the various <path>/dev/ataraid/disc*/*</path> device files that you
198 use to install Gentoo on. You will need to substitute the <path>/dev/hda</path>
199 examples in the installation with this path.
200 </p>
201
202 <p>
203 Before chrooting, bind-mount the <path>/dev</path> structure in the new
204 environment:
205 </p>
206
207 <pre caption="Bind-mounting /dev">
208 # <i>mount --rbind /dev /mnt/gentoo/dev</i>
209 </pre>
210
211 <p>
212 When configuring your kernel, make sure you enable support for your ATA RAID
213 chipset and options. For instance, a popular ATA RAID system is a <e>Promise
214 FastTrack built-in RAID</e> in which case you definitely need <c>Promise
215 FastTrack Options</c> built in into your kernel.
216 </p>
217
218 <p>
219 When configuring GRUB, you first have to create a GRUB bootdisk. This is not as
220 hard as you think. First install GRUB as you would, but when you come to the
221 part where GRUB is getting installed in the MBR, follow the following
222 instructions:
223 </p>
224
225 <pre caption="Creating a GRUB bootdisk">
226 # <i>cd /boot/grub</i>
227 # <i>dd if=stage1 of=/dev/fd0 bs=512 count=1</i>
228 # <i>dd if=stage2 of=/dev/fd0 bs=512 seek=1</i>
229 </pre>
230
231 <p>
232 You still need to write your <path>grub.conf</path> file. This is no different
233 from the installation instructions, just make sure that your <c>root=</c> points
234 to the ATA RAID device.
235 </p>
236
237 <p>
238 After finishing the installation, boot with your GRUB bootdisk. You will be
239 greeted by a GRUB prompt. Now configure GRUB to boot from the ATA RAID device:
240 </p>
241
242 <pre caption="Installing GRUB on the ATA RAID">
243 grub&gt; root (hd0,x)
244 grub&gt; setup (hd0)
245 grub&gt; quit
246 </pre>
247
248 <p>
249 Now reboot (with the GRUB bootfloppy removed).
250 </p>
251
252 <p>
253 LILO users can safely use the instructions mentioned in the installation
254 instructions.
255 </p>
256
257 </body>
258 </section>
259 <section id="livecd-kernel">
260 <title>Using the Installation CD kernel</title>
261 <body>
262
263 <p>
264 If you don't want to compile a kernel yourself you can use the kernel from the
265 Installation CD and copy it to your system. When you come to the point that
266 you're asked to compile a kernel, go to another terminal (press Alt-F2) and
267 log in with the root password you've supplied at the beginning of the
268 installation.
269 </p>
270
271 <p>
272 Copy over the kernel and modules to your Gentoo system:
273 </p>
274
275 <pre caption="Copying over the Installation CD kernel">
276 <comment>(${KN} is the kernel name, usually something like 'gentoo' or 'smp')</comment>
277 cdimage ~# <i>cp /mnt/cdrom/isolinux/${KN} /mnt/cdrom/isolinux/${KN}.igz /mnt/gentoo/boot</i>
278 cdimage ~# <i>mkdir -p /mnt/gentoo/lib/modules</i>
279 cdiamge ~# <i>cp -Rp /lib/modules/`uname -r` /mnt/gentoo/lib/modules</i>
280 </pre>
281
282 <p>
283 To have all modules that are currently running (from the Installation CD) loaded
284 during bootup of your Gentoo system, run the following command from within the
285 chrooted environment:
286 </p>
287
288 <pre caption="Adding all running modules to the modules.conf file">
289 # <i>cat /proc/modules | cut -d ' ' -f 1 &gt;&gt; \</i>
290 <i>/etc/modules.autoload.d/kernel-`uname -r | cut -d . -f -2`</i>
291 # <i>update-modules</i>
292 </pre>
293
294 </body>
295 </section>
296 </chapter>
297
298 <chapter>
299 <title>Simplifying the Installation</title>
300 <section id="leave_terminal">
301 <title>Leaving your Terminal</title>
302 <body>
303
304 <p>
305 Many people want to leave their system when it's compiling. In certain cases
306 this is rather difficult as the installation is done in a public environment
307 where you cannot trust everyone. If this is the case, you want to be able to
308 perform the compilation in the background and log out from all terminals.
309 </p>
310
311 <p>
312 There are several possible solutions for this. The first one is to use
313 <c>screen</c>. After booting the Installation CD, set your root password and
314 start a screen session:
315 </p>
316
317 <note>
318 Not all Installation CDs provide screen. If this is the case, you will have to
319 use one of the other methods described in this section.
320 </note>
321
322 <pre caption="Starting a screen session">
323 # <i>screen -S gentoo</i>
324 </pre>
325
326 <p>
327 Once inside the screen session you can perform the entire installation. When you
328 want to leave your terminal, press <c>Ctrl-a, d</c> (that is, control and a at
329 the same time, then followed by a d) to <e>detach</e> your screen session. You
330 can now safely log out of your system.
331 </p>
332
333 <p>
334 To regain access to your terminal, log in as root again and <e>attach</e> to
335 the running screen session:
336 </p>
337
338 <pre caption="Attaching to a screen session">
339 # <i>screen -x gentoo</i>
340 </pre>
341
342 <p>
343 If you can't use screen, there is still a way to leave your terminal. Follow the
344 installation instructions, but when you come to the point where a long-term
345 compilation would be started (for instance the <c>./scripts/bootstrap.sh</c>
346 step), use <c>nohup</c> which allows for a process to continue even when you log
347 out. Don't forget the trailing "&amp;", otherwise the process won't be placed in
348 the background! Remember where you are (the <c>pwd</c> command will show you
349 that) as you will need to know this later on.
350 </p>
351
352 <pre caption="Using nohup">
353 # <i>pwd</i>
354 /usr/portage
355 # <i>nohup ./scripts/bootstrap.sh &amp;</i>
356 </pre>
357
358 <p>
359 Now exit the chrooted environment (<c>exit</c>) and the Installation CD session.
360 Your compilation will continue in the background.
361 </p>
362
363 <p>
364 When you want to check the compilation, log in as root (on the Installation CD)
365 and chroot back into your environment and go to the directory where you left
366 off:
367 </p>
368
369 <pre caption="Chrooting back">
370 # <i>chroot /mnt/gentoo /bin/bash</i>
371 # <i>env-update &amp;&amp; source /etc/profile</i>
372 # <i>cd /usr/portage</i>
373 </pre>
374
375 <p>
376 Now use the <c>less</c> command on the <path>nohup.out</path> file that is
377 situated inside that directory. The compilation will append its output to that
378 file, so if you want to follow the compilation progress, run <c>less
379 nohup.out</c> and press <c>F</c> to follow the changes. When the compilation is
380 finished, you can continue with the next step of the installation instructions.
381 </p>
382
383 <p>
384 If you ever get tired of following the changes, press <c>Ctrl-C</c> followed by
385 a <c>q</c>. This won't stop the compilation process, only the <c>less</c>
386 process.
387 </p>
388
389 </body>
390 </section>
391 </chapter>
392
393 <chapter>
394 <title>Fixing Errors/Issues</title>
395 <section id="checking-disks">
396 <title>Extensive Testing of your Disks</title>
397 <body>
398
399 <p>
400 If you think your disk needs to be thoroughly checked for consistency (bad
401 sectors and such), you can use the <c>-c</c> option while placing the ext2 or
402 ext3 filesystem on it (using <c>mke2fs</c>). This will format, perform a
403 read-test and mark all bad blocks as such. If you are really paranoid, use
404 <c>-c -c</c> to format your disk and perform an extensive read/write test.
405 </p>
406
407 <pre caption="Checking for disk consistency">
408 # <i>mke2fs -j -c /dev/hda3</i>
409 </pre>
410
411 </body>
412 </section>
413 <section id="recover">
414 <title>Recovering from a malfunctioning installation</title>
415 <body>
416
417 <p>
418 If for some reason your Gentoo installation fails, you don't have to redo the
419 installation all over again. Instead, you can safely "go" to the point where you
420 think you made a mistake (or where you think the instructions are flawed) and
421 try a different approach.
422 </p>
423
424 <p>
425 First of all you need to chroot back into your Gentoo Linux environment. Follow
426 the instructions again, but ignore the partitioning steps as your partitions are
427 already created and even populated. You can therefore immediately mount those
428 partitions at <path>/mnt/gentoo</path>. You should also ignore the steps about
429 stage extraction and modifying <path>make.conf</path> - you don't want to
430 overwrite your files do you?
431 </p>
432
433 <p>
434 Once chrooted inside your Gentoo Linux environment, immediately go to the step
435 where you think you should try a different approach. Don't redo all the steps
436 like bootstrapping and such unless that is the place where you think things
437 went wrong.
438 </p>
439
440 <p>
441 For instance, if you believe that you have a wrongly configured
442 <path>grub.conf</path>, you can immediately fire up your editor to update
443 <path>/boot/grub/grub.conf</path>.
444 </p>
445
446 <p>
447 Once you have tried a different approach for your situation, you should consider
448 how much of the subsequent steps you need to perform again. If the subsequent
449 steps are depending on your change, you will need to redo those.
450 </p>
451
452 <p>
453 For instance,
454 </p>
455
456 <ul>
457 <li>
458 if you have changed a variable inside <path>make.conf</path> you will need
459 to do all subsequent compiling since those depend on the settings inside
460 <path>make.conf</path>
461 </li>
462 <li>
463 if you have altered <path>/boot/grub/grub.conf</path> you can immediately
464 exit the chrooted environment and reboot as no subsequent steps are
465 depending on <path>grub.conf</path>
466 </li>
467 <li>
468 if you have recompiled your kernel you only need to make sure that your
469 bootloader configuration points to the correct kernel image (double-check
470 that you mounted your <path>/boot</path>!), then you can exit the chrooted
471 environment and reboot
472 </li>
473 <li>
474 if you have altered <path>/etc/fstab</path> you can exit the chrooted
475 environment and reboot
476 </li>
477 </ul>
478
479 <p>
480 As you can see, for most recovery operations you can immediately reboot. Only in
481 certain cases will you need to redo the subsequent installation steps.
482 </p>
483
484 </body>
485 </section>
486 </chapter>
487 </guide>

  ViewVC Help
Powered by ViewVC 1.1.20