/[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.19 - (show annotations) (download) (as text)
Wed Oct 4 14:32:04 2006 UTC (7 years, 10 months ago) by neysx
Branch: MAIN
Changes since 1.18: +11 -5 lines
File MIME type: application/xml
Add a link to gentoo-x86+raid+lvm2-quickinstall.xml in softraid section

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

  ViewVC Help
Powered by ViewVC 1.1.20