/[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.17 - (show annotations) (download) (as text)
Thu Mar 30 08:49:58 2006 UTC (8 years, 5 months ago) by neysx
Branch: MAIN
Changes since 1.16: +11 -9 lines
File MIME type: application/xml
Fixed s/0,1,2/1,2,3/ and delayed creation of mdadm.conf until raid has been created

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

  ViewVC Help
Powered by ViewVC 1.1.20